A library of witty Javascript one-liner functions. The 1loc.dev website has a collection of useful Javascript one-liners, now you get to use them in your Javascript projects.
One Liners are great, but the rest of your team would appreciate a little more clarity, So we've abstracted them for you, as readeable function names, so you and your teammates can focus on important stuff.
Install the 1Loc library using yarn
or npm
yarn add 1loc
or using npm
npm i 1loc --save
import { cloneArray } from '1loc'
const myArray = [{ name: 'me', age: 2}]
const arrayClone = cloneArray(myArray) // [{ name: 'me', age: 2}]
More Examples
import { arrayHasSameValues } from '1loc'
const hasSameValues = arrayHasSameValues([1, 2, 4], [4, 1, 2])
console.log(hasSameValues) // true
You can also visit the original 1loc website here.
Here's a collection of function definitions and what they do.
You can fork the 1loc-lib and create an MR from your fork.
Alternatively, clone the 1loc-lib locally.
git clone [email protected]:MartinsOnuoha/1loc-lib.git