Skip to content

Commit ab64725

Browse files
committed
Add vue.common.js from dist
1 parent 4f0974b commit ab64725

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

dist/vuex.common.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ function devtoolPlugin (store) {
6969
* @param {Function} f
7070
* @return {*}
7171
*/
72+
73+
7274
/**
7375
* Deep copy the given object considering circular structure.
7476
* This function caches all nested objects and its copies.
@@ -309,11 +311,6 @@ var Store = function Store (options) {
309311
var plugins = options.plugins; if ( plugins === void 0 ) plugins = [];
310312
var strict = options.strict; if ( strict === void 0 ) strict = false;
311313

312-
var state = options.state; if ( state === void 0 ) state = {};
313-
if (typeof state === 'function') {
314-
state = state() || {};
315-
}
316-
317314
// store internal state
318315
this._committing = false;
319316
this._actions = Object.create(null);
@@ -340,6 +337,8 @@ var Store = function Store (options) {
340337
// strict mode
341338
this.strict = strict;
342339

340+
var state = this._modules.root.state;
341+
343342
// init root module.
344343
// this also recursively registers all sub-modules
345344
// and collects all module getters inside this._wrappedGetters
@@ -892,12 +891,26 @@ var createNamespacedHelpers = function (namespace) { return ({
892891
mapActions: mapActions.bind(null, namespace)
893892
}); };
894893

894+
/**
895+
* Normalize the map
896+
* normalizeMap([1, 2, 3]) => [ { key: 1, val: 1 }, { key: 2, val: 2 }, { key: 3, val: 3 } ]
897+
* normalizeMap({a: 1, b: 2, c: 3}) => [ { key: 'a', val: 1 }, { key: 'b', val: 2 }, { key: 'c', val: 3 } ]
898+
* @param {Array|Object} map
899+
* @return {Object}
900+
*/
895901
function normalizeMap (map) {
896902
return Array.isArray(map)
897903
? map.map(function (key) { return ({ key: key, val: key }); })
898904
: Object.keys(map).map(function (key) { return ({ key: key, val: map[key] }); })
899905
}
900906

907+
/**
908+
* Normalize the namespace, and package by fn
909+
* normalizeMap([1, 2, 3]) => [ { key: 1, val: 1 }, { key: 2, val: 2 }, { key: 3, val: 3 } ]
910+
* normalizeMap({a: 1, b: 2, c: 3}) => [ { key: 'a', val: 1 }, { key: 'b', val: 2 }, { key: 'c', val: 3 } ]
911+
* @param {Function} fn
912+
* @return {Function}
913+
*/
901914
function normalizeNamespace (fn) {
902915
return function (namespace, map) {
903916
if (typeof namespace !== 'string') {

0 commit comments

Comments
 (0)