Automated class transform

npx lebab --replace src --transform class
This commit is contained in:
Tim Schaub
2018-07-16 16:18:16 -06:00
parent 60e85e7d89
commit 7b4a73f3b9
145 changed files with 32887 additions and 33714 deletions
+30 -33
View File
@@ -11,40 +11,37 @@ import {isDocument, isNode, parse} from '../xml.js';
* @abstract
* @struct
*/
const XML = function() {
};
class XML {
/**
* @param {Document|Node|string} source Source.
* @return {Object} The parsed result.
*/
read(source) {
if (isDocument(source)) {
return this.readFromDocument(/** @type {Document} */ (source));
} else if (isNode(source)) {
return this.readFromNode(/** @type {Node} */ (source));
} else if (typeof source === 'string') {
const doc = parse(source);
return this.readFromDocument(doc);
} else {
return null;
}
}
/**
* @abstract
* @param {Document} doc Document.
* @return {Object} Object
*/
readFromDocument(doc) {}
/**
* @param {Document|Node|string} source Source.
* @return {Object} The parsed result.
*/
XML.prototype.read = function(source) {
if (isDocument(source)) {
return this.readFromDocument(/** @type {Document} */ (source));
} else if (isNode(source)) {
return this.readFromNode(/** @type {Node} */ (source));
} else if (typeof source === 'string') {
const doc = parse(source);
return this.readFromDocument(doc);
} else {
return null;
}
};
/**
* @abstract
* @param {Node} node Node.
* @return {Object} Object
*/
readFromNode(node) {}
}
/**
* @abstract
* @param {Document} doc Document.
* @return {Object} Object
*/
XML.prototype.readFromDocument = function(doc) {};
/**
* @abstract
* @param {Node} node Node.
* @return {Object} Object
*/
XML.prototype.readFromNode = function(node) {};
export default XML;