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

exist-utils

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exist-utils - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

12

assignsElvisObj.js

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {

});
exports.eqelo = exports.assignsElvisObj = undefined;
exports.eqelo = exports.assignsElvisObj = void 0;
var _exists = require('./exists');
var _exists = require("./exists");
var assignsElvisObj = exports.assignsElvisObj = function assignsElvisObj(obj, prop, value) {
var assignsElvisObj = function assignsElvisObj(obj, prop, value) {
if (!(0, _exists.exists)(obj[prop])) {

@@ -17,2 +17,4 @@ obj[prop] = value;

var eqelo = exports.eqelo = assignsElvisObj;
exports.assignsElvisObj = assignsElvisObj;
var eqelo = assignsElvisObj;
exports.eqelo = eqelo;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,22 +6,22 @@ Object.defineProperty(exports, "__esModule", {

});
exports.fnex = exports.callsIfExist = undefined;
exports.fnex = exports.callsIfExist = void 0;
var _isFunction = require('lodash/isFunction');
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
var _isFunction2 = _interopRequireDefault(_isFunction);
var _exists = require("./exists");
var _exists = require('./exists');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var callsIfExist = exports.callsIfExist = function callsIfExist(func) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var callsIfExist = function callsIfExist(func) {
if ((0, _exists.exists)(func) && (0, _isFunction.default)(func)) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
if ((0, _exists.exists)(func) && (0, _isFunction2.default)(func)) {
return func.apply(undefined, args);
return func.apply(void 0, args);
}
};
var fnex = exports.fnex = callsIfExist;
exports.callsIfExist = callsIfExist;
var fnex = callsIfExist;
exports.fnex = fnex;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,18 +6,16 @@ Object.defineProperty(exports, "__esModule", {

});
exports.fnexo = exports.callsIfExistObj = undefined;
exports.fnexo = exports.callsIfExistObj = void 0;
var _isFunction = require('lodash/isFunction');
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
var _isFunction2 = _interopRequireDefault(_isFunction);
var _exists = require("./exists");
var _exists = require('./exists');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var callsIfExistObj = exports.callsIfExistObj = function callsIfExistObj(obj, func) {
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
var callsIfExistObj = function callsIfExistObj(obj, func) {
if ((0, _exists.exists)(obj) && (0, _exists.exists)(func) && (0, _isFunction.default)(obj[func])) {
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
if ((0, _exists.exists)(obj) && (0, _exists.exists)(func) && (0, _isFunction2.default)(obj[func])) {
return obj[func].apply(obj, args);

@@ -27,2 +25,4 @@ }

var fnexo = exports.fnexo = callsIfExistObj;
exports.callsIfExistObj = callsIfExistObj;
var fnexo = callsIfExistObj;
exports.fnexo = fnexo;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {

});
exports.el = exports.elvis = undefined;
exports.el = exports.elvis = void 0;
var _exists = require('./exists');
var _exists = require("./exists");
var elvis = exports.elvis = function elvis(value, def) {
var elvis = function elvis(value, def) {
return (0, _exists.exists)(value) ? value : def;
};
var el = exports.el = elvis;
exports.elvis = elvis;
var el = elvis;
exports.el = el;

@@ -6,6 +6,10 @@ "use strict";

});
var exists = exports.exists = function exists(value) {
exports.ex = exports.exists = void 0;
var exists = function exists(value) {
return value !== undefined && value !== null;
};
var ex = exports.ex = exists;
exports.exists = exists;
var ex = exists;
exports.ex = ex;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,16 +6,18 @@ Object.defineProperty(exports, "__esModule", {

});
exports.exc = exports.existsChained = undefined;
exports.exc = exports.existsChained = void 0;
var _exists = require('./exists');
var _exists = require("./exists");
var _existsChainedValue = require('./existsChainedValue');
var _existsChainedValue = require("./existsChainedValue");
var existsChained = exports.existsChained = function existsChained(obj) {
for (var _len = arguments.length, props = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
var existsChained = function existsChained(obj) {
for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
props[_key - 1] = arguments[_key];
}
return (0, _exists.exists)(_existsChainedValue.existsChainedValue.apply(undefined, [obj].concat(props)));
return (0, _exists.exists)(_existsChainedValue.existsChainedValue.apply(void 0, [obj].concat(props)));
};
var exc = exports.exc = existsChained;
exports.existsChained = existsChained;
var exc = existsChained;
exports.exc = exc;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,41 +6,24 @@ Object.defineProperty(exports, "__esModule", {

});
exports.excv = exports.existsChainedValue = undefined;
exports.excv = exports.existsChainedValue = void 0;
var _exists = require('./exists');
var _exists = require("./exists");
var existsChainedValue = exports.existsChainedValue = function existsChainedValue(obj) {
for (var _len = arguments.length, props = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
props[_key - 1] = arguments[_key];
}
var existsChainedValue = function existsChainedValue(obj) {
if (!(0, _exists.exists)(obj)) {
return undefined;
}
var value = obj;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = props[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var prop = _step.value;
for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
props[_key - 1] = arguments[_key];
}
value = value[prop];
if (!(0, _exists.exists)(value)) {
return undefined;
}
for (var _i = 0; _i < props.length; _i++) {
var prop = props[_i];
value = value[prop];
if (!(0, _exists.exists)(value)) {
return undefined;
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}

@@ -51,2 +34,4 @@

var excv = exports.excv = existsChainedValue;
exports.existsChainedValue = existsChainedValue;
var excv = existsChainedValue;
exports.excv = excv;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -7,3 +7,3 @@ Object.defineProperty(exports, "__esModule", {

var _assignsElvisObj = require('./assignsElvisObj');
var _assignsElvisObj = require("./assignsElvisObj");

@@ -20,3 +20,3 @@ Object.keys(_assignsElvisObj).forEach(function (key) {

var _callsIfExist = require('./callsIfExist');
var _callsIfExist = require("./callsIfExist");

@@ -33,3 +33,3 @@ Object.keys(_callsIfExist).forEach(function (key) {

var _callsIfExistObj = require('./callsIfExistObj');
var _callsIfExistObj = require("./callsIfExistObj");

@@ -46,3 +46,3 @@ Object.keys(_callsIfExistObj).forEach(function (key) {

var _elvis = require('./elvis');
var _elvis = require("./elvis");

@@ -59,3 +59,3 @@ Object.keys(_elvis).forEach(function (key) {

var _exists = require('./exists');
var _exists = require("./exists");

@@ -72,3 +72,3 @@ Object.keys(_exists).forEach(function (key) {

var _existsChained = require('./existsChained');
var _existsChained = require("./existsChained");

@@ -85,3 +85,3 @@ Object.keys(_existsChained).forEach(function (key) {

var _existsChainedValue = require('./existsChainedValue');
var _existsChainedValue = require("./existsChainedValue");

@@ -88,0 +88,0 @@ Object.keys(_existsChainedValue).forEach(function (key) {

{
"name": "exist-utils",
"version": "1.0.0",
"description": "Util functions ",
"version": "1.0.1",
"description": "Utility functions that emulate CoffeeScript existence operator",
"author": "Louis Brunner <louis.brunner.fr@gmail.com> (https://github.com/LouisBrunner)",

@@ -17,14 +17,15 @@ "license": "MIT",

],
"main": "index.js",
"main": "lib/index.js",
"scripts": {
"build:lib": "babel src --out-dir . --ignore _spec.js",
"build:dist": "webpack",
"clean": "rm -rf /*.js",
"build:lib": "babel src/*.js --out-dir .",
"build:dist": "webpack --mode production",
"build": "npm run build:lib && npm run build:dist",
"lint": "eslint .",
"test": "NODE_ENV=test NODE_PATH=$NODE_PATH:$PWD nyc mocha --opts ./.mocha.opts",
"test:watch": "watch-run -i -p 'src/**/*' npm run test",
"travis-test": "NODE_ENV=test NODE_PATH=$NODE_PATH:$PWD nyc --reporter=lcov mocha --opts ./.mocha.opts",
"travis-coverage": "cat ./coverage/lcov.info | coveralls",
"test": "jest --config jest.config.js",
"test:watch": "npm run test -- --watch",
"travis:test": "CI=yes npm run test",
"travis:coverage": "cat ./coverage/lcov.info | coveralls",
"prepush": "npm run lint && npm run test && npm run build:dist",
"prepare": "npm run lint && npm run test && npm run build:lib"
"prepare": "npm run clean && npm run lint && npm run test && npm run build:lib"
},

@@ -43,21 +44,16 @@ "repository": {

"devDependencies": {
"babel-cli": "^6.24.0",
"babel-eslint": "^7.2.0",
"babel-loader": "^6.4.1",
"babel-plugin-istanbul": "^4.0.0",
"babel-preset-es2015": "^6.24.0",
"babel-register": "^6.24.0",
"chai": "^3.5.0",
"coveralls": "^2.12.0",
"eslint": "^3.18.0",
"eslint-loader": "^1.6.3",
"mocha": "^3.2.0",
"nyc": "^10.1.2",
"sinon": "^2.1.0",
"sinon-chai": "^2.9.0",
"watch-run": "^1.2.5",
"webpack": "^2.3.1",
"webpack-dev-server": "^2.4.2",
"@babel/cli": "^7.2.3",
"@babel/core": "^7.3.4",
"@babel/preset-env": "^7.3.4",
"babel-eslint": "^10.0.1",
"babel-jest": "^24.1.0",
"babel-loader": "^8.0.5",
"coveralls": "^3.0.3",
"eslint": "^5.15.0",
"eslint-loader": "^2.1.2",
"jest": "^24.1.0",
"webpack": "^4.29.6",
"webpack-cli": "^3.2.3",
"webpack-merge": "^4.1.0"
}
}
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