1.0.0 • Published 3 years ago

@senay.hailu/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 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 @senay.hailu/lotide

Require it:

const _ = require('@senay.hailu/lotide');

Call it:

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

Documentation

The following functions are currently implemented:

  • head(...): returns the first item of an array
  • middle(...): returns the middle item of an array
  • tail(...): return an array without the first item
  • assertArraysEqual(...): equality assertion tester for two arrays
  • assertEqual(...): equality assertion for two values
  • assertObjectsEqual(...): equality assertion for two objects
  • countLetters(...): returns an object with the counts of each letter in a string
  • countOnly(...): returns an object with items to count given an array of values and an array to count from
  • eqArrays(...): returns true or false to an equality test of two arrays
  • eqObjects(...): returns true or false to an equaltiy test of two objects
  • findKeyByValue(...): a function to find a key of an object by its value
  • findKeys(...): Given an object and a callback function, find the key paired to the return of the callback function
  • flatten(...): Given an array with nested arrays, it flattens the values into one array.
  • letterPositions(...): Returns an object with the frist occurence of each letter in a string
  • map(...): Given an array of values and a callback function, maps the output of callback function to elements of the array
  • takeUntil(...): Given an array and a callback function, returns an array until a certain value returned by the callback function is reached.
  • without(...): Given 2 arrays, it will remove the elements of the second array from the first array and return the updated array.