1.0.2 • Published 2 years ago
@sszyh/lotide v1.0.2
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 @sszyh/lotide
Require it:
const _ = require('@sszyh/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: descriptionfunction2(...)
: descriptionfunction3(...)
: descriptionhead(array)
: return the first elementtail(array)
: return the elements except the first onemiddle(array)
: return the middle element/or middle two elementsassertArraysEqual(actual, expected)
: check if two arrays are equalassertEqual(actual, expected)
: check if two primitive elements are equalassertObjectsEqual(actual, expected)
: check is two objects are equalcountLetters(inputString)
: output a object to show the number has showed in the stringcountOnly(allItems, itemsToCount)
: Counts the number of occurrences of the specified itemseqArrays(array1, array2)
: check if two arrays are equaleqObjects(object1, object2)
: check is two objects are equalfindKey(object, callback)
: find the key of specified functionfindKeyByValue(object, value)
:find the key of specified valueletterPositions(sentence)
: find the index that letter shows in a stringmap(array, callback)
: return a new function base on the callback functiontakeUntil(array, callback)
: return a array base on the functionwithout(source, itemsToRemove)
: return a array without specified items