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

pure-formatters

v2.0.2

Published

A collection of pure JS functions that return formatted data. Useful in any view engine.

Readme

Pure Formatters

Build Status

A collection of pure JS functions that return formatted data. Useful in any view engine.

Installation

Node.js

> npm install --save pure-formatters

Browser

<script src="node_modules/pure-formatters/dist/pure-formatters.js"></script>

<!-- Or CDN -->
<script src="https://unpkg.com/pure-formatters/dist/pure-formatters.js"></script>

Usage

Browser

// After adding script tag, the global variable pf is available
console.log(pf.upperCase('hello world'));

Node.js

const pf = require('pure-formatters');

console.log(pf.upperCase('hello world'));

React

import { Component } from 'react';
import { upperCase } from 'pure-formatters';

class App extends Component {
  render() {
    return (
      <div>
        {upperCase('hello world')}
      </div>
    );
  }
}

export default App;

Vue

<template>
  <div>
    {{ msg | upperCase }}
  </div>
</template>

<script>
import { upperCase } from 'pure-formatters';

export default {
  name: 'component-name',
  data() {
    return { msg: 'hello world' },
  },
  filters: {
    upperCase,
  },
};
</script>

Formatters

| Symbol | Description | Input | Output | |--------------|--------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------|--------------------------------------------------------| | camelCase | Converts string to camel case. | 'Foo Bar' | 'fooBar' | | | | '--foo-bar--' | 'fooBar' | | | | '__FOO_BAR__' | 'fooBar' | | capitalize | Converts the first character of string to upper case and the remaining to lower case | 'FRED' | 'Fred' | | deburr | Deburrs string by converting Latin-1 Supplement and Latin Extended-A letters to basic Latin letters and removing combining diacritical marks. | 'déjà vu' | 'deja vu' | | displayNull | If input is null or '', return 'null' | '' | 'null' | | | | 'Hello World' | 'Hello World' | | | | '', 'empty' | 'empty' | | escape | Converts the characters "&", "<", ">", '"', and "'" in string to their corresponding HTML entities. | 'fred, barney, & pebbles' | 'fred, barney, & pebbles' | | escapeRegExp | Escapes the RegExp special characters "^", "$", "", ".", "*", "+", "?", "(", ")", "[", "]", "{", "}", and "|" in string. | '[lodash](htt​tps://lodash.com/)' | '\[lodash\]\(htt​tps://lodash\.com/\)' | | kebabCase | Converts string to kebab case. | 'Foo Bar' | 'foo-bar' | | | | 'fooBar' | 'foo-bar' | | | | '__FOO_BAR__' | 'foo-bar' | | lowerCase | Converts string, as space separated words, to lower case. | '--Foo-Bar--' | 'foo bar' | | | | 'fooBar' | 'foo bar' | | | | '__FOO_BAR__' | 'foo bar' | | lowerFirst | Converts the first character of string to lower case. | 'Fred' | 'fred' | | | | 'FRED' | 'fRED' | | pad | Pads string on the left and right sides if it's shorter than length. Padding characters are truncated if they can't be evenly divided by length. | 'abc', 8 | ' abc ' | | | | 'abc', 8, '-' | '-abc_-_' | | | | 'abc', 3 | 'abc' | | sentenceList | Combines array elements with commas and "and" | ['Bettye Norton'] | 'Bettye Norton' | | | | ['Bettye Norton', 'Melisa Reed'] | 'Bettye Norton and Melisa Reed' | | | | ['Bettye Norton', 'Melisa Reed', 'Kari Osborne'] | 'Bettye Norton, Melisa Reed, and Kari Osborne' | | | | [{ name: 'Bettye Norton' }], 'name' | 'Bettye Norton' | | upperCase | Converts string, as space separated words, to upper case. | '--foo-bar' | 'FOO BAR' | | | | 'fooBar' | 'FOO BAR' | | | | '__foo_bar__' | 'FOO BAR' | | usd | Adds a dollar sign and rounds to 2 decimal places | 1.5 | '$1.50' | | | | 150, 'c' | '$1.50' | | padEnd | Description, input, and output coming soon. | | | | padStart | Description, input, and output coming soon. | | | | repeat | Description, input, and output coming soon. | | | | replace | Description, input, and output coming soon. | | | | snakeCase | Description, input, and output coming soon. | | | | startCase | Description, input, and output coming soon. | | | | toLower | Description, input, and output coming soon. | | | | toUpper | Description, input, and output coming soon. | | | | trim | Description, input, and output coming soon. | | | | trimEnd | Description, input, and output coming soon. | | | | trimStart | Description, input, and output coming soon. | | | | truncate | Description, input, and output coming soon. | | | | unescape | Description, input, and output coming soon. | | | | upperFirst | Description, input, and output coming soon. | | |

Contributing

See CONTRIBUTING.md