{"id":1040,"date":"2018-03-06T13:07:07","date_gmt":"2018-03-06T12:07:07","guid":{"rendered":"https:\/\/solidt.eu\/site\/?p=1040"},"modified":"2022-07-25T08:35:45","modified_gmt":"2022-07-25T07:35:45","slug":"javascript-pathjoin-urljoin-merge-object","status":"publish","type":"post","link":"https:\/\/solidt.eu\/site\/javascript-pathjoin-urljoin-merge-object\/","title":{"rendered":"Javascript pathjoin(\/urljoin) + merge object"},"content":{"rendered":"<pre class=\"lang:js decode:true  \">var mergeOptions = (a, b) =&gt; {\r\n    var c = {};\r\n    var at;\r\n    for (at in a) {\r\n        if (a.hasOwnProperty(at)) {\r\n            c[at] = a[at];\r\n        }\r\n    }\r\n    for (at in b) {\r\n        if (b.hasOwnProperty(at)) {\r\n            c[at] = b[at];\r\n        }\r\n    }\r\n    return c;\r\n};\r\n\r\nvar pathJoin = function() {\r\n    var r = [].slice.call(arguments).map(function(s, i, a) {\r\n        s = String(s);\r\n        if(i != 0 &amp;&amp; s.charAt(0) == '\/') s = s.substr(1);\r\n        if(i != a.length-1 &amp;&amp; s.charAt(s.length-1) == '\/') s = s.slice(0, -1);\r\n        return s;\r\n    });\r\n    return r.join('\/');\r\n};<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>var mergeOptions = (a, b) =&gt; { var c = {}; var at; for (at in a) { if (a.hasOwnProperty(at)) { c[at] = a[at]; } } for (at in b) { if (b.hasOwnProperty(at)) { c[at] = b[at]; } } return c; }; var pathJoin = function() { var r = [].slice.call(arguments).map(function(s, i, a) { s [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[5,4],"tags":[],"class_list":["post-1040","post","type-post","status-publish","format-standard","hentry","category-javascript","category-programming"],"_links":{"self":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/1040","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/comments?post=1040"}],"version-history":[{"count":1,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/1040\/revisions"}],"predecessor-version":[{"id":1041,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/1040\/revisions\/1041"}],"wp:attachment":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/media?parent=1040"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/categories?post=1040"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/tags?post=1040"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}