@darylt/lotide
v1.0.0
Published
A collection of useful functions.
Downloads
2
Readme
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 me as part of my learnings at Lighthouse Labs.
Usage
Install it:
npm install daryl-sen/lotide
Require it:
const _ = require('daryl-sen/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
function1(...)
: descriptionfunction2(...)
: descriptionfunction3(...)
: descriptionassertArraysEqual()
: checks to see if two arrays are equalassertEqual()
: checks to see if two pieces of primitive data are equalassertObjectsEqual()
: checks to see if two objects are equalcountLetters()
: creates a tally of all the letters/characters in a stringcountOnly()
: creates a tally of all the specified characters onlyeqArrays()
: helper function for assertArraysEqualeqObjects()
: helper function for assertObjectsEqualfindKey()
: find a key that satisfies a callback function (returns true)findKeyByValue()
: find the key in an object that corresponds to a valueflatten()
: flattens an array of arrays into a single-level arrayhead()
: returns the first element in an arrayletterPositions()
: returns the indices where each letter appearsmap()
: creates a new array based on an old arraymiddle()
: returns the middle element in an array as an arraytail()
: returns an array without the first elementtakeUntil()
: keep collecting items from a provided array until the callback provided returns a truthy value.without()
: return a subset of a given array, removing unwanted elements