# sculp-js
**Repository Path**: wwdragon/sculp-js
## Basic Information
- **Project Name**: sculp-js
- **Description**: frontend js utils, achieve by ts, support esm、commonjs、umd
- **Primary Language**: TypeScript
- **License**: MIT
- **Default Branch**: main
- **Homepage**: https://chandq.github.io/sculp-js/
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2023-11-12
- **Last Updated**: 2026-01-28
## Categories & Tags
**Categories**: Uncategorized
**Tags**: TypeScript, js-utils, rollup
## README
# sculp-js
**A Modern JavaScript Utility Library for Web**
[](https://github.com/chandq/sculp-js/actions/workflows/node.js.yml)
[](https://www.npmjs.com/package/sculp-js)
[](https://github.com/chandq/sculp-js/blob/main/LICENSE.md)
[](https://codecov.io/gh/chandq/sculp-js)
> A lightweight utility library written in TypeScript with zero dependencies, supporting ESM, CJS, and UMD formats.
**[API Documentation](https://chandq.github.io/sculp-js/)** • **[Getting Started](#usage)** • **[Features](#features)**
## ✨ Features
- **Type-Safe**: Full TypeScript support with comprehensive type definitions
- **Zero Dependencies**: Pure native implementation, no external libraries
- **Tree Shaking**: Supports selective imports for smaller bundle sizes
- **Multi-Format**: ESM, CJS, and UMD builds available
- **Web Focused**: Optimized for modern web environments
### Core Utilities
Type Checking
- `isString`, `isNumber`, `isBoolean`, `isFunction`, `isObject`, `isArray`
- `isDate`, `isRegExp`, `isUndefined`, `isNull`, `isError`, `isNaN`
- `isPrimitive`, `isSymbol`, `isBigInt`, `isPlainObject`
- `isEmpty`, `isNodeList`, `isValidDate`, `typeIs`
Data Structures
- **Array**: `arrayEach`, `arrayEachAsync`, `arrayInsertBefore`, `arrayRemove`
- **Tree**: `forEachDeep`, `mapDeep`, `findDeep`, `filterDeep`, `searchTreeById`, `flatTree`, `fuzzySearchTree`
- **Object**: `objectAssign`, `objectGet`, `objectHas`, `cloneDeep`, `objectPick`, `objectOmit`
Web APIs
- **DOM**: `addClass`, `hasClass`, `removeClass`, `getStyle`, `setStyle`
- **File**: `chooseLocalFile`, `compressImg`
- **Clipboard**: `copyText`, `fallbackCopyText`
- **Download**: `downloadBlob`, `downloadURL`, `downloadData`
- **Watermark**: `genCanvasWM`
Encoding & Validation
- **Encode/Decode**: `weBtoa`, `weAtob`, `b64encode`, `b64decode`
- **Validation**: `isEmail`, `isPhone`, `isUrl`, `isIDNO`, `isIPv4`, `isIPv6`
Additional Utils
- **Date**: `formatDate`, `calculateDate`, `dateToStart`, `dateToEnd`
- **String**: `stringCamelCase`, `stringKebabCase`, `parseQueryParams`, `stringEscapeHTML`
- **Math**: `add`, `subtract`, `multiply`, `divide`, `numberAbbr`
- **Functional**: `debounce`, `throttle`, `once`, `wait`
## 🚀 Installation
### npm
```bash
npm install sculp-js
```
### CDN
```html
```
## 💡 Usage
```js
import { forEachDeep, cloneDeep } from 'sculp-js';
// Deep traversal of tree structures
const tree = [
{
id: 1,
name: 'Parent 1',
children: [
{ id: 11, name: 'Child 1' },
{ id: 12, name: 'Child 2', children: [{ id: 121, name: 'Grandchild 1' }] }
]
},
{ id: 2, name: 'Parent 2' }
];
const names = [];
forEachDeep(tree, item => {
names.push(item.name);
});
// names = ['Parent 1', 'Child 1', 'Child 2', 'Grandchild 1', 'Parent 2']
// Deep cloning of objects
const original = { a: 1, b: { c: 2 } };
const cloned = cloneDeep(original);
```
## 📦 Module Formats
```js
// ES Modules (recommended)
import { cloneDeep } from 'sculp-js';
// Individual module imports
import cloneDeep from 'sculp-js/cloneDeep';
// CommonJS
const { cloneDeep } = require('sculp-js');
```
## 📄 License
MIT License © 2023-present, [chandq](https://github.com/chandq)