1.0.0 • Published 4 years ago

@jalayna/lotide v1.0.0

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

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 @jalayna

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • without: returns new array of only wanted items
  • takeUntil: returns part of the array until callback returns a truthy value
  • tail: recreates tail of given array onto new array
  • middle: finds and returns middle of array
  • map: create our own version of map
  • letterPositions: finds index of letter
  • head: return first element of an array
  • findKeyByValue: returns key by it's value
  • findKey: return the first key for which the callback returns a truthy value
  • eqObjects: takes in two objects compares if identical. Only handle primitive types
  • eqArrays: compares if two arrays are identical
  • countOnly: counts items in array that repeat
  • countLetters: counts how many times each letter appears in the string given
  • assertObjectsEqual: takes in actual and expected as arguments and logs whether assertion passed or faild
  • assertEqual: takes in actual and expected and logs if identical
  • assertArraysEqual: takes two arrays and ensures they are equal and logs it
  • tailTest: tests if tail function works
  • middleTest: tests if middle function works
  • headTest: tests if head function works
  • eqArraysTest: tests if eqArray function works
  • asserEqualTest: tests is assertEqual function works
  • assertArraysEqualTest: tests if assertArraysEqual function works