1.0.0 • Published 6 years ago
@ryanc337/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 @ryanc337/lotide
Require it:
const _ = require('@ryanc337/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array1, array2)
: Check the equality between two arraysassertEqual(actual, exprected)
: check the expected result of a functionassertObjectsEqual(actual, expected
: check the equality between this and the eqObjects functioncountLetters(string)
: count the number of letters in a given stringcountOnly(allItems, itemsToCount)
: count the number of specified itemseqArrays(array1, array2)
: loops through each array to check index for equalityeqObjects(object1, object2)
: loops through each object to check key-value pairs for equalityfindKey(callback)
: finds the speficed key in a specific object via callback functionfindKeyByValue(object, value)
: same as findKey but takes a value and will return wanted keyflatten(array)
: takes an array of arrays and returns one new array with no arrays insidehead(array)
:slices and array at index 1 to return only the index of 0 within that arrayletterPositions(sentence)
: takes a sentence and returns the index of each letter within the sentencemap(array, callback)
an alternative to array.protoype.map in Es6middle(array)
returns the middle index element(s) of an arraytail(array)
slices array at 1 and returns the rest of the arraytakeUntil(array, callback)
: retrieves data from an array until callback functions is falsewithout(source, itemsToRemove)
: removes certain items from a source;
1.0.0
6 years ago