vue-deepset
Advanced tools
Comparing version 0.2.2 to 0.3.0
304
index.js
@@ -7,5 +7,53 @@ 'use strict'; | ||
var _ = _interopDefault(require('lodash/lodash.min')); | ||
var Vue = _interopDefault(require('vue')); | ||
/* eslint-disable */ | ||
function isArray(obj) { | ||
return Array.isArray(obj); | ||
} | ||
isArray._accepts = ['ANY']; | ||
/* eslint-disable */ | ||
function forEach(obj, fn) { | ||
try { | ||
if (isArray(obj)) { | ||
var idx = 0; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
try { | ||
for (var _iterator = obj[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var val = _step.value; | ||
if (fn(val, idx) === false) break; | ||
idx++; | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
} else { | ||
for (var key in obj) { | ||
if (fn(obj[key], key) === false) break; | ||
} | ||
} | ||
} catch (err) { | ||
return; | ||
} | ||
} | ||
forEach._accepts = [Object, Array]; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
@@ -17,3 +65,253 @@ return typeof obj; | ||
var toConsumableArray = function (arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} else { | ||
return Array.from(arr); | ||
} | ||
}; | ||
/* eslint-disable */ | ||
function uniq(list) { | ||
return isArray(list) ? [].concat(toConsumableArray(new Set(list))) : []; | ||
} | ||
uniq._accepts = [Array]; | ||
/* eslint-disable */ | ||
function isString(obj) { | ||
return typeof obj === 'string'; | ||
} | ||
isString._accepts = ['ANY']; | ||
/* eslint-disable */ | ||
function isObject(obj) { | ||
return (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null; | ||
} | ||
isObject._accepts = ['ANY']; | ||
/* eslint-disable */ | ||
function isFunction(obj) { | ||
return typeof obj === 'function'; | ||
} | ||
isFunction._accepts = ['ANY']; | ||
/* eslint-disable */ | ||
function identity(value) { | ||
return value; | ||
} | ||
identity._accepts = ['ANY']; | ||
/* eslint-disable */ | ||
function isNumber(obj) { | ||
return typeof obj === 'number' && !isNaN(obj); | ||
} | ||
isNumber._accepts = ['ANY']; | ||
/* eslint-disable */ | ||
/* | ||
function range (number = 0, increment = 1) { | ||
return [ ...Array(number).keys() ].map(i => i * increment) | ||
} | ||
*/ | ||
function range(start, end, step) { | ||
if (end === undefined && step === undefined) { | ||
end = start; | ||
start = 0; | ||
step = 1; | ||
} else if (step === undefined) { | ||
step = 1; | ||
} | ||
// non numbers return empty array | ||
if (!isNumber(start) || !isNumber(end) || !isNumber(step) || !step) return []; | ||
if (start === end) return [start]; | ||
var count = start; | ||
var _range = []; | ||
if (start < end) { | ||
while (count < end) { | ||
_range.push(count); | ||
count += Math.abs(step); | ||
} | ||
} else { | ||
while (count > end) { | ||
_range.push(count); | ||
count -= Math.abs(step); | ||
} | ||
} | ||
return _range; | ||
} | ||
range._accepts = [Number]; | ||
/* eslint-disable */ | ||
function keys(obj) { | ||
try { | ||
return isArray(obj) ? range(obj.length) : Object.keys(obj); | ||
} catch (err) { | ||
return []; | ||
} | ||
} | ||
keys._accepts = [Object, Array]; | ||
keys._dependencies = ['dash.isArray', 'dash.range']; | ||
/* eslint-disable */ | ||
function reduce(collection, iteratee, accumulator) { | ||
if (!isObject(collection) && !isArray(collection)) return undefined; | ||
if (!isFunction(iteratee)) { | ||
accumulator = iteratee; | ||
iteratee = identity; | ||
} | ||
accumulator = accumulator !== undefined ? accumulator : isArray(collection) ? collection.length ? collection[0] : undefined : keys(collection).length ? collection[keys(collection)[0]] : undefined; | ||
forEach(collection, function (value, key) { | ||
accumulator = iteratee(accumulator, value, key, collection); | ||
}); | ||
return accumulator; | ||
} | ||
reduce._accepts = [Object, Array]; | ||
reduce._dependencies = ['dash.forEach', 'dash.isObject', 'dash.isArray', 'dash.isFunction', 'dash.identity', 'dash.keys']; | ||
/* eslint-disable */ | ||
function toPath(pathString) { | ||
// taken from lodash - https://github.com/lodash/lodash | ||
var pathRx = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g; | ||
var pathArray = []; | ||
if (isString(pathString)) { | ||
pathString.replace(pathRx, function (match, number, quote, string) { | ||
pathArray.push(quote ? string : number !== undefined ? Number(number) : match); | ||
return pathArray[pathArray.length - 1]; | ||
}); | ||
} | ||
return pathArray; | ||
} | ||
toPath._accepts = [String]; | ||
/* eslint-disable */ | ||
function has(obj, path) { | ||
var found = true; | ||
var fields = isArray(path) ? path : toPath(path); | ||
if (!fields.length) return false; | ||
forEach(fields, function (field) { | ||
if (obj[field] === undefined) { | ||
found = false; | ||
return false; | ||
} | ||
obj = obj[field]; | ||
}); | ||
return found; | ||
} | ||
has._accepts = [Object, Array]; | ||
has._dependencies = ['dash.forEach', 'dash.isArray', 'dash.toPath']; | ||
/* eslint-disable */ | ||
function get$1(obj, path, defaultValue) { | ||
var value = obj; | ||
var fields = isArray(path) ? path : toPath(path); | ||
if (fields.length === 0) return defaultValue; | ||
try { | ||
for (var f in fields) { | ||
if (!value[fields[f]]) return defaultValue;else value = value[fields[f]]; | ||
} | ||
} catch (err) { | ||
return defaultValue; | ||
} | ||
return value; | ||
} | ||
get$1._accepts = [Object, Array]; | ||
get$1._dependencies = ['dash.isArray', 'dash.toPath']; | ||
/* eslint-disable */ | ||
var _ = { | ||
forEach: forEach, | ||
uniq: uniq, | ||
isString: isString, | ||
reduce: reduce, | ||
toPath: toPath, | ||
isArray: isArray, | ||
has: has, | ||
isNumber: isNumber, | ||
get: get$1, | ||
isObject: isObject, | ||
isFunction: isFunction, | ||
identity: identity, | ||
keys: keys, | ||
range: range | ||
}; | ||
/* | ||
* @author Branden Horiuchi <bhoriuchi@gmail.com> | ||
@@ -166,3 +464,3 @@ * @description Deep set Vue.js objects | ||
}, | ||
has: function has(target, property) { | ||
has: function has$$1(target, property) { | ||
return true; | ||
@@ -208,3 +506,3 @@ } | ||
}, | ||
has: function has(target, property) { | ||
has: function has$$1(target, property) { | ||
return true; | ||
@@ -211,0 +509,0 @@ } |
{ | ||
"name": "vue-deepset", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "Deep set Vue.js objects", | ||
@@ -22,3 +22,2 @@ "main": "index.js", | ||
"browserify-global-shim": { | ||
"lodash/lodash.min": "_", | ||
"vue": "Vue" | ||
@@ -54,5 +53,2 @@ }, | ||
"homepage": "https://github.com/bhoriuchi/vue-deepset#readme", | ||
"dependencies": { | ||
"lodash": "^4.17.4" | ||
}, | ||
"devDependencies": { | ||
@@ -69,2 +65,3 @@ "babel-core": "^6.23.1", | ||
"browserify-global-shim": "^1.0.3", | ||
"liteutils": "git+https://github.com/bhoriuchi/liteutils.git#master", | ||
"rollup": "^0.41.4", | ||
@@ -71,0 +68,0 @@ "rollup-plugin-babel": "^2.7.1", |
@@ -16,3 +16,2 @@ # vue-deepset | ||
* `lodash@^4.0.0` | ||
* `vue@>=1.0.0` | ||
@@ -19,0 +18,0 @@ * `vuex@>=1.0.0` (optional) |
@@ -8,5 +8,53 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.VueDeepSet = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
var _ = _interopDefault$1((window._)); | ||
var Vue = _interopDefault$1((window.Vue)); | ||
/* eslint-disable */ | ||
function isArray(obj) { | ||
return Array.isArray(obj); | ||
} | ||
isArray._accepts = ['ANY']; | ||
/* eslint-disable */ | ||
function forEach(obj, fn) { | ||
try { | ||
if (isArray(obj)) { | ||
var idx = 0; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
try { | ||
for (var _iterator = obj[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var val = _step.value; | ||
if (fn(val, idx) === false) break; | ||
idx++; | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
} else { | ||
for (var key in obj) { | ||
if (fn(obj[key], key) === false) break; | ||
} | ||
} | ||
} catch (err) { | ||
return; | ||
} | ||
} | ||
forEach._accepts = [Object, Array]; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
@@ -18,3 +66,253 @@ return typeof obj; | ||
var toConsumableArray = function (arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} else { | ||
return Array.from(arr); | ||
} | ||
}; | ||
/* eslint-disable */ | ||
function uniq(list) { | ||
return isArray(list) ? [].concat(toConsumableArray(new Set(list))) : []; | ||
} | ||
uniq._accepts = [Array]; | ||
/* eslint-disable */ | ||
function isString(obj) { | ||
return typeof obj === 'string'; | ||
} | ||
isString._accepts = ['ANY']; | ||
/* eslint-disable */ | ||
function isObject(obj) { | ||
return (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null; | ||
} | ||
isObject._accepts = ['ANY']; | ||
/* eslint-disable */ | ||
function isFunction(obj) { | ||
return typeof obj === 'function'; | ||
} | ||
isFunction._accepts = ['ANY']; | ||
/* eslint-disable */ | ||
function identity(value) { | ||
return value; | ||
} | ||
identity._accepts = ['ANY']; | ||
/* eslint-disable */ | ||
function isNumber(obj) { | ||
return typeof obj === 'number' && !isNaN(obj); | ||
} | ||
isNumber._accepts = ['ANY']; | ||
/* eslint-disable */ | ||
/* | ||
function range (number = 0, increment = 1) { | ||
return [ ...Array(number).keys() ].map(i => i * increment) | ||
} | ||
*/ | ||
function range(start, end, step) { | ||
if (end === undefined && step === undefined) { | ||
end = start; | ||
start = 0; | ||
step = 1; | ||
} else if (step === undefined) { | ||
step = 1; | ||
} | ||
// non numbers return empty array | ||
if (!isNumber(start) || !isNumber(end) || !isNumber(step) || !step) return []; | ||
if (start === end) return [start]; | ||
var count = start; | ||
var _range = []; | ||
if (start < end) { | ||
while (count < end) { | ||
_range.push(count); | ||
count += Math.abs(step); | ||
} | ||
} else { | ||
while (count > end) { | ||
_range.push(count); | ||
count -= Math.abs(step); | ||
} | ||
} | ||
return _range; | ||
} | ||
range._accepts = [Number]; | ||
/* eslint-disable */ | ||
function keys(obj) { | ||
try { | ||
return isArray(obj) ? range(obj.length) : Object.keys(obj); | ||
} catch (err) { | ||
return []; | ||
} | ||
} | ||
keys._accepts = [Object, Array]; | ||
keys._dependencies = ['dash.isArray', 'dash.range']; | ||
/* eslint-disable */ | ||
function reduce(collection, iteratee, accumulator) { | ||
if (!isObject(collection) && !isArray(collection)) return undefined; | ||
if (!isFunction(iteratee)) { | ||
accumulator = iteratee; | ||
iteratee = identity; | ||
} | ||
accumulator = accumulator !== undefined ? accumulator : isArray(collection) ? collection.length ? collection[0] : undefined : keys(collection).length ? collection[keys(collection)[0]] : undefined; | ||
forEach(collection, function (value, key) { | ||
accumulator = iteratee(accumulator, value, key, collection); | ||
}); | ||
return accumulator; | ||
} | ||
reduce._accepts = [Object, Array]; | ||
reduce._dependencies = ['dash.forEach', 'dash.isObject', 'dash.isArray', 'dash.isFunction', 'dash.identity', 'dash.keys']; | ||
/* eslint-disable */ | ||
function toPath(pathString) { | ||
// taken from lodash - https://github.com/lodash/lodash | ||
var pathRx = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g; | ||
var pathArray = []; | ||
if (isString(pathString)) { | ||
pathString.replace(pathRx, function (match, number, quote, string) { | ||
pathArray.push(quote ? string : number !== undefined ? Number(number) : match); | ||
return pathArray[pathArray.length - 1]; | ||
}); | ||
} | ||
return pathArray; | ||
} | ||
toPath._accepts = [String]; | ||
/* eslint-disable */ | ||
function has(obj, path) { | ||
var found = true; | ||
var fields = isArray(path) ? path : toPath(path); | ||
if (!fields.length) return false; | ||
forEach(fields, function (field) { | ||
if (obj[field] === undefined) { | ||
found = false; | ||
return false; | ||
} | ||
obj = obj[field]; | ||
}); | ||
return found; | ||
} | ||
has._accepts = [Object, Array]; | ||
has._dependencies = ['dash.forEach', 'dash.isArray', 'dash.toPath']; | ||
/* eslint-disable */ | ||
function get$1(obj, path, defaultValue) { | ||
var value = obj; | ||
var fields = isArray(path) ? path : toPath(path); | ||
if (fields.length === 0) return defaultValue; | ||
try { | ||
for (var f in fields) { | ||
if (!value[fields[f]]) return defaultValue;else value = value[fields[f]]; | ||
} | ||
} catch (err) { | ||
return defaultValue; | ||
} | ||
return value; | ||
} | ||
get$1._accepts = [Object, Array]; | ||
get$1._dependencies = ['dash.isArray', 'dash.toPath']; | ||
/* eslint-disable */ | ||
var _ = { | ||
forEach: forEach, | ||
uniq: uniq, | ||
isString: isString, | ||
reduce: reduce, | ||
toPath: toPath, | ||
isArray: isArray, | ||
has: has, | ||
isNumber: isNumber, | ||
get: get$1, | ||
isObject: isObject, | ||
isFunction: isFunction, | ||
identity: identity, | ||
keys: keys, | ||
range: range | ||
}; | ||
/* | ||
* @author Branden Horiuchi <bhoriuchi@gmail.com> | ||
@@ -167,3 +465,3 @@ * @description Deep set Vue.js objects | ||
}, | ||
has: function has(target, property) { | ||
has: function has$$1(target, property) { | ||
return true; | ||
@@ -209,3 +507,3 @@ } | ||
}, | ||
has: function has(target, property) { | ||
has: function has$$1(target, property) { | ||
return true; | ||
@@ -212,0 +510,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33285
0
835
14
216
- Removedlodash@^4.17.4
- Removedlodash@4.17.21(transitive)