1
0
mirror of https://github.com/vercel/commerce.git synced 2025-07-22 20:26:49 +00:00
Files
.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
commerce/framework/bigcommerce/lib/immutability.ts
2021-01-22 12:17:39 -05:00

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