vue-deepset
Advanced tools
Comparing version 0.3.0 to 0.3.1
16
index.js
@@ -262,3 +262,3 @@ 'use strict'; | ||
var found = true; | ||
var fields = isArray(path) ? path : toPath(path); | ||
var fields = isNumber(path) ? [path] : isArray(path) ? path : toPath(path); | ||
if (!fields.length) return false; | ||
@@ -389,7 +389,11 @@ forEach(fields, function (field) { | ||
var fields = _.isArray(path) ? path : _.toPath(path); | ||
for (var i = 0; i < fields.length; i++) { | ||
var prop = fields[i]; | ||
if (i === fields.length - 1) Vue.set(obj, prop, value);else if (!_.has(obj, prop)) Vue.set(obj, prop, _.isNumber(prop) ? [] : {}); | ||
obj = obj[prop]; | ||
} | ||
var prop = fields.shift(); | ||
if (!fields.length) return Vue.nextTick(function () { | ||
return Vue.set(obj, prop, value); | ||
}); | ||
if (!_.has(obj, prop)) Vue.set(obj, prop, _.isNumber(prop) ? [] : {}); | ||
Vue.nextTick(function () { | ||
return vueSet(obj[prop], fields, value); | ||
}); | ||
} | ||
@@ -396,0 +400,0 @@ |
{ | ||
"name": "vue-deepset", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Deep set Vue.js objects", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -205,5 +205,5 @@ # vue-deepset | ||
methods: { | ||
vueSet: VueDeepSet.vueSet, | ||
vueSet: vueSet, | ||
clearForm () { | ||
this.vueSet(this.localForm, 'message', 'Modified') | ||
this.vueSet(this.localForm, 'message', '') | ||
} | ||
@@ -210,0 +210,0 @@ }, |
@@ -263,3 +263,3 @@ (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 found = true; | ||
var fields = isArray(path) ? path : toPath(path); | ||
var fields = isNumber(path) ? [path] : isArray(path) ? path : toPath(path); | ||
if (!fields.length) return false; | ||
@@ -390,7 +390,11 @@ forEach(fields, function (field) { | ||
var fields = _.isArray(path) ? path : _.toPath(path); | ||
for (var i = 0; i < fields.length; i++) { | ||
var prop = fields[i]; | ||
if (i === fields.length - 1) Vue.set(obj, prop, value);else if (!_.has(obj, prop)) Vue.set(obj, prop, _.isNumber(prop) ? [] : {}); | ||
obj = obj[prop]; | ||
} | ||
var prop = fields.shift(); | ||
if (!fields.length) return Vue.nextTick(function () { | ||
return Vue.set(obj, prop, value); | ||
}); | ||
if (!_.has(obj, prop)) Vue.set(obj, prop, _.isNumber(prop) ? [] : {}); | ||
Vue.nextTick(function () { | ||
return vueSet(obj[prop], fields, value); | ||
}); | ||
} | ||
@@ -397,0 +401,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
33424
841