1.0.0 • Published 5 years ago

@krissyl/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 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 @krissyl/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • head(...): returns the first element of an array
  • tail(...): cuts the first element out of an array
  • middle(...): returns the middle element(s) of an array
  • assertArraysEqual(...): asserts whether or not two arrays are equal
  • assertEqual(...): asserts whether or not two values are equal
  • assertObjectsEqual(...): asserts whether or not two objects are equal
  • countLetters(...): counts the number of instances of a letter in a string
  • countOnly(...): counts only the number of instances of a single element in an array
  • eqArrays(...): compares two arrays to see if they are equal
  • eqObjects(...): compares two objects to see if they are equal
  • findKeyByValue(...): will return a key name when given a value
  • findKey(...): finds a given key in an object
  • flatten(...): takes a group of nested arrays and concatenates them into one single array
  • letterPositions(...): gives the position of occurances of letters in a string
  • map(...): description applies a function to each element in an array
  • takeUntil(...): prints the items in an array until a declared value occurs
  • without(...): prints all values in an array except the one declared