custom-ability
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -27,3 +27,3 @@ (function() { | ||
abilityFn = function(aClass, aOptions) { | ||
var AbilityClass, filter, filterMethods, vAbility, vExcludes, vIncludes, vName; | ||
var AbilityClass, filter, filterMethods, vAbility, vCoreMethod, vExcludes, vIncludes, vName; | ||
AbilityClass = abilityClass; | ||
@@ -36,6 +36,8 @@ if (isGetClassFunc === true) { | ||
} | ||
vName = AbilityClass.name; | ||
vCoreMethod = isArray(aCoreMethod) ? aCoreMethod[0] : aCoreMethod; | ||
if (aClass == null) { | ||
aClass = AbilityClass; | ||
} else if (!(aClass.prototype.$abilities && aClass.prototype.$abilities.self)) { | ||
if (!(aOptions && aOptions.inited) && (vName = AbilityClass.name) && aClass.prototype.$abilities && (vAbility = aClass.prototype.$abilities[vName.toLowerCase()])) { | ||
} else if (!((vCoreMethod && aClass.prototype[vCoreMethod]) || (vName && aClass.prototype.$abilities && aClass.prototype.$abilities['$' + vName]))) { | ||
if (!(aOptions && aOptions.inited) && vName && aClass.prototype.$abilities && (vAbility = aClass.prototype.$abilities[vName.toLowerCase()])) { | ||
if (aOptions) { | ||
@@ -50,8 +52,7 @@ aOptions.inited = true; | ||
} | ||
if (!aClass.prototype.$abilities) { | ||
defineProperty(aClass.prototype, '$abilities', { | ||
self: abilityFn | ||
}); | ||
} else { | ||
aClass.prototype.$abilities.self = abilityFn; | ||
if (vName) { | ||
if (!aClass.prototype.$abilities) { | ||
defineProperty(aClass.prototype, '$abilities', {}); | ||
} | ||
aClass.prototype.$abilities['$' + vName] = abilityFn; | ||
} | ||
@@ -58,0 +59,0 @@ if ((aOptions == null) || !(aOptions.include || aOptions.exclude)) { |
{ | ||
"name": "custom-ability", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "make custom ability more easy. generate the ability which can be added to any class directly.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/snowyu/custom-ability.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
27100
133