1.0.2 • Published 1 year ago
@roy.louyh/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 @roy.louyh/lotide
Require it:
const _ = require('@roy.louyh/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: Get the first element of arraytail(array)
: Get the subarray except the first elementmiddle(array)
: Get the middle element of array if the length is even, return two elements; if odd, return one elementeqArrays(array1,array2)
: Return the result of comparision of two arrayseqObjects(obj1,obj2)
: Return the result of comparision of two objectsfundKeyByValue(obj, value)
: Return the key whose value is in the obj (first key)countOnly(allItems, itemsToCount)
: Return the number of items from allItems which are true in itemToCountletterPoisitions(sentence)
: Return the positions of each letter in the sentenceflatten(array)
:return an array with subarrays