Smart functions for daily challenges
npm install --save adolph
String → String
Remove accents and uppercase characters.
clearString('José Raphaël'); // jose raphael
String → a → [{k: v}] → [{k: v}]
Filter objects from list
where prop
matches the given query
.
const list = [{ name: 'João Silva' }, { name: 'José Raphaël' }, { name: 'Joseph Climber' }];
filterByProp('name', 'jose', list); // [{ name: 'José Raphaël' }, { name: 'Joseph Climber' }]
Number → Number → [a] → [a]
Get the nth
portion of n
size portions of a list
.
const list = [{ id: 1 }, { id: 2 }, ..., { id: n }];
paginate(2, 10, list); // [{ id: 11 }, { id: 12 }, ..., { id: 20 }]
String → a → [{k: v}] → [{k: v}]
Remove the first object from list
where prop
matches the given value
.
const list = [{ id: 1 }, { id: 2 }, { id: 3 }, { id: 4}];
removeByProp('id', 2, list); // [{ id: 1 }, { id: 3 }, { id: 4}]
React Fission is open-sourced software licensed under the MIT license.