1.0.2 • Published 1 year ago

@zjohansson/lotide v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year 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 @zjohansson/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • head(arg) : returns the first value of an argument
  • tail(arg) : returns the last value of an argument
  • middle(array) : returns middle value of an argument if odd, returns 2 middle values if even
  • assertArraysEqual(actual, expected) : asserts that two arrays are equal
  • assertObjectsEqual(actual, expected) : asserts that two objects are equal
  • assertEqual(actual, expected) : asserts that two arguments are equal
  • countLetters(string) : scans string and returns count of each letter in string
  • eqArray(array1, array2) : returns boolean if two arrays are equal
  • eqObjects(object1, object2) : returns boolean if two objects are equal
  • findKey(object, callback) : scans object and returns the first key that returns a truthy value
  • findKeyByValue(allValues, valuetoFind) : find the key on an object where it's value matches a given value
  • letterPositions(string) : returns index of each character in a string
  • map(array, callback) : return new array based on results of callback function
  • takeUntil(array, callback) : returns a slice of an array with elements taken from the beginning
  • without(source, itemstoRemove) : filters argument and returns new array without value
  • countOnly(allItems, itemsToCount) : takes collection of items and return counts for a specific subset of those items
1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago