@abhiram-satha/lotide 中文文档教程
Lotide
Lodash 库的迷你克隆。
Purpose
注意:此库是出于学习目的而发布的。 它不旨在用于生产级软件。
这个项目是我创建和发布的,是我在 Lighthouse Labs 学习的一部分。
Usage
安装它:
npm install @abhiram-satha/lotide
需要它:
const _ = require('@abhiram-satha/lotide ');
调用它:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
目前实现了以下功能:
head(array)
: returns the first element of an arraytail(array)
: returns all the elements after the first elementmiddle(array)
: returns the elements located in the middle of an arrayeqArrays(array1, array2)
: returns true is the elements of 2 arrays are equal and returns false if oppositeassertEqual(actual, expected)
: compares 2 elements and returns true if they are equal and false if they are notassertArraysEqual(array1, array2)
: returns true is the elements of 2 arrays are equal and returns false if oppositeflatten(array)
: Flattens out array of arrays into a single arraycountOnly(allItems, itemsToCount)
: counts only the true items listed in the second argumentfindKeyByValue(object, value)
: Returns the key for the provided value within an objecttakeUntil(array, callback)
: Splices an array until until the criteria set by callback function is metcountLetters(sentence)
: Provides an object with the characters and the amount of times the characters appeared in the sentencewithout(source, itemsToRemove)
: Takes two arrays as an argument, and returns the unique items from the first array argumenteqObjects(object1, object2)
: compares two objects, and returns true if the key-values match, and false is they do notfindKey(object, callback)
: Returns the first key based on the callback function matches the value in an objectletterPositions(sentence)
: provides an object of arrays, listing the index of the characters based in the function argumentmap(array, callback)
: produces a new array based on the parameters set in the callback function, based as a second parameter
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 @abhiram-satha/lotide
Require it:
const _ = require('@abhiram-satha/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: returns the first element of an arraytail(array)
: returns all the elements after the first elementmiddle(array)
: returns the elements located in the middle of an arrayeqArrays(array1, array2)
: returns true is the elements of 2 arrays are equal and returns false if oppositeassertEqual(actual, expected)
: compares 2 elements and returns true if they are equal and false if they are notassertArraysEqual(array1, array2)
: returns true is the elements of 2 arrays are equal and returns false if oppositeflatten(array)
: Flattens out array of arrays into a single arraycountOnly(allItems, itemsToCount)
: counts only the true items listed in the second argumentfindKeyByValue(object, value)
: Returns the key for the provided value within an objecttakeUntil(array, callback)
: Splices an array until until the criteria set by callback function is metcountLetters(sentence)
: Provides an object with the characters and the amount of times the characters appeared in the sentencewithout(source, itemsToRemove)
: Takes two arrays as an argument, and returns the unique items from the first array argumenteqObjects(object1, object2)
: compares two objects, and returns true if the key-values match, and false is they do notfindKey(object, callback)
: Returns the first key based on the callback function matches the value in an objectletterPositions(sentence)
: provides an object of arrays, listing the index of the characters based in the function argumentmap(array, callback)
: produces a new array based on the parameters set in the callback function, based as a second parameter