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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@onny/utils

v0.2.4

Published

Utils for Onny.io

Downloads

26

Readme

onny-utils

NPM

Build Status Coverage Status

A small library of utils for easy maintenance and upkeep for use in Onny.

Mostly based on/wrappers for lodash

Installation

npm i --save onny-utils

// load everything
import onnyUtils from 'onny-utils';

// selective loading
import { without } from 'onny-utils';

Why onny-utils?

We needed a utils library that we have control over that we know will not change from underneath us.

Array

without(src, ...values)

Creates an array excluding all given values using SameValueZero for equality comparisons.

Note: Unlike onny-utils.pull, this method returns a new array.

  • @param {Array} src - source array
  • @param {...*} [values] - values to exclude
  • @return {Array} - New Array

findIndex(array, iteratee, fromIndex = 0)

This method is like onny-utils.find except that it returns the index of the first element predicate returns truthy for instead of the element itself.

  • @param {Array} src - Source array
  • @param {function} iteratee
  • @param {number} [fromIndex=0]
  • @return {number} - index of the item, otherwise -1

pull(src, ...values)

Removes all given values from array using SameValueZero for equality comparisons.

Note: Unlike onny-utils.without, this method mutates array. Use onny-utils.remove to remove elements from an array by predicate.

  • @param {Array} src - Source array
  • @param {...*} [values] - Values to remove
  • @return {Array} mutated array

Example:

var array = ['a', 'b', 'c', 'a', 'b', 'c'];
pull(array, 'a', 'c');
console.log(array); // => ['b', 'b']

pullAt(src, ...indexes)

Removes elements from array corresponding to indexes and returns an array of removed elements.

NOTE - this mutates the array

  • @param {array} src - The array to modify.
  • @param {...number|...number[]} indexes - The indexes of elements to remove.
  • @return {array} - Returns the new array of removed elements.

Object

omit(obj, ...path)

Return object minus the omitted parts

The opposite of onny-utils.pick; this method creates an object composed of the own and inherited enumerable property paths of object that are not omitted.

Note: This method is considerably slower than onny-utils.pick.

  • @param {object} obj - Source object
  • @param {...string|string[]} path - Paths to omit
  • @returns {Object} - The New object

assign(destObj, ...sources)

Assigns own enumerable string keyed properties of source objects to the destination object. Source objects are applied from left to right. Subsequent sources overwrite property assignments of previous sources.

Note: This method mutates object and is loosely based on Object.assign.

  • @param {object} destObj - destination object
  • @param {...Object} sources - Source objects
  • @return {object} returns mutated object

merge(destObj, ...sources)

This method is like onny-utils.assign except that it recursively merges own and inherited enumerable string keyed properties of source objects into the destination object. Source properties that resolve to undefined are skipped if a destination value exists. Array and plain object properties are merged recursively. Other objects and value types are overridden by assignment. Source objects are applied from left to right. Subsequent sources overwrite property assignments of previous sources.

Note: This method mutates object.

  • @param {object} destObj - destination object
  • @param {...Object} sources - Source objects
  • @return {object} returns mutated object

defaults(destObj, ...sources)

Assigns own and inherited enumerable string keyed properties of source objects to the destination object for all destination properties that resolve to undefined. Source objects are applied from left to right. Once a property is set, additional values of the same property are ignored.

Note: This method mutates object.

  • @param {object} destObj - destination object
  • @param {...Object} sources - Source objects
  • @return {object} returns mutated object

defaultsDeep(destObj, ...sources)

This method is like onny-utils.defaults except that it recursively assigns default properties.

Note: This method mutates object.

  • @param {object} destObj - destination object
  • @param {...Object} sources - Source objects
  • @return {object} returns mutated object

objToArray(obj, funcMapToArray)

Convert an Object into an array

  • @param {object} obj - source object
  • @param {function} funcMapToArray - returns each object element formatted to push onto array
  • @return {Array} - The new Array
License

GPL-3.0 License

Copyright (C) 2015-2017 Onny LLC - All Rights Reserved