Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ServiceNow Rhino fail #2

Open
andersonk17474 opened this issue Nov 2, 2015 · 0 comments
Open

ServiceNow Rhino fail #2

andersonk17474 opened this issue Nov 2, 2015 · 0 comments

Comments

@andersonk17474
Copy link

This is nice little function. I ran into an issue when trying to use this in a server-side environment. This is directed at a tiny user group, but it may help someone. The javascript Rhino engine ServiceNow uses is rather old. Like pre ECMA 3. This function needs an extra check, as the first line checking the object type for param 'a' will not copy an object from 'b' when the key doesn't exist in 'a'.

if ((Object.prototype.toString.call(a[key]) == '[object Object]') && (!a.hasOwnProperty(key))){
       a[key] = extend({}, b[key]);
}
else if (Object.prototype.toString.call(a[key]) != '[object Object]') {
      a[key] = b[key];
 } else {
       a[key] = extend(a[key], b[key]);
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant