Permalink
Browse files

deep_merge is evil

  • Loading branch information...
1 parent ad7893b commit 719f992e9c89fdc94479e76b0a767737742293db @dodo committed Jun 7, 2012
Showing with 2 additions and 16 deletions.
  1. +1 −13 src/util.coffee
  2. +1 −3 src/xml.coffee
View
@@ -1,18 +1,6 @@
{ isArray } = Array
-deep_merge = (objs...) ->
- objs = objs[0] if isArray(objs[0])
- res = {}
- for obj in objs
- for k, v of obj
- if typeof(v) is 'object' and not isArray(v)
- res[k] = deep_merge(res[k] or {}, v)
- else
- res[k] = v
- res
-
-
indent = ({level, pretty}) ->
return "" if not pretty or level is 0
pretty = " " if pretty is on
@@ -52,4 +40,4 @@ safe = (text) ->
.replace(/"/g, '"')
-module.exports = { deep_merge, prettify, indent, new_attrs, safe }
+module.exports = { prettify, indent, new_attrs, safe }
View
@@ -87,9 +87,7 @@ add_tag = (newtag, callback) ->
new_tag = ->
[name, attrs, children, opts] = parse_args arguments...
opts.level ?= @level+1
-
- # possibility to overwrite existing opts, like pretty
- opts = deep_merge (@builder?.opts ? {}), opts
+ opts.pretty ?= @builder?.opts.pretty
opts.builder = @builder
TagInstance = @builder?.Tag ? Tag

0 comments on commit 719f992

Please sign in to comment.