Skip to content

Commit

Permalink
feat: replaced local methods with vue-set-path
Browse files Browse the repository at this point in the history
  • Loading branch information
kouts committed May 11, 2021
1 parent 4cffba4 commit 9bfab18
Show file tree
Hide file tree
Showing 14 changed files with 98 additions and 154 deletions.
9 changes: 7 additions & 2 deletions dist/cjs/pathStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ function _typeof(obj) {
"@babel/helpers - typeof";

if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function (obj) {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function (obj) {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
Expand All @@ -27,12 +27,15 @@ function _typeof(obj) {
function isObject(obj) {
return _typeof(obj) === 'object' && !Array.isArray(obj) && obj !== null;
}

function isNumeric(str) {
return !isNaN(str) && !isNaN(parseFloat(str));
}

function isArray(arr) {
return Array.isArray(arr);
}

function splitPath(str) {
var regex = /(\w+)|\[([^\]]+)\]/g;
var result = [];
Expand All @@ -48,6 +51,7 @@ function splitPath(str) {

return result;
}

function getByPath(obj, path) {
var parts = splitPath(path);
var length = parts.length;
Expand Down Expand Up @@ -104,6 +108,7 @@ var setOne = function setOne(obj, pathStr, value) {
obj = obj[prop];
}
};

var setMany = function setMany(obj, path, value) {
if (typeof path === 'string') {
setOne(obj, path, value);
Expand Down
37 changes: 21 additions & 16 deletions dist/cjs/vuexPathStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
var Vuex__default = /*#__PURE__*/_interopDefaultLegacy(Vuex);
var Vue__default = /*#__PURE__*/_interopDefaultLegacy(Vue);

function _typeof(obj) {
"@babel/helpers - typeof";

if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function (obj) {
return typeof obj;
};
} else {
_typeof = function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}

return _typeof(obj);
}

function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
Expand Down Expand Up @@ -59,15 +43,34 @@ function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

function _typeof(obj) {
"@babel/helpers - typeof";

if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}

return _typeof(obj);
}

function isObject(obj) {
return _typeof(obj) === 'object' && !Array.isArray(obj) && obj !== null;
}

function isNumeric(str) {
return !isNaN(str) && !isNaN(parseFloat(str));
}

function isArray(arr) {
return Array.isArray(arr);
}

function splitPath(str) {
var regex = /(\w+)|\[([^\]]+)\]/g;
var result = [];
Expand All @@ -83,6 +86,7 @@ function splitPath(str) {

return result;
}

function getByPath(obj, path) {
var parts = splitPath(path);
var length = parts.length;
Expand Down Expand Up @@ -139,6 +143,7 @@ var setOne = function setOne(obj, pathStr, value) {
obj = obj[prop];
}
};

var setMany = function setMany(obj, path, value) {
if (typeof path === 'string') {
setOne(obj, path, value);
Expand Down
9 changes: 7 additions & 2 deletions dist/es/pathStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ function _typeof(obj) {
"@babel/helpers - typeof";

if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function (obj) {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function (obj) {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
Expand All @@ -19,12 +19,15 @@ function _typeof(obj) {
function isObject(obj) {
return _typeof(obj) === 'object' && !Array.isArray(obj) && obj !== null;
}

function isNumeric(str) {
return !isNaN(str) && !isNaN(parseFloat(str));
}

function isArray(arr) {
return Array.isArray(arr);
}

function splitPath(str) {
var regex = /(\w+)|\[([^\]]+)\]/g;
var result = [];
Expand All @@ -40,6 +43,7 @@ function splitPath(str) {

return result;
}

function getByPath(obj, path) {
var parts = splitPath(path);
var length = parts.length;
Expand Down Expand Up @@ -96,6 +100,7 @@ var setOne = function setOne(obj, pathStr, value) {
obj = obj[prop];
}
};

var setMany = function setMany(obj, path, value) {
if (typeof path === 'string') {
setOne(obj, path, value);
Expand Down
37 changes: 21 additions & 16 deletions dist/es/vuexPathStore.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
import Vuex from 'vuex';
import Vue from 'vue';

function _typeof(obj) {
"@babel/helpers - typeof";

if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function (obj) {
return typeof obj;
};
} else {
_typeof = function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}

return _typeof(obj);
}

function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
Expand Down Expand Up @@ -50,15 +34,34 @@ function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

function _typeof(obj) {
"@babel/helpers - typeof";

if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}

return _typeof(obj);
}

function isObject(obj) {
return _typeof(obj) === 'object' && !Array.isArray(obj) && obj !== null;
}

function isNumeric(str) {
return !isNaN(str) && !isNaN(parseFloat(str));
}

function isArray(arr) {
return Array.isArray(arr);
}

function splitPath(str) {
var regex = /(\w+)|\[([^\]]+)\]/g;
var result = [];
Expand All @@ -74,6 +77,7 @@ function splitPath(str) {

return result;
}

function getByPath(obj, path) {
var parts = splitPath(path);
var length = parts.length;
Expand Down Expand Up @@ -130,6 +134,7 @@ var setOne = function setOne(obj, pathStr, value) {
obj = obj[prop];
}
};

var setMany = function setMany(obj, path, value) {
if (typeof path === 'string') {
setOne(obj, path, value);
Expand Down
9 changes: 7 additions & 2 deletions dist/umd/pathStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
"@babel/helpers - typeof";

if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function (obj) {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function (obj) {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
Expand All @@ -27,12 +27,15 @@
function isObject(obj) {
return _typeof(obj) === 'object' && !Array.isArray(obj) && obj !== null;
}

function isNumeric(str) {
return !isNaN(str) && !isNaN(parseFloat(str));
}

function isArray(arr) {
return Array.isArray(arr);
}

function splitPath(str) {
var regex = /(\w+)|\[([^\]]+)\]/g;
var result = [];
Expand All @@ -48,6 +51,7 @@

return result;
}

function getByPath(obj, path) {
var parts = splitPath(path);
var length = parts.length;
Expand Down Expand Up @@ -104,6 +108,7 @@
obj = obj[prop];
}
};

var setMany = function setMany(obj, path, value) {
if (typeof path === 'string') {
setOne(obj, path, value);
Expand Down
37 changes: 21 additions & 16 deletions dist/umd/vuexPathStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,6 @@
var Vuex__default = /*#__PURE__*/_interopDefaultLegacy(Vuex);
var Vue__default = /*#__PURE__*/_interopDefaultLegacy(Vue);

function _typeof(obj) {
"@babel/helpers - typeof";

if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function (obj) {
return typeof obj;
};
} else {
_typeof = function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}

return _typeof(obj);
}

function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
Expand Down Expand Up @@ -58,15 +42,34 @@
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

function _typeof(obj) {
"@babel/helpers - typeof";

if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}

return _typeof(obj);
}

function isObject(obj) {
return _typeof(obj) === 'object' && !Array.isArray(obj) && obj !== null;
}

function isNumeric(str) {
return !isNaN(str) && !isNaN(parseFloat(str));
}

function isArray(arr) {
return Array.isArray(arr);
}

function splitPath(str) {
var regex = /(\w+)|\[([^\]]+)\]/g;
var result = [];
Expand All @@ -82,6 +85,7 @@

return result;
}

function getByPath(obj, path) {
var parts = splitPath(path);
var length = parts.length;
Expand Down Expand Up @@ -138,6 +142,7 @@
obj = obj[prop];
}
};

var setMany = function setMany(obj, path, value) {
if (typeof path === 'string') {
setOne(obj, path, value);
Expand Down
2 changes: 1 addition & 1 deletion dist/umd/vuexPathStore.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"rollup": "^2.45.2",
"rollup-plugin-terser": "^5.3.1",
"vue": "^2.6.12",
"vue-set-path": "^1.0.0",
"vuepress": "^1.8.2"
}
}
Loading

0 comments on commit 9bfab18

Please sign in to comment.