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

licos-tools

v1.0.66

Published

npm i licos-tools

Downloads

15

Readme

licos tools lib

安装

npm i licos-tools

使用

import tools from 'licos-tools'

convert 转换

驼峰转下划线

camelToUnderline(str: string): string

下划线转驼峰

underlineToCamel(str: string): string

对象转数组

objectToArray(Obj: Object):Array<object>

数组转树形结构

arrayToTree(list: [], parentKey = ''): Array<object>

树形结构转数组

treeToArray(list: any, newArr: any): Array<object>

根据 Key 将数组转换为树形结构

arrayToTreeByKey(list: Array<object>, pid = '', customField = { key: 'id', parentKey: 'pid' }): Array<Object>

common 工具类

获取UUID

uuid (len: number, radix: number): string
实例:tools.common.uuid(8,16);//获取8位16进制的字符串
返回:1f2a3c41

获取GUID

guid = (): string
实例:tools.common.guid();//获取8位16进制的字符串
返回:1d4ac2d2-11c8-4bdb-adb9-e5b96e96d027

检测版本号

checkVer(oldVer: string, newVer: string): boolean
实例:tools.common.checkVer('10.0.1','10.0.2');
返回:true

截取自定义长度的字符串

fixLen(str: string, len: number): string
实例:tools.common.fixLen('我们是联诚科技',3);
返回:我们是...

屏幕尺寸缩放时触发回调

screen(cb: Function): void
实例:tools.common.screen((resizedWinWidth, resizedWinHeight, scale)=>{

});

express 代码执行

const context={title:'',name:''}
const exp=new tools.express(context);
//模板解析
const text = exp.template('<div>{{title}}</div><span>{{name}}</span>');

//计算
const ret = exp.compute('1+1');


//代码执行
const ret = exp.execute('let a = title; return a;');

msgBus 消息总线

监听消息

on(topic: string, cb: Function): void
实例:tools.msgBus.on('topic',(type,e)=>{

});

发送消息

emit(topic: string, data: Object): void
实例:tools.msgBus.emit('topic',{a:1});