Socket
Socket
Sign inDemoInstall

deprecatejs

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deprecatejs - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

8

index.js
'use strict';
var deprecate = function(callback, message) {
if (deprecate.production) {
return callback;
}
return function deprecateFn() {
console.error('- Deprecation Warning! ' + ( message || ''));
if (!deprecate.production) {
console.log('- Deprecation Warning! ' + ( message || ''));
}
return callback.apply(null, arguments);

@@ -11,0 +9,0 @@ };

{
"name": "deprecatejs",
"version": "1.0.7",
"version": "1.0.8",
"description": "Wrapper to deprecate JavaScript functions. Displays a custom error message if consumers call a function you've marked as deprecated",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -11,3 +11,3 @@ 'use strict';

describe('Deprecation warnings', function() {
describe('Warnings', function() {
function func1(value) {

@@ -18,3 +18,3 @@ return value;

beforeEach(function() {
sinon.spy(console, 'error');
sinon.spy(console, 'log');
deprecate.production = false;

@@ -24,6 +24,6 @@ });

afterEach(function() {
console.error.restore();
console.log.restore();
});
it('should work deprecate a function', function() {
it('should deprecate a function', function() {
var depFunc, result;

@@ -34,3 +34,3 @@

result.should.equal('str1');
expect(console.error).to.not.be.called;
expect(console.log).to.not.be.called;

@@ -41,4 +41,4 @@ depFunc = deprecate(func1);

result.should.equal('str2');
expect(console.error).to.be.called;
expect(console.log).to.be.called;
});
});

@@ -11,3 +11,3 @@ 'use strict';

describe('Deprecation warnings', function() {
describe('Warnings', function() {
function func1(value) {

@@ -18,3 +18,3 @@ return value;

beforeEach(function() {
sinon.spy(console, 'error');
sinon.spy(console, 'log');
deprecate.inProduction();

@@ -24,3 +24,3 @@ });

afterEach(function() {
console.error.restore();
console.log.restore();
});

@@ -34,3 +34,3 @@

result.should.equal('str1');
expect(console.error).to.not.be.called;
expect(console.log).to.not.be.called;

@@ -41,4 +41,4 @@ depFunc = deprecate(func1);

result.should.equal('str2');
expect(console.error).to.not.be.called;
expect(console.log).to.not.be.called;
});
});
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