Package Exports
- @writetome51/array-remove-all-after-before
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@writetome51/array-remove-all-after-before) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
To include:
import {removeAllAfterFirst, removeAllAfterLast, removeAllBeforeFirst, removeAllBeforeLast}
from '@writetome51/array-remove-all-after-before';This package has 4 functions. They all return void.
For all of them, the parameter 'value' cannot be an object.
removeAllAfterFirst(value, array); // removes everything in array after first instance of value.
removeAllAfterLast(value, array); // removes everything after last instance of value.
removeAllBeforeFirst(value, array); // removes everything before first instance of value.
removeAllBeforeLast(value, array); // removes everything before last instance of value.
Examples:
let arr = [5,10,15,20,10,50,60,70];
removeAllAfterFirst(10, arr);
// arr is now [5,10]
let arr = [5,10,15,20,10,50,60,70];
removeAllAfterLast(10, arr);
// arr is now [5,10,15,20,10]
let arr = [5,10,15,[20,22],10,50,[20,22],60];
removeAllBeforeFirst([20,22], arr);
// arr is now [[20,22],10,50,[20,22],60]
let arr = [5,10,15,[20,22],10,50,[20,22],60];
removeAllBeforeLast([20,22], arr);
// arr is now [[20,22],60]