Comparing version 2.0.0 to 2.0.1
@@ -0,7 +1,18 @@ | ||
2.0.1 / 2016-08-16 | ||
================== | ||
* [[`de136c8388`](https://github.com/TooTallNate/plist/commit/de136c8388)] - bad npm release… (Nathan Rajlich) | ||
2.0.0 / 2016-08-16 | ||
================== | ||
* [[`d50087ca68`](https://github.com/TooTallNate/plist/commit/d50087ca68)] - remove deprecated functions (Nathan Rajlich) | ||
* [[`90deef5d43`](https://github.com/TooTallNate/plist/commit/90deef5d43)] - remove deprecated functions (Nathan Rajlich) | ||
* [[`d475cd8ce9`](https://github.com/TooTallNate/plist/commit/d475cd8ce9)] - Added travis ci support for node 6 (Amila Welihinda) | ||
* [[`04c8ee7646`](https://github.com/TooTallNate/plist/commit/04c8ee7646)] - update dependencies (Mitchell Hentges) | ||
* [[`97c02b3f05`](https://github.com/TooTallNate/plist/commit/97c02b3f05)] - **travis**: add `sudo: false` and test more node versions (Nathan Rajlich) | ||
* [[`4afb7c5079`](https://github.com/TooTallNate/plist/commit/4afb7c5079)] - fix `Cannot read property 'nodeValue' of undefined` exception that is thrown when a `<key></key>` construct appears in plist (Chris Kinsman) | ||
* [[`54c821ec29`](https://github.com/TooTallNate/plist/commit/54c821ec29)] - #71 - fixed and added test (Andrew Goldis) | ||
* [[`4afb7c5079`](https://github.com/TooTallNate/plist/commit/4afb7c5079)] - fix `Cannot read property 'nodeValue' of undefined exception` that is thrown when a `<key></key>` construct appears in plist (Chris Kinsman) | ||
* [[`f360d7d685`](https://github.com/TooTallNate/plist/commit/f360d7d685)] - #66 - fixed empty keys and added tests (Andrew Goldis) | ||
* [[`421c7f26e9`](https://github.com/TooTallNate/plist/commit/421c7f26e9)] - #66 - fixed empty key (Andrew Goldis) | ||
* [[`a88aa4dca7`](https://github.com/TooTallNate/plist/commit/a88aa4dca7)] - add verbose examples (mrzmyr) | ||
@@ -8,0 +19,0 @@ 1.2.0 / 2015-11-10 |
@@ -28,2 +28,19 @@ /** | ||
/** | ||
* Check if the node is empty. Some plist file has such node: | ||
* <key /> | ||
* this node shoud be ignored. | ||
* | ||
* @see https://github.com/TooTallNate/plist.js/issues/66 | ||
* @param {Element} node | ||
* @returns {Boolean} | ||
* @api private | ||
*/ | ||
function isEmptyNode(node){ | ||
if(!node.childNodes || node.childNodes.length === 0) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
@@ -107,2 +124,3 @@ /** | ||
} else if (node.nodeName === 'key') { | ||
if(isEmptyNode(node)) return null; | ||
res = ''; | ||
@@ -113,5 +131,5 @@ if(node.childNodes[0]) { | ||
return res; | ||
} else if (node.nodeName === 'string') { | ||
res = ''; | ||
if(isEmptyNode(node)) return null; | ||
for (d=0; d < node.childNodes.length; d++) { | ||
@@ -118,0 +136,0 @@ res += node.childNodes[d].nodeValue; |
{ | ||
"name": "plist", | ||
"description": "Mac OS X Plist parser/builder for Node.js and browsers", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"author": "Nathan Rajlich <nathan@tootallnate.net>", | ||
@@ -28,11 +28,11 @@ "contributors": [ | ||
"dependencies": { | ||
"base64-js": "0.0.8", | ||
"xmlbuilder": "4.0.0", | ||
"base64-js": "1.1.2", | ||
"xmlbuilder": "8.2.2", | ||
"xmldom": "0.1.x" | ||
}, | ||
"devDependencies": { | ||
"browserify": "12.0.1", | ||
"mocha": "2.3.3", | ||
"browserify": "13.0.1", | ||
"mocha": "2.4.5", | ||
"multiline": "1.0.2", | ||
"zuul": "3.7.2" | ||
"zuul": "3.10.1" | ||
}, | ||
@@ -39,0 +39,0 @@ "scripts": { |
@@ -72,4 +72,30 @@ plist.js | ||
var obj = plist.parse('<plist><string>Hello World!</string></plist>'); | ||
console.log(obj); // Hello World! | ||
var xml = | ||
'<?xml version="1.0" encoding="UTF-8"?>' + | ||
'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">' + | ||
'<plist version="1.0">' + | ||
'<key>metadata</key>' + | ||
'<dict>' + | ||
'<key>bundle-identifier</key>' + | ||
'<string>com.company.app</string>' + | ||
'<key>bundle-version</key>' + | ||
'<string>0.1.1</string>' + | ||
'<key>kind</key>' + | ||
'<string>software</string>' + | ||
'<key>title</key>' + | ||
'<string>AppName</string>' + | ||
'</dict>' + | ||
'</plist>'; | ||
console.log(plist.parse(xml)); | ||
// [ | ||
// "metadata", | ||
// { | ||
// "bundle-identifier": "com.company.app", | ||
// "bundle-version": "0.1.1", | ||
// "kind": "software", | ||
// "title": "AppName" | ||
// } | ||
// ] | ||
``` | ||
@@ -85,6 +111,31 @@ | ||
console.log(plist.build({ foo: 'bar' })); | ||
var json = [ | ||
"metadata", | ||
{ | ||
"bundle-identifier": "com.company.app", | ||
"bundle-version": "0.1.1", | ||
"kind": "software", | ||
"title": "AppName" | ||
} | ||
]; | ||
console.log(plist.build(json)); | ||
// <?xml version="1.0" encoding="UTF-8"?> | ||
// <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
// <plist version="1.0"> | ||
// <key>metadata</key> | ||
// <dict> | ||
// <key>bundle-identifier</key> | ||
// <string>com.company.app</string> | ||
// <key>bundle-version</key> | ||
// <string>0.1.1</string> | ||
// <key>kind</key> | ||
// <string>software</string> | ||
// <key>title</key> | ||
// <string>AppName</string> | ||
// </dict> | ||
// </plist> | ||
``` | ||
## License | ||
@@ -91,0 +142,0 @@ |
Sorry, the diff of this file is not supported yet
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
492466
14393
165
+ Addedbase64-js@1.1.2(transitive)
+ Addedxmlbuilder@8.2.2(transitive)
- Removedbase64-js@0.0.8(transitive)
- Removedlodash@3.10.1(transitive)
- Removedxmlbuilder@4.0.0(transitive)
Updatedbase64-js@1.1.2
Updatedxmlbuilder@8.2.2