A drop-in replacement for native enum. Like native enum, but much better!
A drop-in replacement for native enum. Like native enum, but much better!
A solution for business dictionary management
Like native enum, but much better!
Supported Platforms Introduction • Get Started • API Reference • Global Configuration • User Stories • Plugin System • Localization • Extensibility • Best Practices • Compatibility • FAQ • Full API Reference
Native enums are great for constants, but product code usually needs more at runtime:
enum-plus keeps the direct enum-style experience, then adds those runtime capabilities in one place.
It's a front-end business dictionary solution, that provides a lightweight data source. It's part of the front-end infrastructure.
Want to see what enum-plus can do and how it improves productivity? See Full Demo
number and stringnpm install enum-plus…import i18nPlugin from '@enum-plus/plugin-i18next';
import { Enum } from 'enum-plus';
Enum.install(i18nPlugin);
const StatusEnum = Enum({
Draft: { value: 1, label: 'locales.enums.statusEnum.draft' },
Review: { value: 2, label: 'locales.enums.statusEnum.review' },
Published: { value: 3, label: 'locales.enums.statusEnum.published' },
});
StatusEnum.labels; // ['Draft', 'In Review', 'Published'] or ['草稿', '审核中', '已发布']
StatusEnum.label(2); // 'In Review' or '审核中'
StatusEnum.named.Review.label; // 'In Review' or '审核中'If this project helps you, please consider giving it a Star ⭐️ on GitHub. This will encourage us to continue developing and maintaining this project.
No open issues yet, or sync has not completed.