Skip to content

Instantly share code, notes, and snippets.

@codemilli
Created March 5, 2017 07:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codemilli/3b183dae5e599fc7a864877546821307 to your computer and use it in GitHub Desktop.
Save codemilli/3b183dae5e599fc7a864877546821307 to your computer and use it in GitHub Desktop.
FunctorObject
class FunctorObject {
constructor (obj) {
this.value = obj;
}
map (func) {
const obj = {};
for (const key of Object.keys(this.value)) {
obj[key] = func(this.value[key]);
}
return new FunctorObject(obj);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment