0.1.1 • Published 4 months ago

ekko-enum v0.1.1

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

ekko-enum

枚举帮助方法

安装

npm install ekko-enum

使用

  • 引用
import { defineEnum} from 'ekko-enum'
  • 初始化
  const name = 'category'
  const enums = [
    { value: 1, label: 'test1' },
    { value: 2, label: 'test2' },
    { value: 3, label: 'test3', other: { a: ''} }
  ]
 const useCategoryEnum = defineEnum(name, enums)
或
 const useCategoryEnum = defineEnum({ name, enums })
  • 使用
const categoryEnum = useCategoryEnum()
const label=categoryEnum.string(1)
console.log(label)
  • 输出

test1

License

MIT

0.1.1

4 months ago

0.1.0

5 months ago

0.0.2

6 months ago

0.0.1

6 months ago