npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@joepolo1/lotide

v1.0.1

Published

This contains a list of functions used for assertation purposes and other adjustments

Downloads

3

Readme

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertEqual("Orange", "Orange"): passes or fails assertation when run based on whether what is actually provided is exactly what is expected.
  • assertArraysEqual(eqArrays([1, 2, 3], [1, 2, 3])): passes or fails assertation when run based on whether two provided arrays are exactly the same.
  • assertObjectsEqual(eqObjects(ab, abc), true): passes or fails assertation when run based on whether the contents of two provided arrays are exactly the same.
  • countLetters("Count these letters"): counts the number of each individual letter occurring in a provided string
  • countOnly(firstNames, { "Jason": true, "Karima": true, "Fang": true, "Agouhanna": false }): returns true or false if the names or values provided are already in the object (in this case, firstNames has a list of names)
  • eqArrays([1, 2, 3], [1, 2, 3]): returns true or false if two arrays match
  • eqObjects(obj1, obj2): returns true or false if two obejcts match
  • findKey({ "Blue Hill": { stars: 1 }, "Akaleri": { stars: 3 }, "noma": { stars: 2 }, "elBulli": { stars: 3 }, "Ora": { stars: 2 }, "Akelarre": { stars: 3 } }, x => x.stars === 2): returns the first key with a matching argument, in this case, Noma would be returned
  • findKeyByValue(bestTVShowsByGenre, "The Wire"): finds the key of an object based on the value argument provided
  • head([1, 2, 3]): returns the first element in an array (in this case, 1)
  • letterPositions("Your sentence parameter goes here"): shows you the string index of each letter in a provided string argument. "Hello" returns the object { H: [ 0 ], e: [ 1 ], l: [ 2, 3 ], o: [ 4 ] }
  • map(words, word => word[0]): returns an array of provided elements from an argued array, including only the letters provided in the second part of the argument parameters. for this example, words = ["ground", "control", "to", "major", "tom", "can", "you", "hear", "me"]; and this returns ['g', 'c', 't','m', 't','c','y', 'h', 'm'].
  • middle([17, 22, 43, 54, 75, 1]): returns the middle element of an odd array or the middle two elements of an even numbered array
  • tail([1, 2, 3]): provides every element in an array after the first (returns [2, 3])
  • takeUntil(arr, x => x === "string!"): provides every element in an array as a new array, up until a stopping condition is met (in this example the stopping condition is the first time the word "string!" shows up in the provided array parameter argument).
  • without(Source, itemsToRemove): removes an element from an array and returns the other elements