Use Object.assign instead of xtend (#616)
As described by #563: > https://polyfill.io provides a fallback for browsers that don't support it, so for most people this will be a strict improvement.
This commit is contained in:
@@ -8,7 +8,6 @@ var nanohref = require('nanohref')
|
|||||||
var nanoraf = require('nanoraf')
|
var nanoraf = require('nanoraf')
|
||||||
var nanobus = require('nanobus')
|
var nanobus = require('nanobus')
|
||||||
var assert = require('assert')
|
var assert = require('assert')
|
||||||
var xtend = require('xtend')
|
|
||||||
|
|
||||||
var Cache = require('./component/cache')
|
var Cache = require('./component/cache')
|
||||||
|
|
||||||
@@ -52,7 +51,7 @@ function Choo (opts) {
|
|||||||
}
|
}
|
||||||
if (this._hasWindow) {
|
if (this._hasWindow) {
|
||||||
this.state = window.initialState
|
this.state = window.initialState
|
||||||
? xtend(window.initialState, _state)
|
? Object.assign({}, window.initialState, _state)
|
||||||
: _state
|
: _state
|
||||||
delete window.initialState
|
delete window.initialState
|
||||||
} else {
|
} else {
|
||||||
@@ -204,7 +203,7 @@ Choo.prototype.mount = function mount (selector) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Choo.prototype.toString = function (location, state) {
|
Choo.prototype.toString = function (location, state) {
|
||||||
this.state = xtend(this.state, state || {})
|
Object.assign(this.state, state || {})
|
||||||
|
|
||||||
assert.notEqual(typeof window, 'object', 'choo.mount: window was found. .toString() must be called in Node, use .start() or .mount() if running in the browser')
|
assert.notEqual(typeof window, 'object', 'choo.mount: window was found. .toString() must be called in Node, use .start() or .mount() if running in the browser')
|
||||||
assert.equal(typeof location, 'string', 'choo.toString: location should be type string')
|
assert.equal(typeof location, 'string', 'choo.toString: location should be type string')
|
||||||
|
|||||||
+1
-2
@@ -50,8 +50,7 @@
|
|||||||
"nanoraf": "^3.0.0",
|
"nanoraf": "^3.0.0",
|
||||||
"nanorouter": "^3.0.1",
|
"nanorouter": "^3.0.1",
|
||||||
"nanotiming": "^7.0.0",
|
"nanotiming": "^7.0.0",
|
||||||
"scroll-to-anchor": "^1.0.0",
|
"scroll-to-anchor": "^1.0.0"
|
||||||
"xtend": "^4.0.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tap-format/spec": "^0.2.0",
|
"@tap-format/spec": "^0.2.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user