File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { input, confirm } from '@inquirer/prompts'
44
55
66
7+ // Simplify std out from `console.log` into `print`
78const print = console . log ;
89
910
@@ -17,8 +18,7 @@ const print = console.log;
1718 * @param {Array } data - the raw data
1819 */
1920export default async function singleFeatureProcess ( data ) {
20- console . clear ( )
21- print ( '\n=====================================================\n' )
21+ print ( '=====================================================\n' )
2222 print ( chalk . blue ( 'SINGLE FEATURE PROCESS\n' ) )
2323
2424 const answers = await inquirer . prompt ( [
@@ -36,6 +36,21 @@ export default async function singleFeatureProcess(data) {
3636 }
3737 ] )
3838
39+ if ( answers . feature == answers . label ) {
40+ print ( chalk . bgMagenta ( 'Feature and label can not be same' ) )
41+
42+ if ( await confirm ( { message : 'Back?' } ) ) return ;
43+ }
44+
45+
46+ for ( const item of data ) {
47+ if ( ! Number . isNaN ( item [ answers . feature ] ) || ! Number . isNaN ( item [ answers . label ] ) ) {
48+ print ( chalk . redBright ( '\n[!] Some data is not a number! Unable to process further!' ) )
49+ await confirm ( { message : 'Continue?' } )
50+ return ;
51+ }
52+ }
53+
3954
4055 /**
4156 * Calculate the value a and b to get equation y = a + bx
You can’t perform that action at this time.
0 commit comments