1.0.0 • Published 3 years ago

@cynthialeung/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 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 @cynthialeung/lotide

Require it:

const _ = require('@cynthialeung/lotide');

Call it:

const results = _.tail([1, 2, 3]) // => [2, 3]

Documentation

The following functions are currently implemented:

  • assertArraysEqual: asserts if two arrays are equal
  • assertEqual: asserts if two values are equal
  • assertObjectsEqual: asserts if two objects are equal
  • countLetters: returns the count of each letter in a string
  • countOnly: returns the counts for a specific subset of a collection of items
  • eqArrays: compares two arrays
  • eqObjects: compares two objects
  • findKey: returns the first key of an object for which the callback function returns true
  • findKeyByValue: returns the key of an object when its value matches a given value
  • head: returns the first element of an array
  • index: list of all the functions in an object
  • letterPositions: returns all the indices in the string where each letter is found
  • map: calls a provided functions on every element in the array and returns the result in a new array
  • middle: returns the middle element of an array
  • tail: returns every element in the array except the first element
  • takeUntil: returns an array with all the values until the callback returns true
  • without: returns an array without the given values