@shopify/decorators
Advanced tools
Comparing version 1.0.0 to 1.0.2
@@ -10,4 +10,12 @@ # Changelog | ||
## 1.0.1 - 2019-03-11 | ||
### Bug Fix | ||
- fix the bug where `memoize` will only remember result once per property definition. It will now memoize per instance. ([#567](https://github.com/Shopify/quilt/pull/567)) | ||
## 1.0.0 - 2019-03-7 | ||
### Added | ||
- `@shopify/decorators` package | ||
- `@shopify/decorators` package with `memoize` decorator |
@@ -6,3 +6,3 @@ "use strict"; | ||
function memoize(resolver) { | ||
return function (_target, _propertyKey, descriptor) { | ||
return function (_target, propertyKey, descriptor) { | ||
var method = descriptor.value; | ||
@@ -12,4 +12,12 @@ if (!method || !(method instanceof Function)) { | ||
} | ||
descriptor.value = memoized(method, resolver); | ||
return descriptor; | ||
return { | ||
get: function get() { | ||
var newDescriptor = { | ||
configurable: true, | ||
value: memoized(method, resolver), | ||
}; | ||
Object.defineProperty(this, propertyKey, newDescriptor); | ||
return newDescriptor.value; | ||
}, | ||
}; | ||
}; | ||
@@ -16,0 +24,0 @@ } |
{ | ||
"name": "@shopify/decorators", | ||
"version": "1.0.0", | ||
"version": "1.0.2", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "A set of decorators to aid your JavaScript journey.", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7278
75