@acooper5259/lotide 中文文档教程

发布于 4年前 浏览 20 项目主页 更新于 3年前

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 或 false

  • findKey(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 array

  • tail(array): returns all the remaining values of an array, except the first

  • middle(array): returns middle value(s) of the parameter array once sorted.

  • assertArrayEqual(array1, array2: check for strict equality between arrays, logging out to the console

  • assertEqual(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 console

  • countLetters(sentence): returns an object with individual characters as keys and their count as values

  • countOnly(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 arrays

  • eqObject(object1, object2): returns true or false after evaluating for equality between 2 objects

  • findKey(object, callback): returns the key string for an object value determined by the callback

  • findKeyByValue(object, value): returns the key of an object according to its value

  • letterPositions(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.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文