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
a42ae57448d4fedfad05ada8b69ae1413fb118ee
pjax/lib/util/clone.js

14 lines
276 B
JavaScript
Raw Normal View History

Test clone method
2014-05-04 08:33:59 +02:00
module.exports = function(obj) {
Ignore lines from coverage if they can't be tested
2018-03-20 18:43:34 -04:00
/* istanbul ignore if */
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: 32ms Template: 3ms
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