Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/flo-bit/shapecraft. flo-bit.dev/shapecraft
Something went wrong. Try again.
654 B · 33 lines
JavaScript
at commit da69385e
12345678910111213141516171819202122232425262728293031323334'use strict'
let Container = require('./container')
let LazyResult, Processor
class Document extends Container { constructor(defaults) { // type needs to be passed to super, otherwise child roots won't be normalized correctly super({ type: 'document', ...defaults })
if (!this.nodes) { this.nodes = [] } }
toResult(opts = {}) { let lazy = new LazyResult(new Processor(), this, opts)
return lazy.stringify() }}
Document.registerLazyResult = dependant => { LazyResult = dependant}
Document.registerProcessor = dependant => { Processor = dependant}
module.exports = DocumentDocument.default = Document