1.0.0 • Published 6 years ago
@teddyleung/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 @teddyleung/lotide
Require it:
const _ = require('@teddyleung/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
countLetters: Takes a string and returns an object with the count of each lettercountOnly: Takes one array of elements and a second array of items to search and returns an object with the count of each item searchedeqArrays: Takes two arrays and checks for equalityeqObjects: Takes two objects and checks for equalityfindKey: Takes an object and a callback function and returns the key of the object where the callback evaluates to truefindKeyByValue: Takes an object and a value and finds the key that corresponds to the valueflatten: Flattens multi-layer arrayshead: Takes an array and returns the first elementletterPositions: Takes a string and returns an object with keys of each letter and values which are arrays of the letter positionsmap: Takes an array and a callback, applies the callback to each element in the array, and returns the new arraymiddle: Takes an array and returns an array of the middle element if length is odd or the middle two elements if length is eventail: Takes an array and returns all elements other than the firsttakeUntil: Takes an array and a callback and returns an array of elements up to the element where the callback returns truewithout: Takes two arrays and returns the first array without items that exist in the second array
1.0.0
6 years ago