enum-plus has released a new version!

enum-plus has released a new version!

enum-plus v3.0 Released 🚀

image

> Follow our public account to get timely delivery of technical insights!

The enum-plus v3.0 milestone upgrade is here — a major version introducing new features, enhancements, and breaking changes.

📄 Full documentation: https://juejin.cn/post/7567630238701092902

Star on GitHub: https://github.com/shijistar/enum-plus

---

🔥 Major New Features

1. Simplified Enum Initialization

No more `as const` needed in v3.0+.

// Before
const WeekEnum = Enum({
  Monday: { value: 1, label: '星期一' },
  Tuesday: { value: 2, label: '星期二' },
} as const);

// Now
const WeekEnum = Enum({
  Monday: { value: 1, label: '星期一' },
  Tuesday: { value: 2, label: '星期二' },
});

---

2. `enum.named` — Item Lookup by Key

Quickly access enum items without `.find()`.

const monday = WeekEnum.named.Monday;

---

3. `enum.meta` — Aggregate Custom Fields

Directly access custom field values for all members.

ColorEnum.meta.hex; // ['#FF0000', '#00FF00', '#0000FF']

---

4. Updated `enum.values` Behavior

Returns raw member values, not objects.

Use `enum.items` for the old behavior.

WeekEnum.values; // [1, 2, 3, 4, 5, 6, 7]

---

5. `enum.labels` — Read-Only Label Array

WeekEnum.labels; // ['星期一', '星期二', ...]

---

6. `enum.toList` — Unified List Conversion

Replaces `toSelect`, `toMenu`, and `toFilter` (now plugins).

WeekEnum.toList();
// [ { value: 1, label: 'Monday' }, { value: 2, label: 'Tuesday' } ]

WeekEnum.toList({ valueField: 'id', labelField: 'name' });
// [ { id: 1, name: 'Monday' }, { id: 2, name: 'Tuesday' } ]

---

7. `enum.toMap` — Key/Value Mapping

Replaces `enum.toValueMap`.

WeekEnum.toMap();
// { "1": 'Monday', "2": 'Tuesday' }

WeekEnum.toMap({ keySelector: 'key', valueSelector: 'value' });
// { "Monday": 1, "Tuesday": 2 }

---

8. `Enum.isEnum` — Instance Check

Enum.isEnum(WeekEnum); // true

---

9. `enum.findBy` — Search by Any Field

WeekEnum.findBy('value', 1);
WeekEnum.findBy('key', 'Monday');

---

10. Improved `instanceof` Type Assertions

if (value instanceof WeekEnum) {
  console.log(value); // type narrowed
}

---

11. `Enum.install` — Plugin Installation

Enum.install(plugin);

---

12. Global Configuration via `Enum.config`

  • `autoLabel` — toggle automatic label generation
  • `labelPrefix` — set label prefix

---

⚙ Internal Changes

  • Removed proxy in `EnumItemClass` → replaced with getters (avoids circular references)
  • Unified Jest & e2e tests
  • Removed `private member` syntax (serialization friendly)
  • Dropped warning for modified enum items

---

📦 Plugin System

Now supports modular expansions via npm:

  • `@enum-plus/plugin-antd` — Ant Design bindings (`toSelect`, `toMenu`, etc.)
  • `@enum-plus/plugin-i18next` — i18next localization
  • `@enum-plus/plugin-react-i18next` — react-i18next support
  • `@enum-plus/plugin-react` — React integration with language reactivity
  • `@enum-plus/plugin-i18next-vue` — Vue with i18next
  • `@enum-plus/plugin-vue-i18n` — Vue with vue-i18n

> 💡 Missing a plugin? Refer to the Plugin Development Guide.

---

⚠ Breaking Changes

  • `values` now returns raw values
  • Symbol renames:
  • `ENUM_COLLECTION` → `IS_ENUM`
  • `ENUM_ITEM` → `IS_ENUM_ITEM`
  • `ENUM_ITEMS` → `IS_ENUM_ITEMS`
  • `toSelect`, `toMenu`, `toFilter`, `toValueMap` moved to plugins
  • Removed deprecated:
  • `options`, `menus`, `filters`, `valuesEnum`

---

🐛 Bug Fixes

  • Fixed sourcemap parsing under `lib` folder
image

---

📖 Read original article:

Read Original

Open in WeChat

---

> 💬 Pro Tip for Teams:

> For streamlined multi-platform release notes or docs, consider AiToEarn官网 — an open-source AI content monetization platform that lets you generate, publish, and track updates across Douyin, Kwai, WeChat, Bilibili, Xiaohongshu, Facebook, Instagram, LinkedIn, Threads, YouTube, Pinterest, and X (Twitter).

> Explore AiToEarn文档 and AI模型排名 for integration examples.

---

Would you like me to also prepare a concise Markdown changelog version of this so you can drop it straight into your GitHub releases page? That would make it more developer-friendly.

Read more

How AI Startups Can Effectively Analyze Competitors — Avoid the Feature List Trap and Redefine Your Battleground

How AI Startups Can Effectively Analyze Competitors — Avoid the Feature List Trap and Redefine Your Battleground

Competitive Analysis Is Not “Feature Comparison” — It’s Strategic Positioning This guide explains how AI startup teams can escape the trap of feature lists. Using concepts from user perception, product pacing, and capital narratives, we’ll build a cognitive framework for understanding competitors — and help you identify your differentiated battlefield

By Honghao Wang