1.0.1 • Published 2 years ago

@danispin/lotide v1.0.1

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 Dani Spinosa as part of my learnings at Lighthouse Labs.

Usage

Install it:

npm install @danispin/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • head(...): returns the first item in an array
  • tail(...): returns all but the first item in an array
  • middle(...): returns the middle of an array
  • eqArrays(...): determines if two arrays are equal
  • assertArraysEqual(...): asserts whether or not arrays are equal
  • assertEqual(...): asserts if two strings or numbers or booleans are equal
  • eqObjects(...): determines if two objects are equal
  • countLetters(...): creates an object that contains the number of times each letter appears in a string
  • flatten(...): takes an array of nested arrays and returns a single-level array
  • countOnly(...): creates an object from an array that counts how many times each item appears in the array
  • letterPositions(...): returns the indexes of each appearance of a given letter in a string
  • findKeyByValue(...): returns a key from an object when given the key's value
  • findKey(...): returns a key from an object when given various criteria
  • map(...): alters an array according to a supplied function
  • takeUntil(...): returns part of an array until it meets a supplied function
  • without(...): returns a supplied array, with a supplied item removed