| Index: lib/coreUtils.js |
| =================================================================== |
| --- a/lib/coreUtils.js |
| +++ b/lib/coreUtils.js |
| @@ -50,8 +50,40 @@ |
| } |
| exports.findIndex = findIndex; |
| function indexOf(iterable, searchElement) |
| { |
| return findIndex(iterable, item => item === searchElement); |
| } |
| exports.indexOf = indexOf; |
| + |
| +function* filterIt(iterable, callback, thisArg) |
| +{ |
| + for (let item of iterable) |
| + { |
| + if (callback.call(thisArg, item)) |
| + yield item; |
| + } |
| +} |
| +exports.filterIt = filterIt; |
| + |
| +function* mapIt(iterable, callback, thisArg) |
| +{ |
| + for (let item of iterable) |
| + yield callback.call(thisArg, item); |
| +} |
| +exports.mapIt = mapIt; |
| + |
| +function* flattenIt(iterable, callback, thisArg) |
| +{ |
| + for (let item of iterable) |
| + yield* item; |
| +} |
| +exports.flattenIt = flattenIt; |
| + |
| +function* regExpIt(regExp, string) |
| +{ |
| + let match = null; |
| + while (match = regExp.exec(string)) |
| + yield match; |
| +} |
| +exports.regExpIt = regExpIt; |