Socket
Socket
Sign inDemoInstall

cmd.js

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cmd.js - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

.jscsrc

36

cmd.js

@@ -6,2 +6,3 @@ /**

this.cmd = (function (Command) {
'use strict';

@@ -12,3 +13,3 @@ /**

*/
Command.prototype.all = function cmdAll (name, fn, args) {
Command.prototype.all = function cmdAll(name, fn, args) {
if (typeof fn !== 'function') {

@@ -24,3 +25,3 @@ throw new Error('cmd.all(name, fn), fn was not a function, got ' + typeof fn);

}.bind(this));
};
}

@@ -41,3 +42,3 @@ return this.getArgs(name, 'args', function (args) {

*/
Command.prototype.each = function cmdEach (name, fn, args) {
Command.prototype.each = function cmdEach(name, fn, args) {
if (typeof fn !== 'function') {

@@ -55,3 +56,3 @@ throw new Error('cmd.each(name, fn), fn was not a function, got ' + typeof fn);

}.bind(this));
};
}

@@ -74,5 +75,5 @@ return this.getArgs(name, 'args', function (args) {

*/
Command.prototype.getArgs = function getArgsWrapper (name, purpose, done) {
Command.prototype.getArgs = function getArgsWrapper(name, purpose, done) {
var getArgs = function getArgs () {
var getArgs = function getArgs() {
var args = Array.prototype.slice.apply(arguments);

@@ -83,4 +84,8 @@

args.forEach(function (arg) {
Array.isArray(arg) ? Array.prototype.push.apply(_args, arg) :
if (Array.isArray(arg)) {
Array.prototype.push.apply(_args, arg);
}
else {
_args.push(arg);
}
});

@@ -118,4 +123,6 @@ return done(_args);

return new Command();
var cmd = new Command();
return cmd;
})(function (context) {
'use strict';
this.context = context;

@@ -127,3 +134,5 @@ });

*/
this.module && (this.module.exports = this.cmd);
if (this.module) {
this.module.exports = this.cmd;
}

@@ -133,4 +142,7 @@ /**

*/
this.define && this.define('cmd', [], function () {
return this.cmd;
});
if (this.define) {
this.define('cmd', [], function () {
'use strict';
return this.cmd;
});
}

@@ -6,3 +6,4 @@ /**

cmd.each('alert', function (args, val) {
'use strict';
return alert(val);
}, []);

@@ -6,2 +6,3 @@ /**

cmd.all('compare', function (args, vals) {
'use strict';
var _a = vals[0];

@@ -8,0 +9,0 @@ var _b = vals[1];

@@ -7,3 +7,4 @@ /**

cmd.each('exists', function (args, val) {
'use strict';
return val !== null && val !== undefined;
}, []);

@@ -7,2 +7,3 @@ /**

cmd.each('extend', function (args, val) {
'use strict';
args.forEach(function (arg) {

@@ -9,0 +10,0 @@ Object.keys(arg).forEach(function (key) {

@@ -8,4 +8,6 @@ /**

cmd.all('filter', function (args, vals) {
'use strict';
return vals.filter(function (val) {
var len = args.length, i = -1;
var len = args.length;
var i = -1;
while (++i < len) {

@@ -12,0 +14,0 @@ if (!(args[i].raw || args[i])(val)) {

@@ -6,2 +6,3 @@ /**

cmd.each('format', function (args, val) {
'use strict';
return args.map(function (arg) {

@@ -8,0 +9,0 @@ return arg.replace('{}', val);

@@ -6,2 +6,3 @@ /**

cmd.all('join', function (args, vals) {
'use strict';
return args.map(function (arg) {

@@ -8,0 +9,0 @@ return vals.join(arg);

@@ -6,3 +6,4 @@ /**

cmd.each('log', function (args, val) {
'use strict';
return console.log(val);
}, []);

@@ -11,7 +11,12 @@ /**

cmd.each('logger', function (args, val) {
'use strict';
var logs = [];
args.forEach(function (arg) {
var log = typeof arg === 'function' ? arg(val) : arg;
Array.isArray(log) ? Array.prototype.push.apply(logs, log) :
if (Array.isArray(log)) {
Array.prototype.push.apply(logs, log);
}
else {
logs.push(log);
}
});

@@ -18,0 +23,0 @@ console.log.apply(console, logs);

@@ -6,3 +6,4 @@ /**

cmd.each('lower', function (args, val) {
'use strict';
return ('' + val).toLowerCase();
}, []);

@@ -5,2 +5,3 @@ /**

cmd.all('obj', function (args, vals) {
'use strict';
var obj = {};

@@ -7,0 +8,0 @@ args.forEach(function (arg, i) {

@@ -7,2 +7,3 @@ /**

cmd.each('pluck', function (args, val) {
'use strict';
var exists = cmd.exists.raw;

@@ -9,0 +10,0 @@ args.forEach(function (arg) {

@@ -6,2 +6,3 @@ /**

cmd.all('push', function (args, vals) {
'use strict';
return args.map(function (arg) {

@@ -8,0 +9,0 @@ arg.push.apply(arg, vals);

@@ -8,2 +8,3 @@ /**

cmd.all('sort', function (args, vals) {
'use strict';
return vals.sort(function (a, b) {

@@ -10,0 +11,0 @@ if (!args.length) {

@@ -10,3 +10,4 @@ /**

cmd.each('switch', function (args, val) {
cond = args[0];
'use strict';
var cond = args[0];
if (typeof cond !== 'function') {

@@ -13,0 +14,0 @@ throw new Error('cmd.switch(function (when) { ... }) called without function as first argument');

@@ -6,3 +6,4 @@ /**

cmd.each('upper', function (args, val) {
'use strict';
return ('' + val).toUpperCase();
}, []);

@@ -7,2 +7,3 @@ /**

(function () {
'use strict';
var ViewClassPrototype = {

@@ -15,3 +16,3 @@ update: function () {

render: function () {
while(this.node.lastChild) {
while (this.node.lastChild) {
this.node.removeChild(this.node.lastChild);

@@ -18,0 +19,0 @@ }

{
"name": "cmd.js",
"version": "0.0.2",
"version": "0.0.3",
"description": "A chainable utility toolkit for JavaScript.",
"main": "cmd.js",
"dependencies": {
},
"dependencies": {},
"devDependencies": {

@@ -16,6 +15,15 @@ "gulp": "^3.8.8",

"gulp-remember": "^0.2.1",
"gulp-watch": "^1.1.0"
"gulp-watch": "^1.1.0",
"istanbul": "^0.3.5",
"jscs": "^1.10.0",
"jshint": "^2.6.0",
"jshint-stylish": "^1.0.0",
"mocha": "^2.1.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"lint": "./node_modules/.bin/jshint ./cmd.js ./lib --reporter=node_modules/jshint-stylish/stylish.js",
"checkStyle": "./node_modules/.bin/jscs ./cmd.js ./lib",
"pretest": "npm run-script lint && npm run-script checkStyle",
"test": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --check-leaks --recursive -R spec",
"posttest": "./node_modules/.bin/istanbul check-coverage"
},

@@ -22,0 +30,0 @@ "repository": {

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