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

tongtong-utils

v0.2.11

Published

String类

Downloads

1

Readme

String类

| 方法 | 说明 | 参数 | 返回 | | ----------- | -------------------- | ------------------------------------------------------------ | ----------------- | | Resovle | 截取一个字符串 | context: 截取前的字符串start: 要截取字符串的前面部分stop: 要截取的字符串的后面部分isTurn: 是否从后向前截取 | String | false | | Resovles | 截取一组字符串 | context: 截取前的字符串start: 要截取字符串的前面部分stop: 要截取的字符串的后面部分isTurn: 是否从后向前截取 | String[] | false | | replaceAll | 判断符串是否符合规则 | context: 待替换的字符串oldValue: 替换前的字符串newValue: 替换后的字符串 | String | | replaceAlls | 字符串全局替换 | context: 待替换的字符串oldValues: 替换前的字符串数组newValues: 替换后的字符串数组 | String | | | | | |

Array类

| 方法 | 说明 | 参数 | 返回 | | --------- | ------------ | ------------------------------------------ | ----- | | uniq | 数组去重 | arr: 原始数组field: 去重参数(可选) | Array | | intersect | 求出数组交集 | ...array: 至少2个数组 | Array | | | | | |

Number类

| 方法 | 说明 | 参数 | 返回 | | --------- | ---------- | --------------------------------------------------------- | ----- | | toFix | 保留小数位 | number: 原始数值length: 要保留的小数位数(默认2) | Array | | fixedZero | 左侧补零 | val: 原始数值length: 要补零到最终转换为字符串的长度 | Array | | | | | |

Object类

| 方法 | 说明 | 参数 | 返回 | | ------ | ---------------- | ------------------------------------------------------------ | ------ | | clone | 克隆出一个新对象 | obj: 要复制的对象func: 是否保留对象内的方法(默认false) | Object | | extend | 合并对象至第一个对象 | ...object 至少2个对象 | Object | | getValue | 获取对象中指定属性的值 | object: 原始对象field: 属性名,支持a.b形式defaultValue: 未取到值时的返回值,默认undefined | value | | setValue | 设置对象的值 | object: 原始对象field: 属性名,支持a.b形式value: 要设置的值force: 是否强制赋值 | object | | isEmpty | 判断对象是否为空 | object: 原始对象except: 要排除的属性(可选) | boolean | | toStr | 将对象转换为字符串只能对比简单对象 | object: 原始对象 | String | | equal | 对比两个对象是否一致只能对比简单对象 | object1: 要对比的对象1object2: 要对比的对象2 | boolean | | changeList | 获取两个对象中,值不一样的属性名列表 | object1: 要对比的对象1object2: 要对比的对象2 | String[] | | renderRecord | 将对象解析到文本中 | text: 文本object: 对象 | String | | renderObject | 将对象解析到文本中 | obj: 对象object: 对象 | object | | renderArray | 将对象以数组方式解析 | arr: 数组obj:对象object:对象 | Array |

输入:String.Resovle("<a>通通停车</a>", "<a>", "</a>");

输出:通通停车

输入:var obj = {a: {b: 1}};

String.getValue(obj, 'a.b');

输出:1

输入:String.setValue(obj, 'a.b.c', 2, true);

输出:{a: {b: {c: 2}}}

输入:String.renderRecord('c is ${a.b.c}', obj);

输出:c is 2