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

ininin-converter

v1.1.3

Published

字符串或数字转半角,字符串或数字转全角,解析键值对字符串为Hash对象,编码Hash对象为键值对字符串,货币格式化,过滤掉值为空字符的参数,人民币大写, 首字母大小写

Downloads

18

Readme

ininin-converter

字符串或数字转半角,字符串或数字转全角,解析键值对字符串为Hash对象,编码Hash对象为键值对字符串

install

npm i ininin-converter

github

https://github.com/yy-ininin/ininin-converter

usage

import converter from 'ininin-converter'

/* 字符串或数字转半角 */
converter.toDBC("123456789")
// 123456789

/* 字符串或数字转全角 */
converter.toSBC('123456789')
// 123456789

/* 解析键值对字符串为Hash对象 */
const str3 = "v=1.0.0&name=converter"
converter.decodeHashString(str3)
// { v: '1.0.0', name: 'converter' }

/* 编码Hash对象为键值对字符串 */
const str4 = { v: '1.0.0', name: 'converter' }
converter.encodeHashString(str4)
// v=1.0.0&name=converter

/* 首字母大写 其他字母小写 */
const str5 = "aaaa"
converter.toFirstUpperCase(str5)
// Aaaa

/* 首页母小写 其他字母大写 */
const str6 = "AAAA"
converter.toFirstLowerCase(str6)
// aAAA

/* 去除字符串中所有空格 */
let str7 = " A A "
converter.trimAll(str7, 1)
// "AA"

/* 货币格式化 */
converter.currency(123456789)
// CN¥123,456,789.00

/* 地址格式化 */
let str8 = "上海市^上海市^闵行区^七宝街道"
converter.location(str8, 4, "^")
// "上海市闵行区七宝街道"

/* 过滤掉值为空字符的参数 */
let str9 = {name: '你好', value: '', id: 1, code: '', age: '23', nobby: ['吃饭', '打游戏']}
converter.filterNullCharacter(str9, true)
// { name: '你好', id: 1, age: '23', nobby: [ '吃饭', '打游戏' ] }

/* 人民币大写 */
let str10 = 123456789.11
converter.rmbUpperCase(str10, true)
// 壹亿贰仟叁佰肆拾伍万陆仟柒佰捌拾玖元零壹分
let str11 = -123456789.11
converter.rmbUpperCase(str11)
//欠壹亿贰仟叁佰肆拾伍万陆仟柒佰捌拾玖元壹角壹分