1.0.0 • Published 4 years ago
@willzak/lotide v1.0.0
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 @willzak/lotide
Require it:
const _ = require('@willzak/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertEqual(actual, expected)
: prints message if two values are equalassertArraysEqual(arr1, arr2)
: prints message if two arrays are equalassertObjectsEqual(obj1, obj2)
: prints message if two objects are equalcountLetters(sentence)
: counts the number of letters in a stringcountOnly(allItems, itemsToCount)
: reports the number of instances some items occur within an array according to an objecteqArrays(arr1, arr2)
: returns true or false based on a perfect match between two arrayseqObjects(obj1, obj2)
: returns true or false based on a perfect match between two objectsfindKey(object, callback)
: returns a key if it matches the result of the given callback funcfindKeyByValue(object, value)
: returns a key based on a given valuehead(array)
: returns the first item in an arrayletterPositions(sentence)
: returns the position (index) of a given item in a stringmap(array, callback)
: returns an array of items that match the given callback function's resultsmiddle(array)
: returns the middle section of an array with length 3 or greatertail(array)
: returns the tail of an arraytakeUntil(...)
: returns an of values up until a point designated by the callbackwithout(source, toRemove)
: creates a new array without words that are inputed to be removed
1.0.0
4 years ago