1.0.2 • Published 2 years ago

@greenlemonkp/lotide v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Lotide - Joon Lee

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual(firstArray, secondArray): check if two arrays are equal
  • assertEqual(actual, expected): check if two primitive elements are equal or not
  • assertObjectsEqual(actual, expected): Returns true if both objects have identical keys with identical values. Otherwise you get back false!
  • countLetters(str): Takes in a string and returns a count of each letter in the sentence(string)
  • countOnly(allItems, itemsToCount): Takes in a collection of items and return counts for a second parameter of those items
  • eqArrays(firstArray, secondArray): Returns true if two arrays compared are equal
  • eqObjects(object1, object2): Returns true if two objects compared are equal
  • findKey(names, callback): Takes object being calledback and returns first key
  • findKeyByValue(object, value): Returns a key on an object where its value matches a given value.
  • flatten(arr): It flattens arrays inside array it into a single-level array.
  • head(arr): Returns first element in an array
  • letterPositions(sentence): Takes an argument and returns object showing position of each letter
  • map(array, callback): Returns a new array based on the results of the callback function
  • middle(array): Takes in an array and return the middle element(s) of the given array