@acooper5259/lotide 中文文档教程
Lotide
Lodash 库的迷你克隆。
Purpose
注意:此库是出于学习目的而发布的。 它不旨在用于生产级软件。
这个项目是我创建和发布的,是我在 Lighthouse Labs 学习的一部分。
Usage
安装它:
npm install @username/lotide
需要它:
const _ = require('@username/lotide');< /code>
调用它:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
目前实现了以下功能:
head(array)
:返回数组的第一个值tail(array)
:返回所有的数组的剩余值,除了第一个middle(array)
:排序后返回参数数组的中间值。assertArrayEqual(array1, array2
:检查数组之间是否严格相等,注销到控制台assertEqual(actual, expected)
:检查实际值和预期值是否严格相等.assertObjectEqual(object1, object 2)
:检查对象之间的严格相等性,注销到控制台countLetters(sentence)
:返回一个以单个字符作为键的对象及其计数值
为 评估 2 个数组之间的严格相等
eqObject(object1, object2)
:在评估 2 个对象之间的相等性后返回 true 或 falsefindKey(object, callback)
:返回键字符串对于由回调确定的对象值findKeyByValue(object, value)
:根据返回对象的键 到它的值letterPositions(sentence)
:返回一个对象字母/索引作为给定字符串的键值对。map(array,callback)
:回调应用于初始数组后返回一个新数组。takeUntil(array, callback)
:从初始数组返回一个值数组,直到 callback 的计算结果为 false。without(source, itemsToRemove)
:返回没有 itemsToRemove 的数组的浅表副本。
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('@username/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: returns the fist value of an arraytail(array)
: returns all the remaining values of an array, except the firstmiddle(array)
: returns middle value(s) of the parameter array once sorted.assertArrayEqual(array1, array2
: check for strict equality between arrays, logging out to the consoleassertEqual(actual, expected)
: check for strict equality of an actual and an expected value.assertObjectEqual(object1, object 2)
: check for strict equality between objects, logging out to the consolecountLetters(sentence)
: returns an object with individual characters as keys and their count as valuescountOnly(allItems,itemsToCount
: counts through an array for instances of a specific value. Returns an object.eqArrays(array1, array2)
: returns true or false after evaluating for strict equality between 2 arrayseqObject(object1, object2)
: returns true or false after evaluating for equality between 2 objectsfindKey(object, callback)
: returns the key string for an object value determined by the callbackfindKeyByValue(object, value)
: returns the key of an object according to its valueletterPositions(sentence)
: return an object letter/index as key value pairs for a given string.map(array,callback)
: returns a new array after callback applied to initial array.takeUntil(array, callback)
: returns an array of values from initial array until callback evaluates to false.without(source, itemsToRemove)
: returns a shallow copy of an array without the itemsToRemove.