1.0.0 • Published 3 years ago

@arjunkumar97/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 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 @arjunkumar97/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual(...): checks if two arrays are equal

  • assertEqual(...): checks if two primitive data types are equal

  • assertObjectEqual(...): checks if two objects are equal

  • countLetters(...): counts the number of times each alphabet is present within in a string

  • countOnly(...): takes in a set of items and returns the count of a specific item within the set

  • eqArrays(...): compares two arrays and returns true or false based on a perfect match

  • eqObjects(...): compares two objects and returns true or false based on a perfect match

  • findKey(...): scans an object and return the first key for which the callback returns a truthy value

  • findKeyByValue(...): scan the object and return the first key which contains the given value

  • flatten(...): unifies arrays within an array into a single array

  • head(...): returns the first element of the given array

  • letterPositions(...): returns the indexes of where each character in the string are present

  • map(...): takes in an array and a callback function and returns a new array based on the results of the callback

  • middle(...): returns the middle element of an array

  • tail(...): returns an array without the first element

  • takeUntil(...): returns a slice of the array with elements taken from the beginning

  • without(...): * removes specific elements from an array