Logo
Explore Help
Register Sign In
iLoveElysia/pjax
1
0
Fork 0
You've already forked pjax
Code Issues Pull Requests Actions Packages Projects Releases 9 Wiki Activity
Files
f98f2dd63b48113ff91b6bd8808257bfc723ef6b
pjax/lib/clone.js

13 lines
249 B
JavaScript
Raw Normal View History

Test clone method
2014-05-04 08:33:59 +02:00
module.exports = function(obj) {
Code cleanup (#120) * Lots of code cleanup * Cleanup parse-options tests - Rename objects for clarity and inline unneeded objects - Remove unneeded tests - Use Object.keys().length instead of a custom function - Use typeof === "object" instead of a custom function that checks the prototype tree as well, since we don't expect anything but an object literal. * Remove old switchFallback code * Remove polyfill for Function.prototype.bind * Inline small functions * Add more documentation and tests for options.currentUrlFullReload Closes #17 * Update package.json
2018-02-02 09:52:44 -05:00
if (null === obj || "object" !== typeof obj) {
Test clone method
2014-05-04 08:33:59 +02:00
return obj
}
var copy = obj.constructor()
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) {
copy[attr] = obj[attr]
}
}
return copy
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.25.4 Page: 39ms Template: 10ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API