Skip to content

Commit

Permalink
Merge branch 'release/1.3.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
maoberlehner committed Aug 21, 2019
2 parents 38a3198 + efe6d47 commit 8f81c15
Show file tree
Hide file tree
Showing 6 changed files with 1,199 additions and 1,114 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"plugins": ["compat"],
"extends": "@avalanche/eslint-config",
"rules": {
"compat/compat": 2
"compat/compat": "error"
}
}
6 changes: 3 additions & 3 deletions .eslintrc-md.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"extends": ".eslintrc",
"rules": {
"quotes": [2, "single", { "avoidEscape": true }],
"import/extensions": false,
"import/no-extraneous-dependencies": false,
"import/no-unresolved": false
"import/extensions": "off",
"import/no-extraneous-dependencies": "off",
"import/no-unresolved": "off"
}
}
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vuex-map-fields",
"version": "1.3.4",
"version": "1.3.5",
"description": "Enable two-way data binding for form fields saved in a Vuex store",
"keywords": [
"vue",
Expand Down Expand Up @@ -28,24 +28,24 @@
"prepublishOnly": "yarn run lint && yarn test && yarn run build"
},
"devDependencies": {
"@avalanche/eslint-config": "^3.0.0",
"@babel/core": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"@avalanche/eslint-config": "^4.0.0",
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@vue/test-utils": "1.0.0-beta.29",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^24.8.0",
"coveralls": "^3.0.3",
"eslint": "^5.16.0",
"eslint-plugin-compat": "^3.1.1",
"eslint-plugin-import": "^2.17.2",
"babel-jest": "^24.9.0",
"coveralls": "^3.0.6",
"eslint": "^6.2.1",
"eslint-plugin-compat": "^3.3.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-markdown": "^1.0.0",
"jest": "^24.8.0",
"rollup": "^1.11.3",
"rollup-plugin-babel": "^4.3.2",
"jest": "^24.9.0",
"rollup": "^1.19.4",
"rollup-plugin-babel": "^4.3.3",
"uglify-es": "^3.3.9",
"vue": "^2.6.10",
"vue-template-compiler": "^2.6.10",
"vuex": "^3.1.0"
"vuex": "^3.1.1"
},
"main": "dist/index.js",
"module": "dist/index.esm.js",
Expand Down
25 changes: 17 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import arrayToObject from './lib/array-to-object';
function normalizeNamespace(fn) {
return (...params) => {
// eslint-disable-next-line prefer-const
let [namespace, map, getterType, mutationType] =
typeof params[0] === `string` ? [...params] : [``, ...params];
let [namespace, map, getterType, mutationType] = typeof params[0] === `string`
? [...params]
: [``, ...params];

if (namespace.length && namespace.charAt(namespace.length - 1) !== `/`) {
namespace += `/`;
Expand Down Expand Up @@ -70,8 +71,8 @@ export const mapMultiRowFields = normalizeNamespace((
const store = this.$store;
const rows = store.getters[getterType](path);

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

return Object.defineProperty(prev, fieldKey, {
Expand All @@ -93,8 +94,16 @@ export const mapMultiRowFields = normalizeNamespace((
export const createHelpers = ({ getterType, mutationType }) => ({
[getterType]: getField,
[mutationType]: updateField,
mapFields: normalizeNamespace((namespace, fields) =>
mapFields(namespace, fields, getterType, mutationType)),
mapMultiRowFields: normalizeNamespace((namespace, paths) =>
mapMultiRowFields(namespace, paths, getterType, mutationType)),
mapFields: normalizeNamespace((namespace, fields) => mapFields(
namespace,
fields,
getterType,
mutationType,
)),
mapMultiRowFields: normalizeNamespace((namespace, paths) => mapMultiRowFields(
namespace,
paths,
getterType,
mutationType,
)),
});
2 changes: 1 addition & 1 deletion src/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
mapFields,
mapMultiRowFields,
updateField,
} from './';
} from '.';

describe(`index`, () => {
describe(`getField()`, () => {
Expand Down
Loading

0 comments on commit 8f81c15

Please sign in to comment.