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

js-simple-utils

v1.0.6

Published

A collection of Javascript utilities that we use internally

Downloads

1

Readme

js-simple-utils

Build Status

A collection of Javascript utilities that we use internally.

Installation

yarn add js-simple-utils

Usage

import { convertObjectToArray } from 'js-simple-utils';

const array = convertObjectToArray({ foo: { name: 'bar' } });

Utilities

  • [x] addZeroPadding - Takes a number/string and adds 0 padding if necessary and returns a string
  • [x] cleanObject - Remove all falsy fields from an object
  • [x] cloneObject - Returns a copy of an object
  • [x] convertObjectToArray - Converts an object into an array, keeping the key (as id)
  • [x] countKeys - Counts an objects keys (nesting included)
  • [x] createUID - Creates a unique id
  • [x] firstCharToUpperCase - Converts the first character of a string to uppercase
  • [x] getDistanceBetweenCoordinates - Gets the distance between two sets of coordinates
  • [x] getElapsedDays - Get the amount of days that have elapsed since a timestamp
  • [x] getElapsedHours - Get the amount of hours (rounded) that have elapsed since a timestamp
  • [x] getHoursMinutes - Get the hours and minutes in the format HH:MM from a timestamp
  • [x] getPercentage - Takes two numbers and returns the percentage representation of them rounded
  • [x] getPrettyDate - Get date in a pretty format from a timestamp
  • [x] getRandomInt - Returns a random integer
  • [x] isEmptyObject - Checks if an object is empty and returns true or false
  • [x] reorderArrayItems - Reorders an item in an array
  • [x] sortArrayOfObjectsByKey - Sorts an array of objects by key with optional reverse order functionality
  • [x] stringToTitleCase - Convert a string to Title Case
  • [x] validateCellNumber - Validate South African cell phone numbers
  • [x] validateEmail - Validate email addresses
  • [x] validateIDNumber - Validate South African ID numbers

Development

  1. Clone the project:
git clone https://github.com/AuxStudio/js-simple-utils
  1. Do some work.
  2. Create a PR.

Releases

  1. Run tests to make sure that they're passing.
yarn test
  1. Login to npm
npm login
  1. Run the publish script.
npm publish

TODOS

  • Fix export (use one object for both)