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

pedash

v0.1.20

Published

A lodash-like javascript helper -- for dummies

Downloads

8

Readme

Pedash 🌶

A simple Javascript utility library to ease in your daily development routines when it comes to array, object, as well as string manipulations. You can think of it as a mini-lodash.

Anyway, pedash means spicy in Bahasa Indonesia, literally. 🌶🥵🥵

CodeSandbox

Play around with it at CodeSandbox to get the basic idea of what Pedash can do for you.

How to use

Install

npm install pedash or yarn add pedash

Import it somewhere in your app

import { getLongest } from pedash;

// Then use it whatever you like
const foods = ["Pizza", "Lasagna", "Karedok", "Banana split", "Rendang", "Souffle"];
console.log(getLongest(foods));

// "Banana split"

Available methods

getCharCountsByKey(arr: any[])

import { getCharCountsByKey } from "pedash"

const chars = [34, 2, 90, 99, 45, 99, 99, 34]
console.log(getCharCountsByKey(chars))

// {2: 1, 34: 2, 45: 1, 90: 1, 99: 3}

randomId()

import { randomId } from "pedash"

console.log(randomId())

// "t536fwpn1je"

getLongest(arr: any[], key?: string)

import { getLongest } from "pedash"

const people = ["Sid", "Rusmanto", "Udin", "Zainab"]
console.log(getLongest(people))
// "Rusmanto"

const peopleObj = [
  // if the argument is in an array of objects shape
  { id: 1, name: "Glenn" },
  { id: 2, name: "Abi" },
  { id: 3, name: "Batugana" },
  { id: 4, name: "Zulu" }
]

console.log(getLongest(peopleObj, "name"))

// "Batugana"

getUnique(arr: any[])

import { getUnique } from "pedash"

const uniqueValues = [100, 44, 30, 100, 54, 54]
console.log(getUnique(uniqueValues))

// [100, 44, 30, 54]

groupByKey(arr: any[], key?: string)

import { groupByKey } from "pedash"

const valObj = [
  { id: 1, name: "Glenn", age: 56 },
  { id: 2, name: "Abi", age: 17 },
  { id: 3, name: "Batugana", age: 26 },
  { id: 4, name: "Zulu", age: 45 }
]

console.log(groupByKey(valObj, "name"))

// {
//    Glenn: { id: 1, name: "Glenn", age: 56 },
//    Abi: { id: 2, name: "Abi", age: 17 },
//    Batugana: { id: 3, name: "Batugana", age: 26 },
//    Zulu: { id: 4, name: "Zulu", age: 45 }
// }

getSmallest(arr: any[], limiter?: number)

import { getSmallest } from "pedash"

const nums = [34, 90, 78, 100, 12]

console.log(getSmallest(nums))
// [12]

console.log(getSmallest(nums, 3))
// [12, 34, 78]

console.log(getSmallest(nums, 8))
// [12, 34, 78, 90, 100]

getHighest(arr: any[], key?: string)

import { getHighest } from "pedash"

const numbers = [34, 2300, 56, 900]
console.log(getHighest(numbers))

// 2300

shuffle(arr: any[])

import { shuffle } from pedash;

const numbers = [56, 89, 21, 20, 7];
console.log(shuffle(numbers));

// [20, 21, 7, 89, 56]

removeDoubleWords(sentence: string)

import { removeDoubleWords } from pedash;

const sentence = "You you can do it now now"
console.log(removeDoubleWords(sentence));

// "You can do it now"

removeWhitespaces(sentence: string)

import { removeWhitespaces } from pedash;

const sentence = " You   can do it     now or never "
console.log(removeWhitespaces(sentence));

// "You can do it now or never"

stripTags(htmlString: string)

import { stripTags } from pedash;

const tags = "<p><em>Hello</em> <strong>world!</strong></p>"
console.log(stripTags(tags));

// "Hello world!"

getParamsToObject(url: string)

import { getParamsToObject } from pedash;

const completeUrl = "http://website.com?page=77&size=120&is_completed=true"
console.log(getParamsToObject(completeUrl));

// { page: 77, size: 120, is_completed: true }

renameKeys(keysMap: any, obj: any)

import { renameKeys } from pedash;

const obj = { name: "Samsul", location: "Toa Payoh, Singapore", isRetired: true }
console.log(renameKeys({ name: "firstName", location: "address" }, obj));

// { firstName: "Samsul", location: "Toa Payoh, Singapore", isRetired: true }

getRandomInRange(min: number, max: number)

import { getRandomInRange } from pedash;

console.log(getRandomInRange(2, 55);
// 34

console.log(getRandomInRange(1, 10);
// 10