1.0.0 • Published 12 months ago

@kevinrings/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
12 months 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 @kevinrings/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • function1(...): description
  • function2(...): description
  • function3(...): description

head: receives an array and returns the first element of an array tail: receives an array and returns the same array without the initial element middle: receives an array and return the middle element (one element if the length of the array is an odd number, and array of the middle two element if the length of the array is even) assertArraysEqual: checks if two arrays are equal assertEqual: checks if two primitive variables are equal assertObjectsEqual: checks if two objects are equal countLetters: counts the occurrence of each letter inside a sentence countOnly: counts specific items in an array based on a key values of an object eqArrays: compares two arrays eqObjects: compares two objects findKey: finds a specific key of an object findKeyByValue: finds the first key that represents the value given by the user flatten: flattens a nested array letterPositions: returns an array of index occurrence of a given letter in a sentence map: transforms the array elements based on the function provided by the user takeUntil: receives an array and a string. iterates through the array and returns an array of strings up to the string provided by the user. without: receives two arrays of numbers and removes the elements from the first array that matches the second array

1.0.0

12 months ago