Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

frontend js utils, achieve by ts, support esm、commonjs、umd

License

chandq/sculp-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

213 Commits

Repository files navigation

Node.js CI sculp-js

license:MIT Downloads:? codecov

sculp-js

API Doc

TS + Rollup, native implementation, without relying on any third-party libraries, outputs products of three module modes: ESM, CJS, and UMD. sculp-js only used to Web environment, @sculp/core can be used to Web、Node.js、Mini Program.

Quickstart

  • Via CDN: <script src="https://unpkg.com/sculp-js"></script>

  • Via npm:

    npm i sculp-js

Features

  • Type

    • isString
    • isBoolean
    • isNumber
    • isUndefined
    • isNull
    • isNullish
    • isPrimitive
    • isFunction
    • isObject
    • isArray
    • typeIs
    • isJsonString
    • isEmpty
  • encode/decode

    • weAtob
    • weBtoa
  • Array

    • arrayEach
    • arrayEachAsync
  • Tree

    • forEachDeep
    • mapDeep
    • findDeep
    • filterDeep
    • searchTreeById
    • formatTree
    • flatTree
    • fuzzySearchTree
  • Object

    • isPlainObject
    • objectHas
    • objectAssign
    • objectEach
    • objectEachAsync
    • objectGet
    • cloneDeep
  • Number

    • formatNumber
  • String

    • stringCamelCase
    • stringKebabCase
    • parseQueryParams
  • Unique

    • uniqueString
    • uniqueNumber
  • Date

    • formatDate
    • dateToStart
    • dateToEnd
    • calculateDate
    • calculateDateTime
  • Download (web)

    • downloadURL
    • downloadHref
    • downloadBlob
    • downloadData
  • File (web)

    • chooseLocalFile
    • compressImg
  • Dom (web)

    • hasClass
    • addClass
    • removeClass
    • setStyle
    • getStyle
    • getComputedCssVal
    • getStrWidthPx
  • Watermark (web)

    • genCanvasWM
  • Clipboard (web)

    • copyText

Install

npm i sculp-js

Usage

import { forEachDeep } from 'sculp-js';
const tree = [
 { id: 1, name: 'row1' },
 {
 id: 2,
 name: 'row2',
 children: [{ id: 21, name: 'row2-1' }]
 },
 { id: 3, name: 'row3' }
];
const arr = [];
forEachDeep(tree, ({ id, name }) => {
 arr.push(name);
});
// arr will be: ['row1', 'row2', 'row2-1', 'row3'];

About

frontend js utils, achieve by ts, support esm、commonjs、umd

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /