1.0.0 • Published 1 year ago

@s.poon/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 @spoon1113/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual: Asserts two arrys to see if they are equal
  • assertEqual: Asserts two values to see if they are equal
  • assertObjectsEqual: Asserts two objects to see if they are equal
  • countLetters: Gives a count of every letter when given a string
  • countOnly: Returns specific count for subset of an array
  • eqArrays: Compares two arrays
  • eqObjects: Compares two objects
  • findKey: Returns the first key of object when callback is truthy
  • findKeyByValue: Returns the first key of object that contains the given value
  • head: Returns first element of an array
  • letterPositions: Returns index of each letter
  • map: creates a new array based on the callback on the original array
  • middle: Returns middle element of an array(returns middle 2 elements if array is even)
  • tail: Returns all elements excluding first element of an array
  • takeUntil: Returns an array with elements taken from beginning of an array until callback is truthy
  • without: Removes elements from an array