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

lowbar

v0.8.1

Published

Lowbar - lodash with a few extras

Downloads

17

Readme

MIT github lowbar issues github twitter lowbar

lowbar

All of the lodash function with a couple extras

Installation

  • Install lowbar first
yarn add lowbar

Setup

with babel

in your .babelrc

Using babel-plugin-module-resolver

{
  ...
  "plugins": [
    ["module-resolver",
        "alias": {
          "lodash": "lowbar"
        }
    ]
  ]
  ...
}
        

Extra Functions

Strings

_.titleCase()

makes each word of string uppercase

First argument - string.

Example

import _ from 'lowbar'; // or from 'lodash' with alias
// const _ = require("lowbar").default; // for es5
let text = "hello world"

_.titleCase(text);
// => Hello World

_.replaceAll()

First argument - input string.

Second argument - search sub-string

Third argument - replace sub-string

Example

import _ from 'lowbar'; // or from 'lodash' with alias

let url = "https://github.com/garrettmac/lowbar"

_.replaceAll(url, 'b');
// => https://githu.com/garrettmac/lowar

_.replaceAll(url, 'b', '🤙');
// => https://githu🅱️.com/garrettmac/low🅱️ar

_.domain()

gets domain name of url

First argument - url.

Example

import _ from 'lowbar'; // or from 'lodash' with alias

let url = "https://github.com/garrettmac/lowbar"

_.domain(url);
// => Github.com

_.hostname()

gets hostname name of url

First argument - url.

Example

import _ from 'lowbar'; // or from 'lodash' with alias

let url = "https://github.com/garrettmac/lowbar"

_.hostname(url);
// => Github

_.url()

gets url info

First argument - url.

Example

import _ from 'lowbar'; // or from 'lodash' with alias

let url = "https://github.com/garrettmac/lowbar"

_.url(url);
// => {"protocol":"https:","slashes":true,"auth":null,"host":"github.com","port":null,"hostname":"github.com","hash":null,"search":null,"query":null,"pathname":"/garrettmac/lowbar","path":"/garrettmac/lowbar","href":"https://github.com/garrettmac/lowbar"}

Objects

_.removeFalsy()

removes falsy false from object

Example

import _ from 'lowbar'; // or from 'lodash' with alias

let obj = { 
            und:undefined,
            num:123123, 
            nul: null, 
            fal: false, 
            empy: '',
            string:"myString",
            zero: 0
        };

_.removeFalsy(obj);
// => {num: 123123, string: "myString"}

_.getFirstOf()

same as _.get() except you can pass multipul arguments to in an array and it will return the first.

First argument - object.

Second argument - array of _.get() paths to properties.

Third argument - default if no matches found.

Example

import _ from 'lowbar'; // or from 'lodash' with alias

let obj = { 
            parent:{
              name: "bob"
            },
            children:[
              {name: "sally", age: 30}
            ]
        };

_.getFirstOf(obj, ['parent.name','children[0].name']);
// => bob // got first match, this was parent name
_.getFirstOf(obj, ['children[0].name','parent.name']);
// => sally // got first match, this was children name
_.getFirstOf(obj, ['parent.age','children[0].age']);
// => 30 // no parent age so got children age
_.getFirstOf(obj, ['parent.lastName','children[0].lastName'], "saget");
// => saget // no parent lastName, no children lastName so got default
_.getFirstOf(obj, ['parent.middleName','children[0].middleName']);
// => undefinded // no middleName from parent or children

Util

_.make()

builds a lodash function for you.

First argument - is your value.

2nd argument to infinity - functions you want apply to first argument.

Example

import _ from 'lowbar'; // or from 'lodash' with alias

let url = "https://github.com/garrettmac/lowbar"

_.make(url, _.domain, _.titleCase); // same as _.titleCase(_.domain(url))


output >> Github.com

Contributing

Please share what you got and make a pr!