1.0.1 • Published 2 years ago

@philyoo92/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 me as part of my learnings at Lighthouse Labs.

Usage

Install it:

npm install @philyoo92/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual: array assertion console logs result of whether two arrays are equal or not
  • assertEqual: assertion of two primitive values and logs result of if match or not
  • assertObjectsEqual: assertion of two objects and logs result of if match or not
  • countLetters: Takes in a sentence then returns a count of each letters as an object
  • countOnly: Takes in a sentence, returns a count of specified word as an object
  • eqArrays: function that will take two arrays, and check if they match
  • eqObjects: function that will take two objects, compare and return true if matching, false if not
  • findKey: Takes in object and callback fn, returns the key from the callback
  • findKeyByValue: takes in object and specified value, use value to check object to find the key
  • flatten: will recursively loop through the array until one level of array is reached
  • head: takes in an array and returns the first (0th index) element
  • letterPositions: takes in a string, returns an object with all the positions of each letters
  • map: takes in an array, uses callback to modify the array elemnts and return a new array
  • middle: takes in an array and returns the middle value/s depending on the length of the array
  • tail: takes in an array and returns a copy of the original array without the head (0th index item)
  • takeUntil: takes an array, returns an array from the start to until the callback's first requirements are met
  • without: take in an array + target, removes the target from the array and returns the remaining elements of the array.