1.0.0 • Published 2 years ago

@jasondi/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 @jasondi/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • function assertArraysEqual(...): assert 2 arrays if equal or not
  • function assertEqual(...): assert 2 parameters (num, string, ... etc.) if equal or not
  • function assertObjectsEqual(...): assert 2 objects if equal or not
  • function countLetters(...): count letters in a string
  • function countOnly(...): take 2 parameters, count only as the second parameter requires
  • function eqArrays(...): compare 2 arrays if equal or not
  • function eqObjects(...): compare 2 objects if equal or not
  • function findKey(...): take 1 object, 1 callback function, find the key in the object based on the output value from the callback function
  • function findKeyByValue(...): take 1 object, 1 value, find the key in the object that has the same value as the second parameter
  • function head(...): find the 1st element in an array
  • function letterPositions(...): find the letter index in a string
  • function map(...): take 1 array, 1 callback function, return a new array based on calling the callback function
  • function middle(...): find all the middle elements in an array
  • function tail(...): find the last element in an array
  • function takeUntil(...): take 1 array, 1 callback function, find all matched elements in the array based on calling the callback function