Home

Awesome

mutative-compat

npm npm bundle size GitHub Workflow Status (with branch) Codecov branch

Mutative wrapper with full Immer API compatibility.

Installation

# npm
npm install mutative-compat mutative

# Yarn
yarn add mutative-compat mutative

# pnpm
pnpm add mutative-compat mutative

Optional but useful 😈:

// package.json
{
  "dependencies": {
    "immer": "npm:mutative-compat@^0.1.x",
    "mutative": "^1.0.2",
  },
  // npm
  "overrides": {
    "immer": "npm:mutative-compat@^0.1.x"
  },
  // Yarn
  "resolutions": {
    "immer": "npm:mutative-compat@^0.1.x"
  },
  // pnpm
  "pnpm": {
    "overrides": {
      "immer": "npm:mutative-compat@^0.1.x"
    }
  }
}

This way you can replace immer with mutative in some opinionated libraries like Redux Toolkit.

Differences from Immer

For other differences (that you probably will never notice), see mutative/test/immer-non-support.test.ts

License

MIT License @ 2023-Present Xuanbo Cheng