0.6.0 • Published 4 months ago

kitify v0.6.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

kitify

version CI status codecov downloads size browsers

kitify (kit + ify) is a JavaScript utility library that provides a whole mess of useful helper functions and supports modularity.

kitify 是一个 JavaScript 工具函数包,它提供了一大堆有用的辅助工具函数, 并支持模块化。

Installation

npm install kitify

Usage

import { isType, clone } from 'kitify'
// or
import isType from 'kitify/isType'
import clone from 'kitify/clone'

isType(123) // 'number'
isType('hello', 'string') // true
clone({ a: 1, b: 2 }) // { a: 1, b: 2 }

API

Type

Provides some methods for interpreting data types.

MethodDescription
isTypeCheck if the value is of the specified type.
isObjectCheck if the value is an object.
isFunctionCheck if the value is a function.
isStringCheck if the value is a string.
isNumberCheck if the value is a number.
isBooleanCheck if the value is a boolean.
isArrayCheck if the value is an array.
isSymbolCheck if the value is a symbol.
isUndefinedCheck if the value is undefined.
isNullCheck if the value is null.
isBigIntCheck if the value is a BigInt.
isNilCheck if the value is null or undefined.
isEmptyCheck if the value is empty.
isInvalidCheck if the value is invalid.

Collection

Collection related utility functions

MethodDescription
cloneDeep copy of the value.
cloneDeepDeep copy of the value. Supports Map,Set,ArrayBuffer...
cloneLoopLoop deep copy of the value.
cloneJSONJSON deep copy of the value.

Object

Object related utility functions

MethodDescription
assignMerge objects into a new object.

Data

Processing data related utility functions

MethodDescription
listToTreeConvert list to tree.
treeToListConvert tree to list.

Color

Color related utility functions

MethodDescription
isHexColorCheck if the value is a hex color.
isRgbColorCheck if the value is a rgb color.
isHslColorCheck if the value is a hsl color.
isDarkColorCheck if the color is dark.
isLightColorCheck if the color is light.
hexToRgbConvert hex color to rgb.
rgbToHexConvert rgb color to hex.
colorRGBConvert color to [R,G,B].
setColorOpacitySet the opacity of the color.
setColorBrightnessSet the brightness of the color.
darkenColorDarken the color.
lightenColorLighten the color.
mixColorsMix two colors.
colorComplementaryGet the complementary color.
colorLuminanceGet the luminance of the color.
colorContrastGet the contrast of the color.

DOM

DOM related utility functions

MethodDescription
detectMouseDirectionDetect mouse movement direction in element.
addInputListenerhandle input event with composition events.

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

0.6.0

4 months ago

0.5.3

6 months ago

0.5.2

6 months ago

0.5.1

6 months ago

0.5.0

7 months ago

0.4.1

7 months ago

0.4.0

7 months ago

0.3.0

7 months ago

0.2.0

7 months ago

0.1.1

7 months ago

0.1.0

7 months ago

0.0.7

8 months ago

0.0.6

8 months ago

0.0.5

8 months ago

0.0.4

8 months ago

0.0.3

8 months ago

0.0.1

8 months ago