Comparing version 0.11.0 to 0.12.0
@@ -10,50 +10,53 @@ (function() { | ||
global.__grimDeprecations__ = []; | ||
grim = { | ||
maxDeprecationCallCount: function() { | ||
return 250; | ||
}, | ||
getDeprecations: function() { | ||
return _.clone(global.__grimDeprecations__); | ||
}, | ||
clearDeprecations: function() { | ||
return global.__grimDeprecations__ = []; | ||
}, | ||
logDeprecations: function() { | ||
var deprecation, deprecations, _i, _len, _results; | ||
deprecations = grim.getDeprecations(); | ||
deprecations.sort(function(a, b) { | ||
return b.getCallCount() - a.getCallCount(); | ||
}); | ||
console.warn("\nCalls to deprecated functions\n-----------------------------"); | ||
_results = []; | ||
for (_i = 0, _len = deprecations.length; _i < _len; _i++) { | ||
deprecation = deprecations[_i]; | ||
_results.push(console.warn("(" + (deprecation.getCallCount()) + ") " + (deprecation.getOriginName()) + " : " + (deprecation.getMessage()), deprecation)); | ||
if (global.__grim__ == null) { | ||
grim = global.__grim__ = { | ||
grimDeprecations: [], | ||
maxDeprecationCallCount: function() { | ||
return 250; | ||
}, | ||
getDeprecations: function() { | ||
return _.clone(grim.grimDeprecations); | ||
}, | ||
getDeprecationsLength: function() { | ||
return grim.grimDeprecations.length; | ||
}, | ||
clearDeprecations: function() { | ||
return grim.grimDeprecations = []; | ||
}, | ||
logDeprecations: function() { | ||
var deprecation, deprecations, _i, _len, _results; | ||
deprecations = grim.getDeprecations(); | ||
deprecations.sort(function(a, b) { | ||
return b.getCallCount() - a.getCallCount(); | ||
}); | ||
console.warn("\nCalls to deprecated functions\n-----------------------------"); | ||
_results = []; | ||
for (_i = 0, _len = deprecations.length; _i < _len; _i++) { | ||
deprecation = deprecations[_i]; | ||
_results.push(console.warn("(" + (deprecation.getCallCount()) + ") " + (deprecation.getOriginName()) + " : " + (deprecation.getMessage()), deprecation)); | ||
} | ||
return _results; | ||
}, | ||
deprecate: function(message) { | ||
var deprecation, deprecations, methodName, stack; | ||
stack = Deprecation.generateStack().slice(1); | ||
methodName = Deprecation.getFunctionNameFromCallsite(stack[0]); | ||
deprecations = grim.grimDeprecations; | ||
if (!(deprecation = _.find(deprecations, function(d) { | ||
return d.getOriginName() === methodName; | ||
}))) { | ||
deprecation = new Deprecation(message); | ||
grim.grimDeprecations.push(deprecation); | ||
} | ||
if (deprecation.getCallCount() < grim.maxDeprecationCallCount()) { | ||
deprecation.addStack(stack); | ||
return grim.emit("updated", deprecation); | ||
} | ||
} | ||
return _results; | ||
}, | ||
deprecate: function(message) { | ||
var deprecation, deprecations, methodName, stack; | ||
stack = Deprecation.generateStack().slice(1); | ||
methodName = Deprecation.getFunctionNameFromCallsite(stack[0]); | ||
deprecations = global.__grimDeprecations__; | ||
if (!(deprecation = _.find(deprecations, function(d) { | ||
return d.getOriginName() === methodName; | ||
}))) { | ||
deprecation = new Deprecation(message); | ||
global.__grimDeprecations__.push(deprecation); | ||
} | ||
if (deprecation.getCallCount() < grim.maxDeprecationCallCount()) { | ||
deprecation.addStack(stack); | ||
return grim.emit("updated"); | ||
} | ||
} | ||
}; | ||
}; | ||
Emitter.extend(grim); | ||
} | ||
Emitter.extend(grim); | ||
module.exports = global.__grim__; | ||
module.exports = grim; | ||
}).call(this); |
{ | ||
"name": "grim", | ||
"version": "0.11.0", | ||
"version": "0.12.0", | ||
"description": "Log usage of deprecated methods", | ||
@@ -5,0 +5,0 @@ "main": "./lib/grim", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
8256
161
1