Skip to content

vitor-mariano/adolph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Adolph

Smart functions for daily challenges

Installation

npm install --save adolph

Functions

clearString

String → String

Added in v0.1.0

Remove accents and uppercase characters.

clearString('José Raphaël'); // jose raphael

filterByProp

String → a → [{k: v}] → [{k: v}]

Added in v0.1.0

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' }]

paginate

Number → Number → [a] → [a]

Added in v0.1.0

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 }]

removeByProp

String → a → [{k: v}] → [{k: v}]

Added in v0.2.0

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}]

License

React Fission is open-sourced software licensed under the MIT license.

About

Smart functions for daily challenges

Resources

Stars

Watchers

Forks

Packages

No packages published