quantum
command. Or you can install it for a npm project and then your npm scripts will have access to the quantum command. quantum help
require('quantum-core')
.
For information about different versions, see the Changelog file.clone()
method of an existing file. error()
method. {
module: 'quantum-core',
problem: 'Parse error: unexpected dedent',
resolution: 'Fix indentation'
}
quantum-html
using the htmlRenamer
transform) warning()
method. {
module: 'quantum-changelog',
problem: 'An @updated entity found with description content, but no @description section was found',
resolution: 'use a @description block inside the @updated tag'
}
error()
method. {
module: 'quantum-core',
problem: 'Parse error: unexpected dedent',
resolution: 'Fix indentation'
}
quantum-html
using the htmlRenamer
transform) warning()
method. {
module: 'quantum-changelog',
problem: 'An @updated entity found with description content, but no @description section was found',
resolution: 'use a @description block inside the @updated tag'
}
error()
method. {
module: 'quantum-core',
problem: 'Parse error: unexpected dedent',
resolution: 'Fix indentation'
}
quantum-html
using the htmlRenamer
transform) warning()
method. {
module: 'quantum-changelog',
problem: 'An @updated entity found with description content, but no @description section was found',
resolution: 'use a @description block inside the @updated tag'
}
{
module: 'quantum-core',
problem: 'Parse error: unexpected dedent',
resolution: 'Fix indentation'
}
{
module: 'quantum-changelog',
problem: 'An @updated entity found with description content, but no @description section was found',
resolution: 'use a @description block inside the @updated tag'
}
info
property, which is one of these guys. const quantum = require('quantum-core')
const info = new quantum.FileInfo({
src: "src/content/about.um",
resolved: "about.um",
base: "src/content",
dest: "target/about.um",
destBase: "target",
watch: true
})
const quantum = require('quantum-core')
const info = new quantum.FileInfo({
src: "src/content/about.um",
resolved: "about.um",
base: "src/content",
dest: "target/about.um",
destBase: "target",
watch: true
})
const newFileInfo = info.clone({
watch: false,
dest: "target/about/index.html"
})
// newFileInfo.src === "src/content/about.um",
// newFileInfo.resolved === "about.um",
// newFileInfo.base === "src/content",
// newFileInfo.dest === "target/about/index.html",
// newFileInfo.destBase === "target",
// newFileInfo.watch === false
const quantum = require('quantum-core')
const info = new quantum.FileInfo({
src: "src/content/about.um",
resolved: "about.um",
base: "src/content",
dest: "target/about.um",
destBase: "target",
watch: true
})
const newFileInfo = info.withExtension('.html')
console.log(newFileInfo.dest) // prints "target/about.html"
quantum.select()
const quantum = require('quantum-core')
const entity = {
type: 'fruit',
params: ['apple'],
content: []
}
const sel = quantum.select(entity)
// sel is an instance of Selection
const quantum = require('quantum-core')
const entity = {
type: 'example',
params: ['param1', 'param2'],
content: [
'Blah blah blah'
]
}
const selection = quantum.select(entity)
selection.content() // ['Blah blah blah']
selection.add('Second line')
selection.content() // ['Blah blah blah', 'Second line']
// Entities can also be added
selection.add({
type: 'tagline',
params: [],
content: []
})
const quantum = require('quantum-core')
const entity = {
type: 'example',
params: ['param1', 'param2'],
content: [
{
type: "child",
params: [],
content: []
},
"End content"
]
}
const selection = quantum.select(entity)
selection.content()
/*
[
{
type: "child",
params: [],
content: []
},
"End content"
]
*/
const child = selection.select('child')
child.addAfter('New line')
selection.content()
/*
[
{
type: "child",
params: [],
content: []
},
"New line",
"End content"
]
*/
const quantum = require('quantum-core')
const entity = {
type: 'example',
params: ['param1', 'param2'],
content: [
'Blah blah blah'
]
}
const selection = quantum.select(entity)
selection.params() // ['param1', 'param2']
selection.addParam(['param3'])
selection.params() // ['param1', 'param2', 'param3']
const quantum = require('quantum-core')
const entity = {
type: 'example',
params: ['param1', 'param2'],
content: [
'Blah blah blah'
]
}
const quantum = require('quantum-core')
const entity = {
type: 'example',
params: ['param1', 'param2'],
content: [
'Blah blah blah'
]
}
const selection = quantum.select(entity)
selection.content() // ['Blah blah blah']
selection.content(['New Content', 'Second line'])
selection.content() // ['New Content', 'Second line']
const quantum = require('quantum-core')
const entity = {
type: 'example',
params: ['param1', 'param2'],
content: [
'Line 1',
'Line 2'
]
}
const selection = quantum.select(entity)
selection.cs() // 'Line1\nLine2'
const quantum = require('quantum-core')
const entity = {
type: 'example',
params: ['param1', 'param2'],
content: [
'Line 1',
'Line 2'
]
}
const selection = quantum.select(entity)
selection.cs() // 'Line1\nLine2'
selection.cs('Line1\nLine2\nLine3')
selection.content() // ['Line 1', 'Line 2', 'Line 3']
const quantum = require('quantum-core')
const basketEntity = {
type: 'basket',
params: [],
content: [
{
type: 'fruit',
params: ['lemon'],
content: []
}
]
}
const selection = quantum.select(basketEntity)
selection.entity() // returns basketEntity
const quantum = require('quantum-core')
const entity = {
type: 'example',
params: [],
content: [
{
type: 'childA',
params: [],
content: []
},
{
type: 'childA',
params: [],
content: []
},
{
type: 'childB',
params: [],
content: []
},
{
type: 'childC',
params: [],
content: []
}
]
}
const selection = quantum.select(entity)
const filteredSelection = selection.filter(['childA', 'childB'])
// filteredSelection does not have 'childC' as a child
const quantum = require('quantum-core')
const entity = {
type: 'example',
params: [],
content: [
{
type: 'childA',
params: [],
content: []
},
{
type: 'childA',
params: [],
content: []
},
{
type: 'childB',
params: [],
content: []
},
{
type: 'childC',
params: [],
content: []
}
]
}
const selection = quantum.select(entity)
const filteredSelection = selection.filter('childA')
// filteredSelection does not have 'childB' or 'childC' type entities as
// children
const quantum = require('quantum-core')
const entity = {
type: 'example',
params: [],
content: [
{
type: 'childA',
params: [],
content: []
},
{
type: 'childA',
params: [],
content: []
},
{
type: 'childB',
params: [],
content: []
},
{
type: 'childC',
params: [],
content: []
}
]
}
const selection = quantum.select(entity)
const filteredSelection = selection.filter(entity => entity.type !== 'childA')
// filteredSelection does not have any 'childA' type children
const quantum = require('quantum-core')
const entity = {
type: 'example',
params: ['param1', 'param2'],
content: [
{
type: 'child1',
params: [],
content: []
},
{
type: 'child2',
params: [],
content: [
type: 'child3',
params: [],
content: [
]
]
}
]
}
const selection = quantum.select(entity)
selection.has('child1') // true
selection.has('child2') // true
selection.has('child3') // false
selection.has('child3', {recursive: true}) // true
selection.has('child4', {recursive: true}) // false
false
type
const quantum = require('quantum-core')
const entity1 = {
type: 'example',
params: [],
content: []
}
const entity2 = {
type: 'example',
params: [],
content: [
'Line 1',
{
type: 'child',
params: [],
content: []
}
]
}
const selection1 = quantum.select(entity1)
selection1.hasContent() // false
const selection2 = quantum.select(entity2)
selection2.hasContent() // true
const quantum = require('quantum-core')
const entity1 = {
type: 'example',
params: [],
content: []
}
const entity2 = {
type: 'example',
params: ['param1', 'param2'],
content: []
}
const selection1 = quantum.select(entity1)
selection1.hasParams() // false
const selection2 = quantum.select(entity2)
selection2.hasParams() // true
const quantum = require('quantum-core')
const entity1 = {
type: 'example',
params: [],
content: []
}
const entity2 = {
type: 'example',
params: [],
content: [
"",
""
]
}
const entity3 = {
type: 'example',
params: [],
content: [
'Line 1',
{
type: 'child',
params: [],
content: []
}
]
}
const selection1 = quantum.select(entity1)
selection1.isEmpty() // true
const selection2 = quantum.select(entity2)
selection2.isEmpty() // true
const selection3 = quantum.select(entity3)
selection3.isEmpty() // false
const quantum = require('quantum-core')
const entity = {
type: 'blogEntry',
params: ['10/12/17'],
content: [
'Blah blah blah'
]
}
const selection = quantum.select(entity)
selection.param(0) // '10/12/17'
selection.param(1) // undefined
undefined
if an out of bounds parameter is accessed. const quantum = require('quantum-core')
const entity = {
type: 'blogEntry',
params: ['10/12/17'],
content: [
'Blah blah blah'
]
}
const selection = quantum.select(entity)
// get the current parameter value
selection.param(0) // '10/12/17'
// set the parameter and observe the change
selection.param(0, "11/12/17")
selection.param(0) // "11/12/17"
const quantum = require('quantum-core')
const entity = {
type: 'example',
params: ['param1', 'param2'],
content: [
'Blah blah blah'
]
}
const selection = quantum.select(entity)
selection.params() // ['param1', 'param2']
const quantum = require('quantum-core')
const entity = {
type: 'example',
params: ['param1', 'param2'],
content: [
'Blah blah blah'
]
}
const selection = quantum.select(entity)
selection.params() // ['param1', 'param2']
selection.params(['p1', 'p2'])
selection.params() // ['p1', 'p2']
Selection::select
has been used to select 'down' the tree: const quantum = require('quantum-core')
const entity = {
type: 'parent',
params: [],
content: [
{
type: 'childExample',
params: [],
content: [
]
}
]
}
const parentSelection = quantum.select(entity)
const childSelection = quantum.select('childExample')
parentSelection.parent() // undefined
childSelection.parent() // == parentSelection
const quantum = require('quantum-core')
const entity = {
type: 'example',
params: ['param1', 'param2'],
content: [
'Blah blah blah'
]
}
const selection = quantum.select(entity)
selection.ps() // param1 param2
selection.ps('p1 p2')
selection.params() // ['p1', 'p2']
const quantum = require('quantum-core')
const entity = {
type: 'example',
params: ['param1', 'param2'],
content: [
'Blah blah blah'
]
}
const selection = quantum.select(entity)
selection.ps() // param1 param2
const quantum = require('quantum-core')
const entity = {
type: 'parent',
params: [],
content: [
{
type: 'childExample',
params: [],
content: [
]
}
]
}
const parentSelection = quantum.select(entity)
const childSelection = quantum.select('childExample')
childSelection.remove()
parentSelection.entity()
/*
{
type: 'parent',
params: [],
content: []
}
*/
const quantum = require('quantum-core')
const entity = {
type: 'parent',
params: [],
content: [
{
type: 'child1',
params: [],
content: []
},
{
type: 'child1',
params: [],
content: []
},
{
type: 'child2',
params: [],
content: []
}
]
}
const parentSelection = quantum.select(entity)
parentSelection.removeAllChildrenOfType('child1') // removes all the child1 entities
parentSelection.entity()
/*
{
type: 'parent',
params: [],
content: [
{
type: 'child2',
params: [],
content: []
}
]
}
*/
const quantum = require('quantum-core')
const entity = {
type: 'parent',
params: [],
content: [
{
type: 'child1',
params: [],
content: []
},
{
type: 'child1',
params: [],
content: []
},
{
type: 'child2',
params: [],
content: []
}
]
}
const parentSelection = quantum.select(entity)
// removes the first child1 type entity and the first child2 type entity
parentSelection.removeAllChildrenOfType(['child1', 'child2'])
parentSelection.entity()
/*
{
type: 'parent',
params: [],
content: []
}
*/
false
const quantum = require('quantum-core')
const entity = {
type: 'parent',
params: [],
content: [
{
type: 'childExample',
params: [],
content: []
}
]
}
const parentSelection = quantum.select(entity)
const childEntity = entity.content[0]
parentSelection.removeChild(childEntity) // removes the child and returns true
const quantum = require('quantum-core')
const entity = {
type: 'parent',
params: [],
content: [
{
type: 'child1',
params: [],
content: []
},
{
type: 'child1',
params: [],
content: []
},
{
type: 'child2',
params: [],
content: []
}
]
}
const parentSelection = quantum.select(entity)
parentSelection.removeChildOfType('child1') // removes the first child1 type entity
parentSelection.entity()
/*
{
type: 'parent',
params: [],
content: [
{
type: 'child1',
params: [],
content: []
},
{
type: 'child2',
params: [],
content: []
}
]
}
*/
const quantum = require('quantum-core')
const entity = {
type: 'parent',
params: [],
content: [
{
type: 'child1',
params: [],
content: []
},
{
type: 'child1',
params: [],
content: []
},
{
type: 'child2',
params: [],
content: []
}
]
}
const parentSelection = quantum.select(entity)
// removes the first child1 type entity and the first child2 type entity
parentSelection.removeChildOfType(['child1', 'child2'])
parentSelection.entity()
/*
{
type: 'parent',
params: [],
content: [
{
type: 'child1',
params: [],
content: []
}
]
}
*/
false
const quantum = require('quantum-core')
const entity = {
type: 'parent',
params: [],
content: [
{
type: 'childExample',
params: [],
content: []
}
]
}
const selection = quantum.select(entity)
selection.select('childExample') // returns a new selection wrapping the 'childExample' entity
const quantum = require('quantum-core')
const entity = {
type: 'recipe',
params: ['Omelette'],
content: [
{
type: 'ingredient',
params: ['Eggs'],
content: []
},
{
type: 'ingredient',
params: ['Milk'],
content: []
},
{
type: 'ingredient',
params: ['Salt'],
content: []
},
{
type: 'ingredient',
params: ['Pepper'],
content: []
}
]
}
const selection = quantum.select(entity)
const ingredients = selection.selectAll('ingredient') // returns an array of 4 Selections
const quantum = require('quantum-core')
const entity = {
type: 'recipe',
params: ['Omelette'],
content: [
{
type: 'ingredient',
params: ['Eggs'],
content: []
},
{
type: 'ingredient',
params: ['Milk'],
content: []
},
{
type: 'ingredient',
params: ['Salt'],
content: []
},
{
type: 'ingredient',
params: ['Pepper'],
content: []
},
{
type: 'step',
params: [],
content: ['Beat eggs and milk to gether in a bowl and add salt and pepper']
},
{
type: 'step',
params: [],
content: ['Melt some butter in a frying pan']
},
{
type: 'step',
params: [],
content: ['Pour egg mixture into the frying pan and cook.']
}
]
}
const selection = quantum.select(entity)
const ingredients = selection.selectAll('ingredient') // returns an array of 4 Selections
const steps = selection.selectAll('step') // returns an array of 3 Selections
const ingredientsAndSteps = selection.selectAll(['ingredient', 'step']) // returns an array of 7 Selections
type
. If no entity is found, undefined
will be returned. const quantum = require('quantum-core')
const entity = {
type: 'basket',
params: [],
content: [
{
type: 'item',
params: ['lemon'],
content: [
{
type: 'price',
params: ['1.20'],
content: []
}
]
}
]
}
const selection = quantum.select(entity)
const priceSelection = selection.select('item').select('price')
// returns the basket entity wrapped in a Selection
priceSelection.selectUpwards('basket')
// returns the item entity wrapped in a Selection
priceSelection.selectUpwards('item')
// returns an empty selection - there is no parent entity of type 'trolley'
priceSelection.selectUpwards('trolley')
const quantum = require('quantum-core')
const entity = {
type: 'basket',
params: [],
content: [
{
type: 'item',
params: ['lemons'],
content: []
},
{
type: 'item',
params: ['apples'],
content: []
},
{
type: 'item',
params: ['limes'],
content: []
}
]
}
const selection = quantum.select(entity)
selection.transform((itemSelection) => {
return dom.create('div')
.class('basket-item')
.text(itemSelection.ps())
})
const quantum = require('quantum-core')
const entity = {
type: 'basket',
params: [],
content: [
{
type: 'item',
params: ['lemons'],
content: []
}
]
}
const selection = quantum.select(entity)
selection.transformContext({
someInformation: "somthing useful"
})
selection.transformContext() // returns { someInformation: "somthing useful" }
const quantum = require('quantum-core')
const entity = {
type: 'basket',
params: [],
content: [
{
type: 'item',
params: ['lemons'],
content: []
}
]
}
const selection = quantum.select(entity)
selection.transformContext({
someInformation: "somthing useful"
})
selection.transformContext() // returns { someInformation: "somthing useful" }
type
property from the underlying entity const quantum = require('quantum-core')
const entity = {
type: 'blogEntry',
params: ['10/12/17'],
content: [
'Blah blah blah'
]
}
const selection = quantum.select(entity)
console.log(selection.type()) // Prints "blogEntry"
type
property type
property for the underlying entity const quantum = require('quantum-core')
const entity = {
type: 'blogEntry',
params: ['10/12/17'],
content: [
'Blah blah blah'
]
}
const selection = quantum.select(entity)
console.log(selection.type()) // Prints "blogEntry"
console.log(entity.type) // Prints "blogEntry"
// Change the entity type
selection.type('myBlogEntry')
console.log(selection.type()) // Prints "myBlogEntry"
console.log(entity.type) // Prints "myBlogEntry"
quantum.watcher
. It provides a way to stop watching the files. Do not create one of these directly; instead use the quantum.watcher
function. build()
function results in the same thing as running quantum build
and the watch()
function builds the site and watches for changes, in the same way that quantum watch
does. 'none'
'error'
'all'
'all'
type
property, the events types used in Quantum are: 'header'
'message'
'build-page'
'page-load-error'
'copy-resource'
'error'
'end'
'error'
const html = require('quantum-html')
const pipeline = [
html()
]
http://localhost:port
). '.'
(The current working directory)'none'
'error'
'all'
'all'
type
property, the events types used in Quantum are: 'header'
'message'
'build-page'
'page-load-error'
'copy-resource'
'error'
'end'
'error'
const html = require('quantum-html')
const pipeline = [
html()
]
http://localhost:port
). '.'
(The current working directory)const quantum = require('quantum-core')
const entity = {
type: 'fruit',
params: [],
content: ['Strawberry', 'Kiwi', 'Cherry']
}
const cloned = quantum.clone(entity)
// cloned will look exactly the same as entity (but will be a copy,
// so changes made to the clone will not affect the original)
const quantum = require('quantum-core')
module.exports = {
pipeline: [
quantum.json()
],
pages: '**/index.um'
}
contents
property of the root entity contains the content parsed content. const quantum = require('quantum-core')
const markup = `
@example param1 params2
Content 1
Content 2
`
console.log(quantum.parse(markup))
/*
{
type: '',
params: [],
content: [
{
type: 'example',
params: ['param1', 'param2'],
content: ['Content 1', 'Content 2']
}
]
}
*/
quantum.select()
@example param1 params2
Content 1
Content 2
{
type: '',
params: [],
content: [
{
type: 'example',
params: ['param1', 'param2'],
content: ['Content 1', 'Content 2']
}
]
}
const quantum = require('quantum-core')
quantum.read('some/file.um').then(parsed => {
console.log(parsed)
})
@inline
by default) will be replaced with the content of the specified files. true
'.'
(The current working directory)const quantum = require('quantum-core')
quantum.readAsFile('some/file.um').then(file => {
console.log(file)
})
const quantum = require('quantum-core')
const info = new quantum.FileInfo({
src: "src/content/about.um",
resolved: "about.um",
base: "src/content",
dest: "target/about.um",
destBase: "target",
watch: true
})
quantum.readAsFile(info).then(file => {
console.log(file)
})
@inline
by default) will be replaced with the content of the specified files. true
"inline"
'.'
(The current working directory)const quantum = require('quantum-core')
const ast = {
type: 'params',
params: ['param1', 'param2'],
content: [
'Some Content'
]
}
quantum.select(ast) // returns a Selection
parse
const quantum = require('quantum-core')
quantum.stringify({
type: 'example',
params: ['param1', 'param2'],
content: [
'Some Content',
{
type: 'child',
params: ['child-param'],
content: []
}
]
})
/*
Returns this string:
@example param1 param2
Some content
@child child-param
*/
quantum.watch("src/**/*.um", (err, file, cause) => {
// Example use: apply some transformation and write the file to disk
return transformAndWrite(file)
})
quantum.watch("src/file.um", handler, options)
quantum.watch("src/**/*.um", handler, options)
quantum.watch(["src/**/*.um", "src2/**/index.um"], handler, options)
quantum.watch({
files: 'src/**/*.um',
base: 'src'
}, handler, options)
quantum.watch([
{
files: 'src/**/*.um',
base: 'src'
},
{
files: 'src2/**/index.um',
base: 'src2'
}
], handler, options)
'build'
'add'
or 'change'
'.'
(The current working directory)info
property. loader
option for the watch
function. const fs = require('fs')
function (filename, parentFilename) {
return new Promise((resolve, reject) => {
return fs.readFile(filename, 'utf-8', (err, data) => {
err ? reject(err) : resolve(data)
})
})
}
'.'
(The current working directory){
build: Function,
events: EventEmitter
}
build
function will trigger a full build of the watched files when called. events
gives you a way to listen for changes that are made to files. 'error'
, 'add'
, 'change'
, 'delete'
.
quantum.watcher("src/file.um", options)
quantum.watcher("src/**/*.um", options)
quantum.watcher(["src/**/*.um", "src2/**/index.um"], options)
quantum.watcher(["src/**/*.um", "src2/**/index.um"], options)
quantum.watcher({
files: 'src/**/*.um',
base: 'src'
}, options)
quantum.watcher([
{
files: 'src/**/*.um',
base: 'src'
},
{
files: 'src2/**/index.um',
base: 'src2'
}
], options)
const quantum = require('quantum-core')
quantum.readAsFile('some/file.um')
.then(file => {
return file.clone({
info: file.info.clone({ dest: 'target/file.um'
})
})
})
.then(quantum.write)
const quantum = require('quantum-core')
const files = Promise.all([
quantum.readAsFile('some/file1.um'),
quantum.readAsFile('some/file2.um'),
quantum.readAsFile('some/file3.um')
])
files.then(files => {
return files.map(file => {
return file.clone({
info: file.info.clone({
dest: file.info.target.replace('some', 'target')
})
})
})
})
.then(quantum.write)
quantum.parse()
function: const quantum = require('quantum-core')
const markup = `
@example param1 params2
Content 1
Content 2
`
console.log(quantum.parse(markup))
{
type: '',
params: [],
content: [
{
type: 'example',
params: ['param1', 'param2'],
content: ['Content 1', 'Content 2']
}
]
}
quantum.read()
function: @example param1 params2
Content 1
Content 2
const quantum = require('quantum-core')
quantum.read('example.um').then(parsed => {
console.log(parsed)
})
{
type: '',
params: [],
content: [
{
type: 'example',
params: ['param1', 'param2'],
content: ['Content 1', 'Content 2']
}
]
}
const quantum = require('quantum-core')
quantum.read('example.um').then(parsed => {
const selection = quantum.select(parsed)
selection.ps() // extract the parameter string from an entity
selection.cs() // extract the content string from an entity (ignores all sub-entities)
selection.select('banana') // selects the first child entity called banana
selection.selectAll('kiwi') // selects all the child entities called kiwi (returns an array)
selection.select('lemon').param(2) // gets the second parameter from the first lemon entity in the selection
})
{
type: 'fruits',
params: ['kiwi', 'lime', 'grapes'],
content: ['Some fruits that are green']
}
const entity = {
type: 'fruits',
params: ['kiwi', 'lime', 'grapes'],
content: [
'Some fruits that are green'
]
}
const selection = quantum.select(entity)
selection.type() // 'fruits'
selection.params() // ['kiwi', 'lime', 'grapes']
selection.param(1) // 'lime'
selection.param(2) // 'grapes'
selection.ps() // 'kiwi lime grapes'
selection.content() // ['Some fruits that are green']
selection.cs() // 'Some fruits that are green'
const entity = {
type: 'fruits',
params: ['kiwi', 'lime', 'grapes'],
content: [
'Some fruits that are green'
]
}
const selection = quantum.select(entity)
selection.type('fruitSalad') // sets entity.type to 'fruitSalad'
selection.param(1, 'apple') // changes the 2nd parameter to 'apple'
selection.content(['New content']) // replaces entity.content
selection.add('More content') // pushes more content into entity.content
entity
object instead of wrapping it in a selection if you prefer. The selection api is merely a simple wrapper that makes some tasks easier. const entity = {
type: 'fruits',
params: [],
content: [
{ type: 'apple', params: ['red'], content: [] },
{ type: 'banana', params: ['yellow'], content: [] },
{ type: 'banana', params: ['brown'], content: [] }
]
}
const selection = quantum.select(entity)
// select the first child of type 'apple' and get it's first parameter
selection.select('apple').param(0) // is 'red'
// selecting multiple children of the same type
const bananas = selection.selectAll('banana')
bananas[0].param(0) // is 'yellow'
bananas[1].param(0) // is 'brown'
resursive
option to true
:
const entity = {
type: 'fruits',
params: [],
content: [
{
type: 'tag',
params: ['red'],
content: [
{
type: 'tag',
params: ['orange'],
content: [
{
type: 'tag',
params: ['yellow'],
content: []
}
]
}
]
},
{ type: 'tag', params: ['green'], content: [] },
{ type: 'tag', params: ['blue'], content: [] }
]
}
const selection = quantum.select(entity)
// returns three 'tag' selections ('red', 'green' and 'blue')
selection.selectAll('tag')
// returns five 'tag' selections ('red', 'orange', 'yellow', 'green', 'blue')
selection.selectAll('tag', {recursive: true})