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

funny-utils

v0.4.1

Published

--- 1. [groupArrByKey](#grouparrbykey) 2. [addCommas](#addcommas) 3. [removeCommas](#removecommas) 4. [validateMobileNumber](#validatemobilenumber) 5. [formatMobileNumber](#formatmobilenumber) 6. [validateTelNumber](#validatetelnumber) 7. [formatTe

Downloads

4

Readme


  1. groupArrByKey
  2. addCommas
  3. removeCommas
  4. validateMobileNumber
  5. formatMobileNumber
  6. validateTelNumber
  7. formatTelNumber
  8. isEmptyObject
  9. throttle

groupArrByKey

주어진 배열 내의 객체들을 지정된 속성 값으로 그룹화합니다.

function groupArrByKey(arr, key);

const arr = [
  { id: "23", value: 1 },
  { id: "23", value: 4},
  { id: "20", value: 22},
];

groupArrByKey(arr, "id");

addCommas

숫자를 받아 3자리 수 마다 콤마를 추가합니다.

function addCommas(num);

addCommas(10000);

removeCommas

문자열을 받아 모든 콤마를 제거합니다.

function removeCommas(str);

addCommas('10,000');

validateMobileNumber

모바일 번호가 아니면 에러를 내보냅니다. 하이픈이 있어도 제거한 후 검증합니다.

function validateMobileNumber(mobileNumber);

validateMobileNumber('010-9421-1234'); // 01094211234 string
validateMobileNumber('010-921-1234');  // 0109211234 string

validateMobileNumber(010-9521-1234);   // throw error
validateMobileNumber('010-9#21-1234'); // throw error
validateMobileNumber('10-29421-1234'); // throw error

formatMobileNumber

모바일 번호에 하이픈을 추가해줍니다.

function formatMobileNumber(mobileNumber);

formatMobileNumber('01094251234'); // 010-9421-1234 string
formatMobileNumber('010-9425-1234'); // 010-9421-1234 string
formatMobileNumber('010-921-1234');  // 010-921-1234 string

formatMobileNumber(010-9521-1234);   // throw error
formatMobileNumber('010-9#21-1234'); // throw error
formatMobileNumber('10-29421-1234'); // throw error

validateTelNumber

전화번호가 정상적인지 검증합니다.

function validateTelNumber(mobileNumber);

validateTelNumber('02-9421-1234'); // 0294211234 string
validateTelNumber('042-1921-1234');  // 04219211234 string

validateTelNumber(1095211234);   // throw error
validateTelNumber('010-9#21-1234'); // throw error
validateTelNumber('10-29421-1234'); // throw error

formatTelNumber

일반 전화번호에 하이픈을 추가해줍니다.

function formatTelNumber(mobileNumber);

formatTelNumber('0294251234'); // 02-9425-1234 string
formatTelNumber('0434251234'); // 043-425-1234 string
formatTelNumber('07041251234');  // 070-4125-1234 string

formatTelNumber(01095211234);   // throw error
formatTelNumber('042-9#21-1234'); // throw error
formatTelNumber('0104-29421-1234'); // throw error

isEmptyObject

일반 전화번호에 하이픈을 추가해줍니다.

function isEmptyObject(mobileNumber);

isEmptyObject({}); // true

isEmptyObject('str'); //  flase
isEmptyObject(1234);  //  flase
isEmptyObject({a:1});   // flase
isEmptyObject(new Date()); //  flase
isEmptyObject(['0104-29421-1234']); // flase

throttle

여러번 발생하는 이벤트를 일정 시간 동안, 한번만 실행 되도록 만듭니다.

function throttle(callback, limit);

throttle(callback, 300)