Created
April 6, 2019 18:30
-
-
Save boombang/f8d6ea2cf954084f7043fd77efddc214 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//array.js | |
export function each(collection, callback) { | |
//something interesting | |
} | |
export function filter(collection, callback) { | |
//something interesting | |
each(collection, ...) | |
//something interesting | |
} | |
export function map(collection, iterator) { | |
//something interesting | |
each(collection, ...) | |
//something interesting | |
} | |
export function reduce(collection, iterator, accumulator) { | |
//something interesting | |
each(collection, ...) | |
//something interesting | |
} | |
//index.js | |
import * as Utils from ‘./utils.js’; | |
Utils.each([1, 2, 3], function(x) { console.log(x) }); | |
//or | |
import * as Utils from ‘./utils.js’; | |
Utils.filter([1, 2, 3], function(x) { return x === 2 }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment