New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

is-self

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-self - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

.npmignore

25

index.js

@@ -0,1 +1,3 @@

var parseArgs = require('minimist');
var isSelf = function(parent){

@@ -12,10 +14,19 @@ if (!(this instanceof isSelf)) {

isSelf.prototype.run = function(){
var method = process.argv[2];
var parentMethods = this.parent.exports; // module which called isSelf
var args = parseArgs(process.argv);
var method = args.m;
var parent = this.parent.exports; // module which called isSelf
if (method){
if (!parent[ method ]){
var msg = 'Module does not have a "'+method+ '" method';
throw new Error(msg);
}
parent[ method ].apply( parent, args._.slice(2) );
} else {
if (typeof parent !='function'){
var msg = 'Module is not a function';
throw new Error(msg);
}
parent.apply( parent, args._.slice(2) );
}
if (!parentMethods[ method ]){
var msg = 'Module does not have a "'+method+ '" method';
throw new Error(msg);
}
parentMethods[ method ].apply( parentMethods, process.argv.slice(3) );
};

@@ -22,0 +33,0 @@ isSelf.prototype.checkAndRun = function(){

{
"name": "is-self",
"version": "1.0.0",
"version": "1.0.1",
"description": "Check if module is self-evoked. Run module methods directly from command line",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "node test/asFunction arg1 arg2; node test/asObject.js -m run arg1 arg2 "
},
"author": "Anton Miselaytes <anton@wearereasonablepeople.com>",
"license": "ISC"
"license": "ISC",
"dependencies": {
"minimist": "^1.2.0"
}
}

@@ -28,4 +28,4 @@ # Overview

node veryUsefulModule methodA 1 2 // foo=1, bar=2, bax=undefined
node veryUsefulModule -m methodA 1 2 // foo=1, bar=2, bax=undefined
node veryUsefulModule methodC 1 2 // Module does not have a "methodC" method
node veryUsefulModule -m methodC 1 2 // Module does not have a "methodC" method
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