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 🙏

© 2026 – Pkg Stats / Ryan Hefner

oh-my-lib

v0.5.0

Published

A Javascript functions library

Readme

Oh My Lib

Build Status Maintainability Test Coverage npm npm


This is a library of Javascript functions created with the purpose of practicing my Javascript skills and putting into practice some less used techniques. Therefore, not all functions are done in a way that has the best possible performance because they may have been done by focusing on a specific approach for study purposes.


Functions categories:


Math functions

max

Called to biggest between two passed values.

Input: (number/string, number/string)
Output: number/string

const result = max(5, 2);

//result == 5

min

Called to smaller between two passed values.

Input: (number/string, number/string)
Output: number/string

const result = min(5, 2);

//result == 2

sumAllInRange

Returns the sum of all integers between the first and the second parameters. If passed a third parameter, the result the result will be the sum of numbers starting from the first parameter but steping the passed value until reach the second parameter.

Input: (integer, integer, integer=1)
Output: number

const result = sumAllInRange(3, 99, 4);

//result == 1275

Array functions

first

Return the first element of the array

Input: (array)
Output: number/string

const result = first([1,2,3]);

//result == 1

tail

Return the the array without the first element

Input: (array)
Output: array

const result = tail([1,2,3]);

//result == [2,3]

last

Return the last element of the array

Input: (array)
Output: number/string

const result = last([1,2,3]);

//result == 3

init

Return the the array without the last element

Input: (array)
Output: array

const result = init([1,2,3]);

//result == [1,2]

each

Called to execute some passed function over all elements of a passed array without return any result.

Input: (array, function)
Output: undefined

each([1,2,3], (value) => { console.log(value) });

filter

Returns as result a list with the elements that passed the test defined by the passed function.

Input: (array, function)
Output: array

filter([1,2,3], (value) => { return value > 1 });

//result == [2,3]

maxOfList

Called to get the biggest value between the values of a passed array.

Input: (array)
Output: number/string

const result = lib.maxOfList([5,10,2,9]);

//result == 10

maxOccurrence

Called to get the most frequent element of the array. If more than one element have the same frenquency, the first element to reach that frequency will be returned.

Input: (array)
Output: number/string

const result = lib.maxOccurrence(['a','a','c','b','c','c']);

//result == 'c'

trueValues

Returns a copy of the passed array without the falsy values. In Javascript, the falsy values are false, null, 0, "", undefined and NaN.

Input: (array)
Output: array

const result = lib.trueValues(['c', 0, null, 1]);

//result == ['c', 1]

except

Returns a copy of the passed array without the passed values.

Input: (array, number/string...)
Output: array

const result = lib.except(['a','a','c','b','c','c'], 'b', 'c');

//result == ['a', 'a']

Collection functions

extractProperty

Called to get the value of a property with the given name of all elements of a passed larrayist.

Input: (array, string)
Output: array

const list = [
  { a: 1, b: 2, c: 3 },
  { a: 4, b: 5, c: 6 },
  { a: 7, b: 8, c: 9 },
  { a: 10, b: 11, c: 12 },
  { a: 13, b: 14, c: 15 }
];
const result = lib.extractProperty(list, 'b');

//result == [2,5,8,11,14]

maxOfProperty

Called to get the biggest value of a passed property from a passed array of objects.

Input: (array, string)
Output: number/string

const result = maxOfProperty([
  { age: 20 },
  { age: 25 },
  { age: 10 },
  { age: 40 }
], 'age');

//result == 40