Comparing version 2.3.0 to 2.3.1
@@ -10,2 +10,3 @@ /** | ||
collapsed?: boolean; | ||
filter?: <P extends Payload>(mutation: P, stateBefore: S, stateAfter: S) => boolean; | ||
transformer?: (state: S) => any; | ||
@@ -12,0 +13,0 @@ mutationTransformer?: <P extends Payload>(mutation: P) => any; |
{ | ||
"name": "vuex", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"description": "state management for Vue.js", | ||
@@ -5,0 +5,0 @@ "main": "dist/vuex.js", |
@@ -7,2 +7,3 @@ // Credits: borrowed code from fcomb/redux-logger | ||
collapsed = true, | ||
filter = (mutation, stateBefore, stateAfter) => true, | ||
transformer = state => state, | ||
@@ -19,25 +20,28 @@ mutationTransformer = mut => mut | ||
const nextState = deepCopy(state) | ||
const time = new Date() | ||
const formattedTime = ` @ ${pad(time.getHours(), 2)}:${pad(time.getMinutes(), 2)}:${pad(time.getSeconds(), 2)}.${pad(time.getMilliseconds(), 3)}` | ||
const formattedMutation = mutationTransformer(mutation) | ||
const message = `mutation ${mutation.type}${formattedTime}` | ||
const startMessage = collapsed | ||
? console.groupCollapsed | ||
: console.group | ||
// render | ||
try { | ||
startMessage.call(console, message) | ||
} catch (e) { | ||
console.log(message) | ||
} | ||
if (filter(mutation, prevState, nextState)) { | ||
const time = new Date() | ||
const formattedTime = ` @ ${pad(time.getHours(), 2)}:${pad(time.getMinutes(), 2)}:${pad(time.getSeconds(), 2)}.${pad(time.getMilliseconds(), 3)}` | ||
const formattedMutation = mutationTransformer(mutation) | ||
const message = `mutation ${mutation.type}${formattedTime}` | ||
const startMessage = collapsed | ||
? console.groupCollapsed | ||
: console.group | ||
console.log('%c prev state', 'color: #9E9E9E; font-weight: bold', transformer(prevState)) | ||
console.log('%c mutation', 'color: #03A9F4; font-weight: bold', formattedMutation) | ||
console.log('%c next state', 'color: #4CAF50; font-weight: bold', transformer(nextState)) | ||
// render | ||
try { | ||
startMessage.call(console, message) | ||
} catch (e) { | ||
console.log(message) | ||
} | ||
try { | ||
console.groupEnd() | ||
} catch (e) { | ||
console.log('—— log end ——') | ||
console.log('%c prev state', 'color: #9E9E9E; font-weight: bold', transformer(prevState)) | ||
console.log('%c mutation', 'color: #03A9F4; font-weight: bold', formattedMutation) | ||
console.log('%c next state', 'color: #4CAF50; font-weight: bold', transformer(nextState)) | ||
try { | ||
console.groupEnd() | ||
} catch (e) { | ||
console.log('—— log end ——') | ||
} | ||
} | ||
@@ -44,0 +48,0 @@ |
@@ -14,3 +14,2 @@ import applyMixin from './mixin' | ||
const { | ||
state = {}, | ||
plugins = [], | ||
@@ -20,2 +19,9 @@ strict = false | ||
let { | ||
state = {} | ||
} = options | ||
if (typeof state === 'function') { | ||
state = state() | ||
} | ||
// store internal state | ||
@@ -22,0 +28,0 @@ this._committing = false |
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
91426
2357