Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grim

Package Overview
Dependencies
Maintainers
4
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grim - npm Package Compare versions

Comparing version 0.11.0 to 0.12.0

93

lib/grim.js

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc