1.0.0 • Published 1 year ago

@bavyn/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year 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 @bavyn/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual: assert if two arrays are equal
  • assertEqual: assert if two values are equal
  • assertObjectsEqual: assert if two objects are equal
  • countLetters: returns a count of each letter in a string
  • countOnly: takes in a collection of items and returns counts for a specific subset of those items
  • eqArrays: compares two arrays
  • eqObjects: compares two objects
  • findKey: scans an object and returns the first key for which the callback function returns a truthy value
  • findKeyByValue: searches for a key on an object where its value matches a given value
  • head: retrieves the first element of an array
  • letterPositions: returns all indices in a string where each character is found
  • map: creates a new array with the results of calling a provided function on every element in the calling array
  • middle: returns the middle element of an array
  • tail: retrieves all elements aside from the head of an array
  • takeUntil: returns a slice of an array with elements taken from the beginning
  • without: removes elements from an array
1.0.0

1 year ago