1.0.0 • Published 4 years ago

@bdewitt-cohen/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 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 @BDeWitt-Cohen/lotide

Require it:

const _ = require('@BDeWitt-Cohen/lotide');

Call it:

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

Documentation

The following functions are currently implemented:

  • head(...): takes single array as argument and returns index0
  • tail(...): takes single array as argument and returns everything after index0 as a new array
  • middle(...): takes single array as argument and returns middle index for odd length array, and middle two indexes for even length array
  • assertArraysEqual(arr1, arr2): takes two arguments of arrays and then says whether or not they are equal
  • assertEqual(...): takes two primitive data type arguments and then says whether or not they are equal
  • assertObjectsEqual(...): takes two arguments of objects and then says whether or not they are equal
  • countLetters(...): takes a string argument, counts the instances of each letter and returns an object with the count
  • countOnly(...): takes an argument of an array and counts the number of returns the count of items
  • eqArrays,(...): takes two arguments of arrays and then says whether or not they are equal
  • eqObjects(...): takes two arguments of objects and then says whether or not they are equal
  • findKey(...): takes two arguments, an object and a helper function and returns a key from the object based on the value input into the helper function
  • findKeyByValue(...): takes two arguments, an object and a value and returns the key with that value
  • flatten(...): takes an array as an argument, if there's a nested array it will return as a single level array
  • letterPosition(...): takes a string as an argument and returns an object with each letter from the string as keys and their index position (as an array) as the values
  • map(...): takes two arguments, as array and a callback function, the callback returns index0 of the words
  • takeUntil(...): takes two arguments, an array and callback function, callback is designed to stop at odd number, returns array until the odd number
  • without(...): takes two array arguments and return the first array with any matches from the second array removed
1.0.0

4 years ago