1.0.0 • Published 4 years ago
@carmtsang/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 @carmtsang/lotide
Require it:
const _ = require('@carmtsang/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual: Assertion test that compares two arraysassertEqual: Assertion test to compare two primitive types.assertObjectEqual: Assertion test to compare two objectscountLetters: Count the number of times a value appears in a string.countOnly: Take a collection of items and return coutns for a specific subset of those itemseqArrays: Compare two arrays for a perfect match.eqObjects: Compare two objects for a perfect matchfindKey: Scans an object and return the first key which the callback returns a truthy value.findKeyByValue: Scan an object and return the first key that contains that given value.flatten: Flatten array by 1 levelhead: Return the first value of an arrayletterPositions: Return all the indices each letter of the stringmap: Creates a new array with the results of calling a provided function on the elements in the calling array.middle: Return the middle value of the arraytail: Return the tail of the arraytakeUntil: Return a slice of the array with elements taken from the beginning.without: Filter out array and remove unwanted items
1.0.0
4 years ago