Moves to next challenges

This commit is contained in:
Berkeley Martinez
2016-06-01 15:52:08 -07:00
parent 515051d817
commit cc8b608cb9
16 changed files with 327 additions and 546 deletions

View File

@@ -1,16 +1,7 @@
export function nameSpacedTransformer(ns, transformer) {
if (!transformer) {
return nameSpacedTransformer.bind(null, ns);
}
return (state) => {
const newState = transformer(state[ns]);
// nothing has changed
// noop
if (!newState || newState === state[ns]) {
return null;
}
return { ...state, [ns]: newState };
};
export function dashify(str) {
return ('' + str)
.toLowerCase()
.replace(/\s/g, '-')
.replace(/[^a-z0-9\-\.]/gi, '')
.replace(/\:/g, '');
}