1.0.0 • Published 5 years ago
@whyttte/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 @whyttte/lotide
Require it:
const _ = require('@whyttte/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array1, array2): verifies equality of 2 arraysassertEqual(actual, expected): verifies equality of two thingscountLetters(text): count number of letters in a text and returns them as an objectcountOnly(allItems, itemsToCount): returns object of items that were countedeqArrays: checks whether 2 arrays are equaleqObjects(obj1, obj2): checks if the two objects are equalfindKeyByValue(obj, value): finds the key of an object with the valuefindKey(obj, function()): finds the first key in an objecthead(text): returns the first letter of the textindex: require file for head, tail and middleletterPositions(text): finds the positions of lettersmap(word, function()): maps the word the given functionmiddle(string): returns middle letter of a stringtail(element): returns array items except the first onetakeUntil(array, callback()): returns an array that satisfies the callback functiontitleCase(text): capitalises every word in a sentence/phrasetest: tests for some of the functionsassertObjectsEqual(actual, expected): asserts equal objects
1.0.0
5 years ago