Skip to content

Commit

Permalink
remove deprecated functions
Browse files Browse the repository at this point in the history
Now there's only `build()` and `parse()`!

They've been deprecated for a long time now, and this should
resolve #77 as well.
  • Loading branch information
TooTallNate committed Aug 16, 2016
1 parent 18d3be9 commit 90deef5
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 128 deletions.
13 changes: 13 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Parser functions.
*/

var parserFunctions = require('./lib/parse');
Object.keys(parserFunctions).forEach(function (k) { exports[k] = parserFunctions[k]; });

/**
* Builder functions.
*/

var builderFunctions = require('./lib/build');
Object.keys(builderFunctions).forEach(function (k) { exports[k] = builderFunctions[k]; });
1 change: 0 additions & 1 deletion lib/build.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/**
* Module dependencies.
*/
Expand Down
49 changes: 0 additions & 49 deletions lib/node.js

This file was deleted.

52 changes: 0 additions & 52 deletions lib/parse.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@

/**
* Module dependencies.
*/

var deprecate = require('util-deprecate');
var DOMParser = require('xmldom').DOMParser;

/**
* Module exports.
*/

exports.parse = parse;
exports.parseString = deprecate(parseString, '`parseString()` is deprecated. ' +
'It\'s not actually async. Use `parse()` instead.');
exports.parseStringSync = deprecate(parseStringSync, '`parseStringSync()` is ' +
'deprecated. Use `parse()` instead.');

/**
* We ignore raw text (usually whitespace), <!-- xml comments -->,
Expand Down Expand Up @@ -71,52 +65,6 @@ function parse (xml) {
return plist;
}

/**
* Parses a Plist XML string. Returns an Object. Takes a `callback` function.
*
* @param {String} xml - the XML String to decode
* @param {Function} callback - callback function
* @returns {Mixed} the decoded value from the Plist XML
* @api public
* @deprecated not actually async. use parse() instead
*/

function parseString (xml, callback) {
var doc, error, plist;
try {
doc = new DOMParser().parseFromString(xml);
plist = parsePlistXML(doc.documentElement);
} catch(e) {
error = e;
}
callback(error, plist);
}

/**
* Parses a Plist XML string. Returns an Object.
*
* @param {String} xml - the XML String to decode
* @param {Function} callback - callback function
* @returns {Mixed} the decoded value from the Plist XML
* @api public
* @deprecated use parse() instead
*/

function parseStringSync (xml) {
var doc = new DOMParser().parseFromString(xml);
var plist;
if (doc.documentElement.nodeName !== 'plist') {
throw new Error('malformed document. First element should be <plist>');
}
plist = parsePlistXML(doc.documentElement);

// if the plist is an array with 1 element, pull it out of the array
if (plist.length == 1) {
plist = plist[0];
}
return plist;
}

/**
* Convert an XML based plist document into a JSON representation.
*
Expand Down
23 changes: 0 additions & 23 deletions lib/plist.js

This file was deleted.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@
"parser",
"xml"
],
"main": "lib/plist.js",
"main": "index.js",
"dependencies": {
"base64-js": "1.1.2",
"xmlbuilder": "8.2.2",
"xmldom": "0.1.x",
"util-deprecate": "1.0.2"
"xmldom": "0.1.x"
},
"devDependencies": {
"browserify": "13.0.1",
Expand Down

0 comments on commit 90deef5

Please sign in to comment.