Created
February 17, 2017 15:30
-
-
Save gabejohnson/49928e051cf43cf6bf97162edcf08f24 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
const alias = prefix => T => { | |
const getKeys = o => Object.keys(o) | |
.filter(k => k.startsWith(prefix+'/')) | |
.map(k => k.split('/')[1]); | |
const scaryMutateObject = o => getKeys(o).forEach(k => o[k] = o[prefix+'/'+k]); | |
scaryMutateObject(T); | |
scaryMutateObject(T.prototype); | |
// I'M RETURNING UNDEFINED!!! | |
} | |
const aliasFL = alias('fantasy-land'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment