1.0.0 • Published 2 years ago
@rdininno/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 @username/lotide
Require it:
const _ = require('@rdininno/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: takes in an array and returns the head(first item)tail(array
: takes in an array and return everything but the head(first item)middle(array)
: takes an array and returns an array of the middle values(s)assertArraysEqual(a, b)
: assertion for comparison of two arraysassertEqual(actual, expected)
: assertion for equalityassertObjectsEqual(actual, expected)
: assertion for object equalitycountLetters(string)
: take a string and returns how many times each letter appearscountOnly(array, item)
: takes an array and counts how many times item appearseqArrays(a, b)
: compares two arrays for equality. Works with nested arrayseqObjects(object1, object2)
: compares two objects. works with nested objectsfindKey(object, callback)
: finds a key in an object. Takes callback function to find itemfindKeyByValue(object, val)
: finds key with given valueletterPositions(string)
: returns the positions of the letters in the given stringmap(arr, callback)
: performs a function on every item of an arraytakeUntil(array, callback)
: returns array of given array until callback function cutswithout(a, b)
: returns an array without the given value(b) in array(a)
1.0.0
2 years ago