1.0.0 • Published 4 years ago
@kjohnstondev/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 kjohnstondev/lotide
Require it:
const _ = require('kjohnstondev/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertEqual(actual, expected): This compares two values and returns true or false based on resultseqArrays(arr1, arr2): compares two arrayseqObjects(object1, object2): compares two objectsassertArraysEqual([arr1], [arr2]): returns true if passed arrays are equal and false if they are notassertObjectsEqual({object1}, {object2}: compares two objects and returns true or falsehead([arr]): returns the first element of an arraytail([arr]): returns everything but the first element of an arraymiddle([arr]): returns the middle element or elements of an arraycountLetters('string'): returns an object that keeps count of how many times each letter occurs in a stringletterPositions('sentence'): returns all the indices in the string where each character is found in an objectcountOnly([arr], itemsToCount): takes an array and a paramater - returns an object with the counts of matching elements in the arrayfindKey({object}, callback): scans the object and returns the first key that is truthy according to the callbackfindKeyByValue({object}, val): searches for a key on an object where its value matches a given valuemap([array], callback): creates a new array with the results of a callback on every element in the array enteredtakeUntil([array], callback): returns a slice of the array with elements taken from the beginningwithout([array], itemsToRemove): removes specified elements from an array
1.0.0
4 years ago