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

@raemekhatib/lotide

v1.0.0

Published

a small composition of functions that can be used as methods to find various array and object information

Downloads

1

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • head([array]): passes in an array, and returns the first item that is in the index of the array [0];
  • tail([array]): take in an array, and returns everything after index [0];
  • middle([array]): takes in an array, and return the middle value if there is an odd number of values then it returns a single value, if there is an even number of values it returns the 2 middle values. However returns empty string if there is 0-2 values;
  • countLetters("string"): takes in a string or sentence, and returns the letters encountered, as well as number of occurances of each letter;
  • countOnly(allItems, itemsToCount): take in two arguements, the first arguement is an array of strings that we need to look through, and the second arguement is an object specifying what to count ( ie , a list of names, and checking if that "name" occurs more than once, and returns the name and how many occurances )
  • eqArrays([Array1],[Array2]): takes in 2 arrays, and checks to see if Array1 = Array2, and returns true or false
  • eqObjects({Object1}, {Object2}): takes in 2 objects and scans through the keys to confirm if they are equal, returns a true or false value
  • findKey({object}, callback): scans through object keys and return the first true value, returns key for given value through function (action) parameter.
  • findKeyByValue({object}, value): scans through an object key-value pair search for the matching "value" and returns the key
  • letterPositions("string"): takes in a string or sentence, and outputs the index of the letter occurances (the L in "Hello" => [2, 3])
  • map([array], callback): takes in an array and callback function, and returns a new modeified array based on action taken (ie [1,2] *2 will return [2,4])
  • takeUntil([array], callback): takes in an array and callback function, and pushes items into the array until the "break" value ( ie will push words from a sentence [1, 2, 5, 7, 2, -1, 2, 4, 5] until x < 0 so it stops at -1, returns [1, 2, 5, 7, 2])
  • without(items, itemsToRemove): takes in 2 values, the original string, and the stuff you want to remove ( ie input = [1,2,3] and remove: [1] so the output will be [2,3])