loadUrl enhancements (#134)
`loadUrl` enhancements - Make `options` parameter optional - Allow partial overriding of instance options when calling `loadUrl` directly - Make `requestOptions` optional - Document `loadUrl` usage and provide examples
This commit was merged in pull request #134.
This commit is contained in:
12
lib/util/clone.js
Normal file
12
lib/util/clone.js
Normal file
@@ -0,0 +1,12 @@
|
||||
module.exports = function(obj) {
|
||||
if (null === obj || "object" !== typeof obj) {
|
||||
return obj
|
||||
}
|
||||
var copy = obj.constructor()
|
||||
for (var attr in obj) {
|
||||
if (obj.hasOwnProperty(attr)) {
|
||||
copy[attr] = obj[attr]
|
||||
}
|
||||
}
|
||||
return copy
|
||||
}
|
||||
21
lib/util/extend.js
Normal file
21
lib/util/extend.js
Normal file
@@ -0,0 +1,21 @@
|
||||
module.exports = function(target) {
|
||||
if (target == null) {
|
||||
return target
|
||||
}
|
||||
|
||||
var to = Object(target)
|
||||
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i]
|
||||
|
||||
if (source != null) {
|
||||
for (var key in source) {
|
||||
// Avoid bugs when hasOwnProperty is shadowed
|
||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||
to[key] = source[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return to
|
||||
}
|
||||
Reference in New Issue
Block a user