/1loc-lib

A library of witty Javascript one-liners. The 1loc.dev website has a collection of useful Javascript one-liners, now you get to use them in your Javascript projects 🚀

Primary LanguageTypeScript

1Loc Lib

Commitizen friendly

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.

TOC

Getting Started

Install the 1Loc library using yarn or npm

yarn add 1loc

or using npm

npm i 1loc --save

Import Any One-liner and use

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

Explore a list of possible One-liners

Documentation Here

You can also visit the original 1loc website here.

One Liners

Here's a collection of function definitions and what they do.

Contribution

You can fork the 1loc-lib and create an MR from your fork.

Alternatively, clone the 1loc-lib locally.

git clone git@github.com:MartinsOnuoha/1loc-lib.git