Skip to content

Commit

Permalink
Merge branch 'release/1.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
maoberlehner committed Feb 22, 2020
2 parents a83126e + 32e880a commit fa5c480
Show file tree
Hide file tree
Showing 3 changed files with 1,899 additions and 1,968 deletions.
26 changes: 14 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vuex-map-fields",
"version": "1.3.6",
"version": "1.4.0",
"description": "Enable two-way data binding for form fields saved in a Vuex store",
"keywords": [
"vue",
Expand Down Expand Up @@ -29,22 +29,22 @@
},
"devDependencies": {
"@avalanche/eslint-config": "^4.0.0",
"@babel/core": "^7.7.5",
"@babel/preset-env": "^7.7.6",
"@babel/core": "^7.8.4",
"@babel/preset-env": "^7.8.4",
"@vue/test-utils": "1.0.0-beta.29",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^24.9.0",
"babel-jest": "^25.1.0",
"coveralls": "^3.0.9",
"eslint": "^6.7.2",
"eslint-plugin-compat": "^3.3.0",
"eslint-plugin-import": "^2.19.1",
"eslint": "^6.8.0",
"eslint-plugin-compat": "^3.5.1",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-markdown": "^1.0.1",
"jest": "^24.9.0",
"rollup": "^1.27.9",
"jest": "^25.1.0",
"rollup": "^1.31.1",
"rollup-plugin-babel": "^4.3.3",
"uglify-es": "^3.3.9",
"vue": "^2.6.10",
"vue-template-compiler": "^2.6.10",
"vue": "^2.6.11",
"vue-template-compiler": "^2.6.11",
"vuex": "^3.1.2"
},
"main": "dist/index.js",
Expand All @@ -57,7 +57,9 @@
"url": "https://github.com/maoberlehner/vuex-map-fields/issues"
},
"browserslist": [
"last 2 versions"
"> 0.5%",
"not ie <= 10",
"not op_mini all"
],
"jest": {
"coveragePathIgnorePatterns": [
Expand Down
8 changes: 6 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import arrayToObject from './lib/array-to-object';

function objectEntries(obj) {
return Object.keys(obj).map(key => [key, obj[key]]);
}

function normalizeNamespace(fn) {
return (...params) => {
// eslint-disable-next-line prefer-const
Expand Down Expand Up @@ -69,10 +73,10 @@ export const mapMultiRowFields = normalizeNamespace((
entries[key] = {
get() {
const store = this.$store;
const rows = Object.entries(store.getters[getterType](path));
const rows = objectEntries(store.getters[getterType](path));

return rows
.map((fieldsObject, index) => Object.keys(fieldsObject[1]).reduce((prev, fieldKey) => {
.map(fieldsObject => Object.keys(fieldsObject[1]).reduce((prev, fieldKey) => {
const fieldPath = `${path}[${fieldsObject[0]}].${fieldKey}`;

return Object.defineProperty(prev, fieldKey, {
Expand Down
Loading

0 comments on commit fa5c480

Please sign in to comment.