Comparing version 0.4.0 to 0.6.0
@@ -9,3 +9,3 @@ (function() { | ||
module.exports = { | ||
log: function() { | ||
getLog: function() { | ||
return _.clone(log); | ||
@@ -16,4 +16,22 @@ }, | ||
}, | ||
logDeprecationWarnings: function() { | ||
var metadata, method, warnings, _i, _len, _ref, _results; | ||
warnings = []; | ||
for (method in log) { | ||
metadata = log[method]; | ||
warnings.push([method, metadata]); | ||
} | ||
warnings.sort(function(a, b) { | ||
return b[1].count - a[1].count; | ||
}); | ||
console.warn("\nCalls to deprecated functions\n-----------------------------"); | ||
_results = []; | ||
for (_i = 0, _len = warnings.length; _i < _len; _i++) { | ||
_ref = warnings[_i], method = _ref[0], metadata = _ref[1]; | ||
_results.push(console.warn("(" + metadata.count + ") " + method + " : " + metadata.message, metadata)); | ||
} | ||
return _results; | ||
}, | ||
deprecate: function(message) { | ||
var e, method, stackLines; | ||
var all, e, method, stackLines, _ref; | ||
try { | ||
@@ -24,9 +42,9 @@ throw new Error("Deprecated Method"); | ||
stackLines = e.stack.split("\n"); | ||
method = stackLines[2].replace(/^\s*at\s*/, ''); | ||
_ref = stackLines[2].match(/^\s*at\s*(\S+)/), all = _ref[0], method = _ref[1]; | ||
} | ||
if (log[method] == null) { | ||
log[method] = { | ||
stackTraces: [], | ||
message: message, | ||
count: 0 | ||
count: 0, | ||
stackTraces: [] | ||
}; | ||
@@ -33,0 +51,0 @@ } |
{ | ||
"name": "grim", | ||
"version": "0.4.0", | ||
"version": "0.6.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
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
3451
50