Socket
Socket
Sign inDemoInstall

xmlbuilder

Package Overview
Dependencies
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xmlbuilder - npm Package Compare versions

Comparing version 8.1.0 to 8.2.0

lib/Utility.js

15

CHANGELOG.md

@@ -5,5 +5,12 @@ # Change Log

## [8.2.0] - 2016-04-01
- Removed lodash dependency to keep the library small and simple. See
[#114](https://github.com/oozcitak/xmlbuilder-js/issues/114),
[#53](https://github.com/oozcitak/xmlbuilder-js/issues/53),
and [#43](https://github.com/oozcitak/xmlbuilder-js/issues/43).
- Added title case to name conversion options.
## [8.1.0] - 2016-03-29
- Added the callback option to the `begin` export function. When used with a
calback function, the XML document will be generated in chunks and each chunk
callback function, the XML document will be generated in chunks and each chunk
will be passed to the supplied function. In this mode, `begin` uses a different

@@ -27,5 +34,2 @@ code path and the builder should use much less memory since the entire XML tree

- Added the ability to add comments and processing instructions before and after the root element. Added `commentBefore`, `commentAfter`, `instructionBefore` and `instructionAfter` functions for this purpose.
- Dropped support for old node.js releases. Minimum required node.js version is now 4.0.
## [8.0.0] - 2016-03-25

@@ -314,4 +318,5 @@ - Added the `begin` export function. See the wiki for details.

## 0.0.1 - 2010-11-02
- Initial release
- Initial
[8.2.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v8.1.0...v8.2.0
[8.1.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v8.0.0...v8.1.0

@@ -318,0 +323,0 @@ [8.0.0]: https://github.com/oozcitak/xmlbuilder-js/compare/v7.0.0...v8.0.0

// Generated by CoffeeScript 1.10.0
(function() {
var XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction;
var XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref;
isFunction = require('lodash/isFunction');
ref = require('./Utility'), assign = ref.assign, isFunction = ref.isFunction;
assign = require('lodash/assign');
XMLDocument = require('./XMLDocument');

@@ -35,5 +33,5 @@

module.exports.begin = function(options, onData, onEnd) {
var ref;
var ref1;
if (isFunction(options)) {
ref = [options, onData], onData = ref[0], onEnd = ref[1];
ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1];
options = {};

@@ -40,0 +38,0 @@ }

@@ -7,3 +7,3 @@ // Generated by CoffeeScript 1.10.0

isObject = require('lodash/isObject');
isObject = require('./Utility').isObject;

@@ -10,0 +10,0 @@ XMLNode = require('./XMLNode');

@@ -7,3 +7,3 @@ // Generated by CoffeeScript 1.10.0

isObject = require('lodash/isObject');
isObject = require('./Utility').isObject;

@@ -10,0 +10,0 @@ XMLNode = require('./XMLNode');

@@ -7,3 +7,3 @@ // Generated by CoffeeScript 1.10.0

isPlainObject = require('lodash/isPlainObject');
isPlainObject = require('./Utility').isPlainObject;

@@ -10,0 +10,0 @@ XMLNode = require('./XMLNode');

// Generated by CoffeeScript 1.10.0
(function() {
var XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, isFunction, isObject, isPlainObject,
var XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, isFunction, isObject, isPlainObject, ref,
hasProp = {}.hasOwnProperty;
isObject = require('lodash/isObject');
ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject;
isPlainObject = require('lodash/isPlainObject');
isFunction = require('lodash/isFunction');
XMLElement = require('./XMLElement');

@@ -66,3 +62,3 @@

XMLDocumentCB.prototype.node = function(name, attributes, text) {
var ref;
var ref1;
if (name == null) {

@@ -79,3 +75,3 @@ throw new Error("Missing node name");

if (!isObject(attributes)) {
ref = [attributes, text], text = ref[0], attributes = ref[1];
ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];
}

@@ -82,0 +78,0 @@ this.currentNode = new XMLElement(this, name, attributes);

@@ -7,3 +7,3 @@ // Generated by CoffeeScript 1.10.0

isObject = require('lodash/isObject');
isObject = require('./Utility').isObject;

@@ -10,0 +10,0 @@ XMLNode = require('./XMLNode');

// Generated by CoffeeScript 1.10.0
(function() {
var XMLAttribute, XMLElement, XMLNode, isFunction, isObject,
var XMLAttribute, XMLElement, XMLNode, isFunction, isObject, ref,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
isObject = require('lodash/isObject');
ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction;
isFunction = require('lodash/isFunction');
XMLNode = require('./XMLNode');

@@ -36,3 +34,3 @@

XMLElement.prototype.clone = function() {
var att, attName, clonedSelf, ref;
var att, attName, clonedSelf, ref1;
clonedSelf = Object.create(this);

@@ -43,6 +41,6 @@ if (clonedSelf.isRoot) {

clonedSelf.attributes = {};
ref = this.attributes;
for (attName in ref) {
if (!hasProp.call(ref, attName)) continue;
att = ref[attName];
ref1 = this.attributes;
for (attName in ref1) {
if (!hasProp.call(ref1, attName)) continue;
att = ref1[attName];
clonedSelf.attributes[attName] = att.clone();

@@ -49,0 +47,0 @@ }

// Generated by CoffeeScript 1.10.0
(function() {
var XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLElement, XMLNode, XMLProcessingInstruction, XMLRaw, XMLText, isEmpty, isFunction, isObject,
var XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLElement, XMLNode, XMLProcessingInstruction, XMLRaw, XMLText, isEmpty, isFunction, isObject, ref,
hasProp = {}.hasOwnProperty;
isObject = require('lodash/isObject');
ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction, isEmpty = ref.isEmpty;
isFunction = require('lodash/isFunction');
isEmpty = require('lodash/isEmpty');
XMLElement = null;

@@ -49,3 +45,3 @@

XMLNode.prototype.element = function(name, attributes, text) {
var childNode, item, j, k, key, lastChild, len, len1, ref, val;
var childNode, item, j, k, key, lastChild, len, len1, ref1, val;
lastChild = null;

@@ -55,3 +51,3 @@ attributes || (attributes = {});

if (!isObject(attributes)) {
ref = [attributes, text], text = ref[0], attributes = ref[1];
ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];
}

@@ -140,3 +136,3 @@ if (name != null) {

XMLNode.prototype.remove = function() {
var i, ref;
var i, ref1;
if (this.isRoot) {

@@ -146,3 +142,3 @@ throw new Error("Cannot remove the root element");

i = this.parent.children.indexOf(this);
[].splice.apply(this.parent.children, [i, i - i + 1].concat(ref = [])), ref;
[].splice.apply(this.parent.children, [i, i - i + 1].concat(ref1 = [])), ref1;
return this.parent;

@@ -152,3 +148,3 @@ };

XMLNode.prototype.node = function(name, attributes, text) {
var child, ref;
var child, ref1;
if (name != null) {

@@ -160,3 +156,3 @@ name = name.valueOf();

if (!isObject(attributes)) {
ref = [attributes, text], text = ref[0], attributes = ref[1];
ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];
}

@@ -277,8 +273,8 @@ child = new XMLElement(this, name, attributes);

XMLNode.prototype.doctype = function(pubID, sysID) {
var child, doc, doctype, i, j, k, len, len1, ref, ref1;
var child, doc, doctype, i, j, k, len, len1, ref1, ref2;
doc = this.document();
doctype = new XMLDocType(doc, pubID, sysID);
ref = doc.children;
for (i = j = 0, len = ref.length; j < len; i = ++j) {
child = ref[i];
ref1 = doc.children;
for (i = j = 0, len = ref1.length; j < len; i = ++j) {
child = ref1[i];
if (child instanceof XMLDocType) {

@@ -289,5 +285,5 @@ doc.children[i] = doctype;

}
ref1 = doc.children;
for (i = k = 0, len1 = ref1.length; k < len1; i = ++k) {
child = ref1[i];
ref2 = doc.children;
for (i = k = 0, len1 = ref2.length; k < len1; i = ++k) {
child = ref2[i];
if (child.isRoot) {

@@ -294,0 +290,0 @@ doc.children.splice(i, 0, doctype);

// Generated by CoffeeScript 1.10.0
(function() {
var XMLStringifier, camelCase, kebabCase, snakeCase,
var XMLStringifier, camelCase, kebabCase, ref, snakeCase, titleCase,
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
hasProp = {}.hasOwnProperty;
camelCase = require('lodash/camelCase');
ref = require('./Utility'), camelCase = ref.camelCase, titleCase = ref.titleCase, kebabCase = ref.kebabCase, snakeCase = ref.snakeCase;
kebabCase = require('lodash/kebabCase');
snakeCase = require('lodash/snakeCase');
module.exports = XMLStringifier = (function() {
function XMLStringifier(options) {
this.assertLegalChar = bind(this.assertLegalChar, this);
var key, ref, value;
var key, ref1, value;
options || (options = {});

@@ -21,6 +17,6 @@ this.allowSurrogateChars = options.allowSurrogateChars;

this.textCase = options.textCase;
ref = options.stringify || {};
for (key in ref) {
if (!hasProp.call(ref, key)) continue;
value = ref[key];
ref1 = options.stringify || {};
for (key in ref1) {
if (!hasProp.call(ref1, key)) continue;
value = ref1[key];
this[key] = value;

@@ -167,2 +163,4 @@ }

return camelCase(str);
case "title":
return titleCase(str);
case "kebab":

@@ -169,0 +167,0 @@ case "lower":

{
"name": "xmlbuilder",
"version": "8.1.0",
"version": "8.2.0",
"keywords": [

@@ -24,5 +24,3 @@ "xml",

},
"dependencies": {
"lodash": "^4.0.0"
},
"dependencies": {},
"devDependencies": {

@@ -29,0 +27,0 @@ "coffee-script": "*",

# xmlbuilder-js
An XML builder for [node.js](https://nodejs.org/) similar to
An XML builder for [node.js](https://nodejs.org/) similar to
[java-xmlbuilder](https://github.com/jmurty/java-xmlbuilder).

@@ -11,3 +11,2 @@

[![Build Status](http://img.shields.io/travis/oozcitak/xmlbuilder-js.svg?style=flat-square)](http://travis-ci.org/oozcitak/xmlbuilder-js)
[![Dependency Status](http://img.shields.io/david/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://david-dm.org/oozcitak/xmlbuilder-js)
[![Dev Dependency Status](http://img.shields.io/david/dev/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://david-dm.org/oozcitak/xmlbuilder-js)

@@ -30,3 +29,3 @@ [![Code Coverage](https://img.shields.io/coveralls/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://coveralls.io/github/oozcitak/xmlbuilder-js)

.end({ pretty: true});
console.log(xml);

@@ -33,0 +32,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc