1.0.0 • Published 3 years ago

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • head(firstItem): return first item in an array
  • tail(words): return tailof an array
  • middle(array): return middle part of an array
  • eqArrays(array1, array2): return a boolean
  • assertEqual(actual, expected): checks if assertion is passed
  • assertArraysEqual(arr1, arr2): asserts if two arrays are equal
  • assertObjectsEqual(actual, expected): asserts if two objects are equal
  • countLetters(sentence): returns an object with count of letters in a string
  • countOnly(allItems, itemsToCount): asserts number of times a name repeats in an array
  • eqObjects(object1, object2): asserts key values in objects are equal and returns a boolean
  • findKey(array): returns a key from an onject
  • findKeyByValue(object, callback): return value of an object
  • letterPositions(sentence): returns an index of a given letter in a string
  • map(array, callback): asserts that only first element of a string in an array is returned
  • takeUntil(array, callback): print an array unil a given element
  • without(arr1, arr2): removes an element from an array