lodash-decorators
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -72,2 +72,6 @@ 'use strict'; | ||
function isGetter(getter) { | ||
return Boolean(getter['' + _settings2['default'].annotationPrefix + 'isGetter']); | ||
} | ||
/** | ||
@@ -95,8 +99,7 @@ * Creates a generic decorator for a method on an object. | ||
var result = TYPE_MAP[type].apply(TYPE_MAP, [root[method], target, get || value].concat(args)); | ||
if (get) { | ||
descriptor.get = result; | ||
var toWrap = isGetter(get) ? get : get.call(this); | ||
descriptor.get = TYPE_MAP[type].apply(TYPE_MAP, [root[method], target, toWrap].concat(args)); | ||
} else if (value) { | ||
descriptor.value = result; | ||
descriptor.value = TYPE_MAP[type].apply(TYPE_MAP, [root[method], target, value].concat(args)); | ||
} | ||
@@ -103,0 +106,0 @@ |
{ | ||
"name": "lodash-decorators", | ||
"author": "Steven Sojka", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"engines": { | ||
@@ -6,0 +6,0 @@ "node": ">=0.12.0" |
@@ -27,2 +27,6 @@ 'use strict'; | ||
function isGetter(getter) { | ||
return Boolean(getter[`${settings.annotationPrefix}isGetter`]); | ||
} | ||
/** | ||
@@ -42,8 +46,8 @@ * Creates a generic decorator for a method on an object. | ||
const { value, get } = descriptor; | ||
const result = TYPE_MAP[type](root[method], target, (get || value), ...args); | ||
if (get) { | ||
descriptor.get = result; | ||
const toWrap = isGetter(get) ? get : get.call(this); | ||
descriptor.get = TYPE_MAP[type](root[method], target, toWrap, ...args); | ||
} else if (value) { | ||
descriptor.value = result; | ||
descriptor.value = TYPE_MAP[type](root[method], target, value, ...args); | ||
} | ||
@@ -50,0 +54,0 @@ |
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
16663
422