1.0.1 • Published 2 years ago
@dexthefish/lotide v1.0.1
Lotide
A mini clone of the Lodash library.
Purpose
BEWARE: This library was published for learning purposes. It is not intended for use in production-grade software.
This project was created and published by myself, Dex Davis, as part of my learnings at Lighthouse Labs.
Usage
Install it:
npm install @username/lotide
Require it:
const _ = require('@dexthefish/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(a,b)
: log a message indicating (in)equality of arrays a,bassertEqual(a,b))
: log a message indicating (in)equality of primitives a,bassertObjectsEqual(a,b)
: log a message indicating (in)equivalence of objects a,bcountLetters(s)
: sort the characters of a string s into bins with countscountOnly(a,b)
: sort the elements of an array a into bins with counts, but only if they can be found somewhere in beqArrays(a,b)
: return true iff a and b refer to the same arrayeqObjects(a,b)
: return true iff a and b refer to the same objectfindKey(a,callback)
: return the first key of a whose value satisfies callbackfindKeyByValue(a,b)
: return the first key of a whose value equals bhead(a)
: return first element of an arrayletterPositions(s)
: map the unique characters of s to the set of indices at which they occurmap(a,callback)
: return a sub-array of a, taking elements iff they satisfy callbackmiddle(a)
: return the middle element(s) of a as an arraytail(a)
: return a new array by excluding the first element of atakeUntil(a,callback)
: return a new array by truncating a at the first element which satisfies callbackwithout(a,callback)
: return a new array by excluding the elements of a which satisfy callback