@abhiram-satha/lotide 中文文档教程

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

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 array
  • tail(array): returns all the elements after the first element
  • middle(array): returns the elements located in the middle of an array
  • eqArrays(array1, array2): returns true is the elements of 2 arrays are equal and returns false if opposite
  • assertEqual(actual, expected): compares 2 elements and returns true if they are equal and false if they are not
  • assertArraysEqual(array1, array2): returns true is the elements of 2 arrays are equal and returns false if opposite
  • flatten(array): Flattens out array of arrays into a single array
  • countOnly(allItems, itemsToCount): counts only the true items listed in the second argument
  • findKeyByValue(object, value): Returns the key for the provided value within an object
  • takeUntil(array, callback): Splices an array until until the criteria set by callback function is met
  • countLetters(sentence): Provides an object with the characters and the amount of times the characters appeared in the sentence
  • without(source, itemsToRemove): Takes two arrays as an argument, and returns the unique items from the first array argument
  • eqObjects(object1, object2): compares two objects, and returns true if the key-values match, and false is they do not
  • findKey(object, callback): Returns the first key based on the callback function matches the value in an object
  • letterPositions(sentence): provides an object of arrays, listing the index of the characters based in the function argument
  • map(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 array
  • tail(array): returns all the elements after the first element
  • middle(array): returns the elements located in the middle of an array
  • eqArrays(array1, array2): returns true is the elements of 2 arrays are equal and returns false if opposite
  • assertEqual(actual, expected): compares 2 elements and returns true if they are equal and false if they are not
  • assertArraysEqual(array1, array2): returns true is the elements of 2 arrays are equal and returns false if opposite
  • flatten(array): Flattens out array of arrays into a single array
  • countOnly(allItems, itemsToCount): counts only the true items listed in the second argument
  • findKeyByValue(object, value): Returns the key for the provided value within an object
  • takeUntil(array, callback): Splices an array until until the criteria set by callback function is met
  • countLetters(sentence): Provides an object with the characters and the amount of times the characters appeared in the sentence
  • without(source, itemsToRemove): Takes two arrays as an argument, and returns the unique items from the first array argument
  • eqObjects(object1, object2): compares two objects, and returns true if the key-values match, and false is they do not
  • findKey(object, callback): Returns the first key based on the callback function matches the value in an object
  • letterPositions(sentence): provides an object of arrays, listing the index of the characters based in the function argument
  • map(array, callback): produces a new array based on the parameters set in the callback function, based as a second parameter
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文