1.0.0 • Published 2 years ago

@juno-60/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 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 @juno-60/lotide

Require it:

const _ = require('@juno-60/lotide');

Call it:

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

Documentation

The following functions are currently implemented:

  • _.assertArraysEqual: Compares two input arrays and returns a message w/ results
  • _.assertEqual: Compare two primitives and return a message w/ results
  • _.assertObjectsEqual: Compares two objects and returns message w/ results. Does NOT work with nested objects.
  • _.countLetters: Returns length of a string as a Number.
  • _.countOnly: Returns counts for specified subset of items/
  • _.eqArrays: Checks if two arrays are equal and returns a True/False value.
  • _.eqObjects: Checks if two objects are equal and returns a True/False value. Does not work with nested objects.
  • _.findKey: Scans object and returns first key for which the callback returns a truthy value.
  • _.findKeyByValue: Scans given object and returns first key which contains input value.
  • _.head: Returns item at index 0 in a given array.
  • _.letterpositions: Returns all indices of a string in which a given character is found.
  • _.map: Takes in an array and callback function, returns new array based on results of callback function.
  • _.middle: Takes in an array and returns middle-most elements of given array. One element for odd-lengthed arrays, and two for even-lengthed ones.
  • _.tail: Returns every element of an array except that at the first index.
  • _.takeUntil: Returns a slice of array with elements taken until specified element.
  • _.without: Returns a subset of given array, removes unwanted elements.