collections/Tree.js
/**
		 * Creates a representation of the tree using JavaScript objects and arrays.
		 *
		 * @public
		 * @param {Function=} valueConverter - An optional function for converting the value of each node.
		 * @param {Boolean=} valueConverter - If true, empty children arrays will be excluded from output.
		 * @returns {Object}
		 */
Creates a representation of the tree using JavaScript objects and arrays.
@public
@param {Function=} valueConverter - An optional function for converting the value of each node.
@param {Boolean=} valueConverter - If true, empty children arrays will be excluded from output.
@returns {Object}
Creates a representation of the tree using JavaScript objects and arrays . @public @param { Function = } valueConverter - An optional function for converting the value of each node . @param { Boolean = } valueConverter - If true empty children arrays will be excluded from output . @returns { Object }
toJSObj(valueConverter, omitEmptyChildren) {
			let valueConverterToUse;
			if (is.fn(valueConverter)) {
				valueConverterToUse = valueConverter;
			} else {
				valueConverterToUse = (x) => x;
			}
			const converted = {
				value: valueConverterToUse(this._value)
			};
			if (!(is.boolean(omitEmptyChildren) && omitEmptyChildren && this._children.length === 0)) {
				converted.children = this._children.map((child) => child.toJSObj(valueConverter, omitEmptyChildren));
			}
			return converted;
		}
toJSObj ( valueConverter , omitEmptyChildren ) { let valueConverterToUse ; if ( is . fn ( valueConverter ) ) { valueConverterToUse = valueConverter ; } else { valueConverterToUse = ( x ) => x ; } const converted = { value : valueConverterToUse ( this . _value ) } ; if ( ! ( is . boolean ( omitEmptyChildren ) && omitEmptyChildren && this . _children . length === 0 ) ) { converted . children = this . _children . map ( ( child ) => child . toJSObj ( valueConverter , omitEmptyChildren ) ) ; } return converted ; }
Creates a representation of the tree using JavaScript objects and arrays.
Creates a representation of the tree using JavaScript objects and arrays .