1.0.0 • Published 2 years ago

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertEqual(expected, realty): prints true if value 1 === value 2
  • assertArraysEqual(expected[], realty[]): prints true if both arrays are the same
  • assertObjectEqual(expected{}, reality{}): prints true if both objects are the same
  • eqArray(array1, array2): returns true if both arrays are the same
  • eqObject(object1, object2): returns true if both objects are the same
  • head(array): returns the frist element of a array if any
  • middle(array): returns the middle element(s) length must be at least 3 and will return 2 elements if length is a even number like 2 or 4
  • tail(array): returns all elements but not the frist one
  • countLetters(array): returns the number of letters in a string
  • countOnly(array, value) returns the number of a value in a array
  • findKey(object, callback): returns the first key to match a value useing a callback function
  • findKey(object, value): returns the first key to match a value
  • letterPositions(array, letter): returns a array with the index value of al elements with letter
  • takeUntill(array, callBack): returns all array elements till callBack returns true
  • without(array, remove): returns array with all remove value elements removed