1.0.0 • Published 2 years ago

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • head: a function that returns the first item in an array
  • tail: a function that returns the tail end of an array
  • middle: a function that returns the middle most function of an array
  • countLetters: a function that counts the letters in a string and returns an object
  • countOnly: a function takes an array and an object returns an object with counts of everything that the input object listed
  • eqArrays: a function which takes in two arrays and returns true or false, based on a perfect match
  • eqObjects: a function wich will take in two objects and return true or falsem based on a perfect match
  • findKey: a function that takes an object and a callback and returns the first key for which the callback retuns a truthy value
  • findKeyByValue: a function that takes an object and value and returns the first key which contains the given value
  • letterPositions: a function which will return all the indices in the string where each character is found
  • map: a function that maps through an array and returns the first letter of the array
  • takeUntil: a function which will keep collecting items from a an array until the callback provided returns a truthy value
  • without: a function which will return a subset of a given array, removing unwanted elements