@huameow/utils
utils
Last updated 2 months ago by carlymeow .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @huameow/utils 
SYNC missed versions from official npm registry.

utils

how to use

1. install it

yarn add @huameow/utils

2. import it

import {formatDate} from '@huameow/utils';

formatDate("2020-01", 'YY-MM-DD') => 2020-01-01

api

method description

checkHasProperty

<T, K extends Extract<keyof T, string | string[]>>(value: T[K], key: K, items: T[]): boolean

sort

{binarySearch, heapSort, insertSort, mergeSort, quickSort}
formatDate (
value?: string
isDate (value: string
toDate
(value: string
getDuration
(
start: number
copy (text, id): Promise<unknown>
downloadedImage (id: string): Promise<unknown>
drawImage ({ url, width, height }, id: string, hasRadius = false): void
hasFlash (): boolean
isRetina
(): boolean
loadScript
(src: string): Promise<unknown>
validImage
(url: string, successFn: Function, failFn: Function): void
b64toBlob
(b64Data: string, contentType: string = "", sliceSize = 512): Blob

createObjectURL

(blob: Blob): string

crypto

(data: unknown, needJoin = false): string

getSuffix

(fileName: string): string

floatFix

(
value: string

formatLargeNumber

(value: number

isNumber

(value: string

nonRounding

(value: number, decimal: number): number

priceFormat
(
value: string

rounding

(value: number, decimal: number): string

switchCentAndYuanProps

(
value: string,
stage: Stage = PriceStage.YUAN
): number

toPrice

(value: string

decodeHTMLEntities

(str: string): string

escape

(text: string

unescape

(text: string): string

getStrLength

(str: string, charset = "gbk"): number

randomString

(length: number): string

setSpaces

(num: number): string

toCamelCase

(str: string): string

toSnakeCase

(str: string): string

hasChinese

(value: string): boolean

isChinaMobile

(value: number

isEmail

(value: string): boolean

isID

(value: string): boolean

isMobile

(value: number

isPhone

(value: number

isPostalCode

(value: number

isQQ

(value: number

isURL

(value: string): boolean

Current Tags

  • 0.0.3                                ...           latest (2 months ago)

3 Versions

  • 0.0.3                                ...           2 months ago
  • 0.0.2                                ...           2 months ago
  • 0.0.1                                ...           3 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |