
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
Lightweight TypeScript/JavaScript utility library: time formatting, URL parsing, HTTP helpers (retry/timeout/query), validation, string/object utils, storage, colorful console. Tree-shaking and full types.
轻量、类型友好、支持 Tree‑shaking 的前端工具库。聚焦常用场景:时间格式化、URL 解析、输入校验、对象/字符串工具、控制台彩色日志。
SEO 关键词:JavaScript utils、TypeScript utils、date format、URL parse、validation、object utils、string utils、colorful console, deep merge, camelCase。
# npm
npm install nex-lib
# pnpm
pnpm add nex-lib
# yarn
yarn add nex-lib
ESM 用法:
import { format, getTimestamp, createWURL, ObjectUtils, StringUtils, ValidationUtils, EchoUtils } from 'nex-lib';
// 时间格式化 / 时间戳
format(); // 'YYYY-MM-DD HH:mm:ss'
format(1633072800); // 指定秒数
getTimestamp(); // 毫秒时间戳
getTimestamp(1633072800); // 指定秒数对应的毫秒
// URL 工具
const u = createWURL('https://sub.example.com/path?foo=bar');
u.getMainDomain(); // 'example.com'
u.parseQueryParams(); // { foo: 'bar' }
u.addParamsToURL({ q: 'x' }); // 'https://sub.example.com/path?foo=bar&q=x'
u.isHttps(); // true
u.getPathname(); // '/path'
u.getPort(); // '80'(未显式端口时)
// 校验工具
ValidationUtils.isValidEmail('a@b.com');
ValidationUtils.isValidURL('https://example.com');
ValidationUtils.isValidPhoneNumber('1234567890');
ValidationUtils.isValidDate('2024-02-29');
ValidationUtils.isValidPostalCode('100000');
ValidationUtils.isValidIDCard('11010119900307123X');
// 对象工具
ObjectUtils.deepMerge({ a: 1 }, { b: 2 });
ObjectUtils.deepEqual({ a: 1 }, { a: 1 });
ObjectUtils.judgeTypes([]); // 'array'
ObjectUtils.keys({ a: 1 }); // ['a']
ObjectUtils.values({ a: 1 }); // [1]
// 字符串工具
StringUtils.toCamelCase('hello_world'); // 'helloWorld'
StringUtils.reverseString('abc'); // 'cba'
StringUtils.ellipsisStr('abcdefghijklmn', 6, 4); // 'abcdef...jklmn'
StringUtils.createRandomStr(8); // 随机串
StringUtils.countOccurrences('foofoo', 'foo'); // 2
// 彩色日志
EchoUtils.green('OK', { id: 1 });
CommonJS 用法:
const { format, getTimestamp, createWURL, ObjectUtils, StringUtils, ValidationUtils, EchoUtils } = require('nex-lib');
format、getTimestamp(日期格式化、时间戳)format(seconds?: number): stringgetTimestamp(seconds?: number): numbercreateWURL(url: string) → { getMainDomain, parseQueryParams, addParamsToURL, isHttps, getPathname, getPort }ObjectUtils、StringUtils、ValidationUtils、EchoUtilsFAQs
Lightweight TypeScript/JavaScript utility library: time formatting, URL parsing, HTTP helpers (retry/timeout/query), validation, string/object utils, storage, colorful console. Tree-shaking and full types.
We found that nex-lib demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.