1.1.1 • Published 8 months ago

siutils v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago
import { BaseEnum, is } from 'siutils'

class CompanyStatusEnum extends BaseEnum {
    static TEST = BaseEnum.created({ code: 0, label: '测试', oth: '1' } as const)
    static DEBUG = BaseEnum.created({ code: 1, label: '灰度', oth: '1' } as const)
    static PROD = BaseEnum.created({ code: 2, label: '生产', oth: '1' } as const)
}

console.dir(CompanyStatusEnum)
console.log(CompanyStatusEnum.TEST.code)
console.log(CompanyStatusEnum.TEST.label)
console.log(CompanyStatusEnum.toArray())
CompanyStatusEnum.toArray().map((item) => {
    console.log(item)
})
console.log(CompanyStatusEnum.toOriginArray())
CompanyStatusEnum.toOriginArray().map(([key, value]) => {
    console.log(key, value)
})
console.log(CompanyStatusEnum.getByCode(2 as const))



is.getValueType(new Map()) // Map
is.getValueType(1) // Number
is.getValueType('1') // String

is.notEmpty(null) // false
is.notEmpty(undefined) // false
is.notEmpty('') // false
is.notEmpty(0) // true

is.def(null) // false
is.def(undefined) // false
is.def('') // true
is.def(0) // true

is.empty(null) // true
is.empty(undefined) // true
is.empty('') // true
is.empty(0) // false

is.plainObject(new function (){})) // false
is.plainObject(new Map()) // false
is.plainObject({}) // true

is.frames() // true || false
1.1.1

8 months ago

1.1.0

8 months ago

1.0.9

1 year ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago