Skip to content

Commit

Permalink
Move user-facing document explanation approach out of library
Browse files Browse the repository at this point in the history
  • Loading branch information
simonrepp committed Dec 11, 2018
1 parent ea42b9f commit a251ce1
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 70 deletions.
4 changes: 0 additions & 4 deletions lib/elements/field.js
Expand Up @@ -68,10 +68,6 @@ class Field {
return 'Field';
}

// explain(indentation = '') {
// return `${indentation}${this.context.messages.inspection.value} ${this._value} (${this.name})`;
// }

error(message) {
if(typeof message === 'function') {
message = message({ name: this.name, value: this._value });
Expand Down
12 changes: 0 additions & 12 deletions lib/elements/fieldset.js
Expand Up @@ -152,18 +152,6 @@ class Fieldset {
return element.value(loader, { enforceValue: options.enforceValue });
}

// explain(indentation = '') {
// const results = [`${indentation}${this.name}`];
//
// indentation += ' ';
//
// for(let [name, entry] of Object.entries(this.entries)) {
// results.push(`${indentation}${name} = ${entry.value()}`);
// }
//
// return results.join('\n');
// }

raw() {
return {
[this.name]: this._entries.map(entry => ({ [entry.name]: entry.value() }))
Expand Down
12 changes: 0 additions & 12 deletions lib/elements/list.js
Expand Up @@ -33,18 +33,6 @@ class List {
return this._items;
}

// explain(indentation = '') {
// const results = [`${indentation}${this.name}`];
//
// indentation += ' ';
//
// for(let item of this._items) {
// results.push(`${indentation}${item.value}`);
// }
//
// return results.join('\n');
// }

items(...optional) {
const options = {
elements: false,
Expand Down
42 changes: 0 additions & 42 deletions lib/elements/section.js
Expand Up @@ -5,7 +5,6 @@ const Fieldset = require('./fieldset.js');
const List = require('./list.js');
const loaders = require('../loaders.js');

// TODO: Investigate and possibly follow .explain() public audience (translated) debug output track :)
// TODO: For each value store the representational type as well ? (e.g. string may come from "- foo" or -- foo\nxxx\n-- foo) and use that for precise error messages?

class Section {
Expand Down Expand Up @@ -343,47 +342,6 @@ class Section {
});
}

// explain(indentation = '') {
// const results = [];
//
// if(this.name === '<>#:=|\\_ENO_DOCUMENT') {
// results.push(`${indentation}${this.context.messages.inspection.document}`);
// } else {
// results.push(`${indentation}${'#'.repeat(this.depth)} ${this.name}`);
// }
//
// indentation += ' ';
//
// for(let element of this._elements) {
// if(element instanceof Empty) {
// results.push(`${indentation}${this.context.messages.inspection.empty} ${element.name}`);
// continue;
// }
//
// if(element instanceof Field) {
// results.push(`${indentation}${element.name}: ${element.value}`);
// continue;
// }
//
// if(element instanceof List) {
// results.push(element.inspect(indentation));
// continue;
// }
//
// if(element instanceof Fieldset) {
// results.push(element.inspect(indentation));
// continue;
// }
//
// if(element instanceof Section) {
// results.push(element.inspect(indentation));
// continue;
// }
// }
//
// return results.join('\n');
// }

list(name, ...optional) {
let options = {
element: false,
Expand Down

0 comments on commit a251ce1

Please sign in to comment.