You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dist/index.cjs
+1-7Lines changed: 1 addition & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -12,14 +12,12 @@ var arrayBack = require('array-back');
12
12
* - Find one or more items, return them, remove them from the input array
13
13
*
14
14
* arr {string[]} - Input array. Only mutated if `options.remove` is set.
15
-
* [options.rtol] {boolean} - Enable right-to-left scans. Either that or pass in a custom iterator. TODO.
16
15
* [options.remove] {boolean} - Remove from source array
17
16
* [options.from] {string[]|function[]} - String literal or a [findIndex](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex) callback function.
18
17
* [options.to] {string[]|function[]} - A "Stop Here" function. Set one or more strings as the terminating arg. Or, from the function `fn(arg, index, argv, valueIndex)`, return true for the first arg that is out of range. Set `inclusive` to also include it. To will always search to the end of the input array.
19
18
* @returns string[]
20
19
*/
21
20
22
-
/* TODO: rename to extractFromTo? Rename `options.remove` to `extract`. */
23
21
functionfromTo(arr,options={}){
24
22
/* step 1: compute from and to index */
25
23
constfromIndex=arr.findIndex(item=>{
@@ -92,7 +90,7 @@ function getFromIndex (arr, find) {
/* TODO: factor out into a FromTo Extractor-derived class as relevant only to from-to. */
138
135
consttoPresets={
139
136
singleOptionValue(arg,index,argv,valueIndex){
140
137
returnvalueIndex>1||arg.startsWith('--')
@@ -179,9 +176,6 @@ class CommandLineArgs {
179
176
}
180
177
181
178
/* Do the positionals backwards, so removing them doesn't mess up the position config */
182
-
/* TODO: factor this behaviour out into a specialised Extractor derived Positional class. Remove hard-coded logic switches like 'positional', logic & behaviour should be passed in. */
183
-
/* TODO: Need a "pre-processing" step for Extractor-specific steps like changing the sort order */
184
-
/* TODO: Should positionals be processed last to avoid extracting fromTo or single definitions (e.g. --option value) */
Copy file name to clipboardExpand all lines: index.js
-4Lines changed: 0 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,6 @@ import { fromTo, single, positional } from './lib/from-to.js'
2
2
3
3
functiondefaultOutput(val){returnval}
4
4
5
-
/* TODO: factor out into a FromTo Extractor-derived class as relevant only to from-to. */
6
5
consttoPresets={
7
6
singleOptionValue(arg,index,argv,valueIndex){
8
7
returnvalueIndex>1||arg.startsWith('--')
@@ -47,9 +46,6 @@ class CommandLineArgs {
47
46
}
48
47
49
48
/* Do the positionals backwards, so removing them doesn't mess up the position config */
50
-
/* TODO: factor this behaviour out into a specialised Extractor derived Positional class. Remove hard-coded logic switches like 'positional', logic & behaviour should be passed in. */
51
-
/* TODO: Need a "pre-processing" step for Extractor-specific steps like changing the sort order */
52
-
/* TODO: Should positionals be processed last to avoid extracting fromTo or single definitions (e.g. --option value) */
Copy file name to clipboardExpand all lines: lib/from-to.js
+1-3Lines changed: 1 addition & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,12 @@ import arrayBack from 'array-back'
10
10
* - Find one or more items, return them, remove them from the input array
11
11
*
12
12
* arr {string[]} - Input array. Only mutated if `options.remove` is set.
13
-
* [options.rtol] {boolean} - Enable right-to-left scans. Either that or pass in a custom iterator. TODO.
14
13
* [options.remove] {boolean} - Remove from source array
15
14
* [options.from] {string[]|function[]} - String literal or a [findIndex](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex) callback function.
16
15
* [options.to] {string[]|function[]} - A "Stop Here" function. Set one or more strings as the terminating arg. Or, from the function `fn(arg, index, argv, valueIndex)`, return true for the first arg that is out of range. Set `inclusive` to also include it. To will always search to the end of the input array.
17
16
* @returns string[]
18
17
*/
19
18
20
-
/* TODO: rename to extractFromTo? Rename `options.remove` to `extract`. */
21
19
functionfromTo(arr,options={}){
22
20
/* step 1: compute from and to index */
23
21
constfromIndex=arr.findIndex(item=>{
@@ -90,7 +88,7 @@ function getFromIndex (arr, find) {
0 commit comments