mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
.vscode
assets
components
config
docs
framework
bigcommerce
api
auth
cart
common
customer
lib
immutability.ts
normalize.ts
product
scripts
wishlist
.env.template
README.md
commerce.config.json
fetcher.ts
index.tsx
next.config.js
provider.ts
schema.d.ts
schema.graphql
types.ts
commerce
shopify
lib
pages
public
.editorconfig
.env.template
.gitignore
.prettierignore
.prettierrc
README.md
codegen.json
commerce.config.json
global.d.ts
license.md
next-env.d.ts
next.config.js
package.json
postcss.config.js
tailwind.config.js
tsconfig.json
yarn.lock
14 lines
335 B
TypeScript
14 lines
335 B
TypeScript
import update, { Context } from 'immutability-helper'
|
|
|
|
const c = new Context()
|
|
|
|
c.extend('$auto', function (value, object) {
|
|
return object ? c.update(object, value) : c.update({}, value)
|
|
})
|
|
|
|
c.extend('$autoArray', function (value, object) {
|
|
return object ? c.update(object, value) : c.update([], value)
|
|
})
|
|
|
|
export default c.update
|