1.0.0 • Published 3 years ago

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • head(arr): This function accepts array as argument and returns first element of the array.
  • tail(arr): This function accepts array as argument and returns last elements of the array expect first element.
  • middle(arr): This function accepts array as argument and returns the middle element. countletters(string):This function accepts string as argument and returns the count of the string. countOnly(allItems, itemsToCount): This function accepts two arguments and returns a count of each of the letters in that sentence. eqArrays(arr1, arr2):This function takes in two arrays and returns true or false, based on a perfect match. eqObjects(obj1, obj2): This function will take in two objects and returns true or false, based on a perfect match. findkey(obj1, callback): This function 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. If no key is found, then it should return undefined. findkeyByValue(obj, value): This function takes in an object and a value. It should scan the object and return the first key which contains the given value. If no key with that given value is found, then it should return undefined.

takeUntil(arr, callback): This function will return a "slice of the array with elements taken from the beginning."