1.0.1 • Published 3 years ago

@archaemedes/lotide v1.0.1

Weekly downloads
-
License
ISC
Repository
-
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 @archaemedes/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual(): Checks if two arrays elements are the same, and makes an assertion
  • assertEqual(): Checks if two primitives values are the same
  • assertObjectsEqual(): Checks if two objects elements are the same, and makes an assertion
  • countLetters(): Takes in a sentence (as a string) and then returns a count of each of the letters in that sentence
  • countOnly(): Is given an array and an object, It will return an object containing counts of everything that the input object listed
  • eqArrays(): hecks if two arrays elements are the same
  • eqObjects(): Checks if two objects elements are the same
  • findKey(): Takes in an object and a callback, It should scan the object and return the first key for which the callback returns a truthy value
  • findKeyByValue(): Takes in an object and a value, It should scan the object and return the first key which contains the given value
  • flatten(): Recursively logs elements in a nested array structure
  • head(): Return the first element in an array
  • letterPositions(): Returns all the indices (zero-based positions) in the string where each character is found
  • map(): Iterates over an array performing a callback function on each iteration
  • middle(): Return the middle element(s) of an array
  • tail(): Return all elements of an array except for the first element
  • takeUntil(): Keeps collecting items from a provided array until the callback provided returns a truthy value
  • without(): Returns a subset of a given array, removing unwanted elements