Permalink
Browse files

Make `safeLoad` options optional. Closes #61

  • Loading branch information...
1 parent a29c298 commit fcb2d2e3126424b993998e08be160b4e5a8658f0 @dervus dervus committed Feb 9, 2013
Showing with 8 additions and 4 deletions.
  1. +8 −4 lib/js-yaml/common.js
View
@@ -47,11 +47,15 @@ function getOption(options, name, alternative) {
function extend(target, source) {
- var index, length, key, sourceKeys = Object.keys(source);
+ var index, length, key, sourceKeys;
- for (index = 0, length = sourceKeys.length; index < length; index += 1) {
- key = sourceKeys[index];
- target[key] = source[key];
+ if (source) {
+ sourceKeys = Object.keys(source);
+
+ for (index = 0, length = sourceKeys.length; index < length; index += 1) {
+ key = sourceKeys[index];
+ target[key] = source[key];
+ }
}
return target;

0 comments on commit fcb2d2e

Please sign in to comment.