UNPKG

jsmodern

Version:

An extension to existing JavaScript, influenced by other great languages such as Rust, Dart, Java, Golang, etc.

20 lines 560 B
export const select = { label: 'select', fn: function arraySelect(callbackFn) { const ctx = this; const len = ctx.length; if ('function' !== typeof (callbackFn)) { throw new TypeError(`Expect 'callbackFn' to be a function`); } if (!len) return []; const result = []; for (let i = 0; i < len; i += 1) { const n = ctx[i]; if (callbackFn(n)) result.push(n); } return result; }, }; //# sourceMappingURL=select.js.map