@@ -26,7 +26,6 @@ var resolve = require( 'path' ).resolve;
26
26
var readFileSync = require ( '@stdlib/fs/read-file' ) . sync ;
27
27
var CLI = require ( '@stdlib/cli/ctor' ) ;
28
28
var stdin = require ( '@stdlib/process/read-stdin' ) ;
29
- var Number = require ( '@stdlib/number/ctor' ) ;
30
29
var stdinStream = require ( '@stdlib/streams/node/stdin' ) ;
31
30
var reEOL = require ( '@stdlib/regexp/eol' ) ;
32
31
var substringAfter = require ( './../lib' ) ;
@@ -74,8 +73,8 @@ function main() {
74
73
if ( ! stdinStream . isTTY ) {
75
74
return stdin ( onRead ) ;
76
75
}
77
- if ( flags . fromIndex ) {
78
- console . log ( substringAfter ( str , flags . search , Number ( flags . fromIndex ) ) ) ; // eslint-disable-line no-console, max-len
76
+ if ( flags [ 'from-index' ] ) {
77
+ console . log ( substringAfter ( str , flags . search , parseInt ( flags [ 'from-index' ] , 10 ) ) ) ; // eslint-disable-line no-console
79
78
} else {
80
79
console . log ( substringAfter ( str , flags . search ) ) ; // eslint-disable-line no-console
81
80
}
@@ -89,15 +88,17 @@ function main() {
89
88
* @returns {void }
90
89
*/
91
90
function onRead ( error , data ) {
91
+ var fromIndex ;
92
92
var lines ;
93
93
var i ;
94
94
if ( error ) {
95
95
return cli . error ( error ) ;
96
96
}
97
97
lines = data . toString ( ) . split ( reEOL . REGEXP ) ;
98
- if ( flags . fromIndex ) {
98
+ if ( flags [ 'from-index' ] ) {
99
+ fromIndex = parseInt ( flags [ 'from-index' ] , 10 ) ;
99
100
for ( i = 0 ; i < lines . length ; i ++ ) {
100
- console . log ( substringAfter ( lines [ i ] , flags . search , Number ( flags . fromIndex ) ) ) ; // eslint-disable-line no-console, max-len
101
+ console . log ( substringAfter ( lines [ i ] , flags . search , fromIndex ) ) ; // eslint-disable-line no-console, max-len
101
102
}
102
103
} else {
103
104
for ( i = 0 ; i < lines . length ; i ++ ) {
0 commit comments