1.0.0 • Published 4 years ago

@sriyabhat/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

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 @sriyabhat/lotide

Require it:

const _ = require('@sriyabhat/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 the array
  • tail(array): returns all the elements of the array except the first one
  • middle(array): returns the middle element(s) of the array. Odd : middle two elements , Even : middle Element.
  • countLetters(sentence): returns the count of the occurences of the each letter in the sentence. Space is not counted.
  • countOnly(allItems,itemsToCount): counts Items that are specified in itemsToCount.
  • eqArrays(array1, array2): returns true if the two arrays are equal and returns false otherwise.
  • eqObjects(object1, object2): returns true if the two objects are equal and returns false otherwise.
  • findKey(object,callback): returns the first key of the object for which the callback returns true.
  • findKeyByValue(object,value): returns the first key of the object which has the value equal to the specified value.
  • letterPositions(sentence): returns the position of each letter in the sentence. Space is not considered.
  • map(word, callback): returns an array as satifying the callback function.
  • takeUntil(array,callback): returns all the elements of the array until the callback function returns true.
  • without(array,itemsToRemove): returns an array without itemsToRemove.