1.0.0 • Published 5 years ago

@jerkfree/lotide v1.0.0

Weekly downloads
1
License
ISC
Repository
github
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 @jerkfree/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • head: finds the first element in array
  • tail: takes out first element in array, returns rest
  • middle: finds the middle elements in the array
  • assertArraysEqual: checks if two arrays are equal
  • assertEqual: checks if two items are equal
  • eqArrays: checks if two arrays are equal, and them compare if true or false
  • assertObjectsEqual: checks if two objects are equal, if so return true or false
  • countLetters: count how many letters in array and return in object format
  • countOnly: count the items you want to count, return in object
  • eqObjects: checks if two objects are equal
  • findKey: finds the value of the key, and then return the key name once condition is met (i.e. find first value with 2 stars)
  • findKeyByValue: find the key by the values in key
  • flatten: flattens nested arrays, and pushes them out so it'll show as all elements in individual array
  • letterPositions: count the values of letters in a string, and return as key value object format
  • map: goes through each item of array, and does something to it based on the callback function/argument implemented
  • reverse: reverse the item
  • takeUntil: loops through array, and stops until it hits the condition that is searched for
  • without: goes through two arrays, and displays the items that are different from both