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

panda-cn-local-data

v0.1.13

Published

国家、语言、币种、时区常量定义,相关转化工具

Readme

CLDR 数据 & 工具

货币、国家、语言编码 获取

各国家、各币种参考 https://yuque.antfin-inc.com/geixfk/zz1e7p/ifxp2v https://satellite.alibaba.net/#/g11n/language?appName=global-lnp-urc

币种单位、图标获取

import {CURRENCY} from '@alife/cn-local-data';

//人民币
console.log(CURRENCY["CNY"]);
//输出如下
{
    bases: 100,
    unit: 'CN¥',
    unit_local: '¥',
    iconUrl: 'https://u.alicdn.com/mobile/g/common/flags/1.0.0/assets/cn.png',
    example: 'CN¥ 1,234,567.89【当地: ¥ 1,234,567.89】'
  }

国家编码获取

import {COUNTRY} from '@alife/cn-local-data';

//中国CN
console.log(COUNTRY["CN"]);
//输出如下:
{
    code: 'CN',
    name: '中国',
    name_en: 'China'
  }

语言编码获取

import {LANGUAGE} from '@alife/cn-local-data';
console.log(LANGUAGE);
//输出如下:
[
  {
    languageText: '英语',
    languageName: 'english',
    locale: 'en-US',
    lang: 'en',
  },
  {},{},{}
]

国际化基础工具类

语言和 moment lang 转换

import { localUtil } from '@alife/cn-local-data';
const lang = localUtil.languageToMomentLang(window.lap_user_setting.language);
moment.locale(lang);

格式化 locale

将不规范的语言环境统一规范输出,如 en_us、en、EN、 en_US 统一格式化成 en-US

import { localUtil } from '@alife/cn-local-data';
localUtil.formatLocale('en_us')
//输出 en-US

根据 locale 获取 lang, 比如: en-US 或者 en_US 获取 en;

 /**
 * 根据en-US 或者 en_US  获取  en
 * locale
 * toUpperCase 是否返回大写
 */
function getLang(locale, toUpperCase)
 import { localUtil } from '@alife/cn-local-data';
 localUtil.getLang('en-US');

特定时区的时间转时间戳

import { localUtil } from '@alife/cn-local-data';
let time = '2018-08-30 11:00';
let timestamp = localUtil.toTimestamp(
  time,
  timeZone
);   //timeZone : GMT+7
console.log('timestamp', timestamp);
//1535598000000