1.0.0 • Published 5 years ago
@kacsokz/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 @kacsokz/lotide
Require it:
const _ = require('@kacsokz/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(actual, expected)
: equality assertion for two arraysassertEqual(actual, expected)
: strict equality assertion for two valuesassertObjectsEqual(actual, expected)
: equality assertion for two objectscountLetters(allLetters, lettersToCount)
: counts letters in string allLetters, in object lettersToCountcountOnly(allItems, itemsToCount)
: counts items in array allItems, based on object itemsToCounteqArrays(arr1, arr2)
: compares two arrays for equalityeqObjects(object1, object2)
: compares two objects for equalityfindKey(obj, callback)
: returns first key based on parameters of callbackfindKeyByValue(obj, val)
: returns first key based on a specified valueflatten(nestedArray)
: returns a flattened array, from a nested arrayhead(arr)
: returns head on an arrayletterPositions(str)
: returns all indices of each letter in the sentencemap(arr1, arr2)
: shallow version of the iterator mapmiddle(arr)
: returns middle element(s) of an arraymin(numbers)
: returns the smallest number in an arraytail(arr)
: returns tail of an arraytakeUntil(array, callback)
: pushes array elements into a new array until the stopping condition in callback is metwithout(source, itemsToRemove)
: returns a new, filtered array, removing any itemsToRemove that match source
1.0.0
5 years ago