1.0.0 • Published 4 years ago

@mvojjala/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 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 @mvojjala/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • index.js: contains imports of all athe functions
  • head(arr): retrieves the first element in an array
  • tail(arr):retrieves other elements except head
  • middle(arr):retrieves the middle elemnt of an array
  • assertEqual(val1,val2): compare the two values
  • eqArrays(arr1,arr2) :compare two arrays
  • assertArraysEqual(actual,expected): take two arrays and gives the prints a message to console
  • eqObjects(obj1,obj2): compare two objects
  • assertObjetctsEqual(actual,expected): take two objects to compare and print a messgae to console
  • countOnly(array,object): returns an object containing counts of everything that input object listed
  • countLetters(string): returns a count of each of letters in a string
  • findKeyByValue(object):scan the object and returns first key which contains the given value
  • flatten(array): flattens the nested arrays