Comparing version 2.5.1 to 2.6.0
@@ -13,2 +13,4 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ltx = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
var is = require('./lib/is') | ||
var clone = require('./lib/clone') | ||
var stringify = require('./lib/stringify') | ||
@@ -28,2 +30,3 @@ exports = module.exports = tag | ||
exports.clone = clone | ||
exports.createElement = createElement | ||
@@ -42,3 +45,5 @@ | ||
},{"./lib/Element":2,"./lib/Parser":3,"./lib/createElement":5,"./lib/equal":6,"./lib/escape":7,"./lib/is":8,"./lib/parse":9,"./lib/tag":11,"./lib/tagString":12}],2:[function(require,module,exports){ | ||
exports.stringify = stringify | ||
},{"./lib/Element":2,"./lib/Parser":3,"./lib/clone":4,"./lib/createElement":5,"./lib/equal":6,"./lib/escape":7,"./lib/is":8,"./lib/parse":9,"./lib/stringify":11,"./lib/tag":12,"./lib/tagString":13}],2:[function(require,module,exports){ | ||
'use strict' | ||
@@ -508,3 +513,3 @@ | ||
},{"./Element":2,"./parsers/ltx":10,"events":13,"inherits":14}],4:[function(require,module,exports){ | ||
},{"./Element":2,"./parsers/ltx":10,"events":14,"inherits":15}],4:[function(require,module,exports){ | ||
'use strict' | ||
@@ -534,3 +539,3 @@ | ||
*/ | ||
module.exports = function createElement (name, attrs /*, child1, child2, ...*/) { | ||
module.exports = function createElement (name, attrs /*, child1, child2, ... */) { | ||
var el = new Element(name, attrs) | ||
@@ -875,5 +880,39 @@ | ||
},{"../escape":7,"events":13,"inherits":14}],11:[function(require,module,exports){ | ||
},{"../escape":7,"events":14,"inherits":15}],11:[function(require,module,exports){ | ||
'use strict' | ||
function stringify (el, indent, level) { | ||
if (typeof indent === 'number') indent = ' '.repeat(indent) | ||
if (!level) level = 1 | ||
var s = '' | ||
s += '<' + el.name | ||
Object.keys(el.attrs).forEach((k) => { | ||
s += ' ' + k + '=' + '"' + el.attrs[k] + '"' | ||
}) | ||
if (el.children.length) { | ||
s += '>' | ||
el.children.forEach((child, i) => { | ||
if (indent) s += '\n' + indent.repeat(level) | ||
if (typeof child === 'string') { | ||
s += child | ||
} else { | ||
s += stringify(child, indent, level + 1) | ||
} | ||
}) | ||
if (indent) s += '\n' + indent.repeat(level - 1) | ||
s += '</' + el.name + '>' | ||
} else { | ||
s += '/>' | ||
} | ||
return s | ||
} | ||
module.exports = stringify | ||
},{}],12:[function(require,module,exports){ | ||
'use strict' | ||
var tagString = require('./tagString') | ||
@@ -886,3 +925,3 @@ var parse = require('./parse') | ||
},{"./parse":9,"./tagString":12}],12:[function(require,module,exports){ | ||
},{"./parse":9,"./tagString":13}],13:[function(require,module,exports){ | ||
'use strict' | ||
@@ -906,3 +945,3 @@ | ||
},{"./escape":7}],13:[function(require,module,exports){ | ||
},{"./escape":7}],14:[function(require,module,exports){ | ||
// Copyright Joyent, Inc. and other Node contributors. | ||
@@ -1211,3 +1250,3 @@ // | ||
},{}],14:[function(require,module,exports){ | ||
},{}],15:[function(require,module,exports){ | ||
if (typeof Object.create === 'function') { | ||
@@ -1214,0 +1253,0 @@ // implementation from standard node.js 'util' module |
@@ -12,2 +12,4 @@ 'use strict' | ||
var is = require('./lib/is') | ||
var clone = require('./lib/clone') | ||
var stringify = require('./lib/stringify') | ||
@@ -27,2 +29,3 @@ exports = module.exports = tag | ||
exports.clone = clone | ||
exports.createElement = createElement | ||
@@ -40,1 +43,3 @@ | ||
exports.tagString = tagString | ||
exports.stringify = stringify |
@@ -13,3 +13,3 @@ 'use strict' | ||
*/ | ||
module.exports = function createElement (name, attrs /*, child1, child2, ...*/) { | ||
module.exports = function createElement (name, attrs /*, child1, child2, ... */) { | ||
var el = new Element(name, attrs) | ||
@@ -16,0 +16,0 @@ |
@@ -110,3 +110,3 @@ 'use strict' | ||
DOMElement.createElement = function (name, attrs /*, child1, child2, ...*/) { | ||
DOMElement.createElement = function (name, attrs /*, child1, child2, ... */) { | ||
var el = new DOMElement(name, attrs) | ||
@@ -113,0 +113,0 @@ |
{ | ||
"name": "ltx", | ||
"version": "2.5.1", | ||
"version": "2.6.0", | ||
"description": "<xml for=\"JavaScript\">", | ||
@@ -35,9 +35,9 @@ "author": "Astro", | ||
"libxmljs": "^0.18.0", | ||
"microtime": "^2.0.0", | ||
"microtime": "^2.1.2", | ||
"node-expat": "^2.3.13", | ||
"node-xml": "^1.0.2", | ||
"sax": "^1.1.5", | ||
"standard": "^7.1.2", | ||
"standard": "^8.5.0", | ||
"vows": "^0.8.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
121230
24
2158