Table
Generate a nested set of objects, given a set of rows and a set of headers.
let keys = [
"minDistance"
, "attractionStrength"
, "repulsionStrength"
, "damping"
, "minVelocity"
, "maxVelocity"
, "itercount"
, "method"
]
const confTable = new Table(keys, {
'default': [30, 0.004, 200, 0.60, 0.1, 5]
, 'alt': [90, 0.002, 100, 0.66, 0.08, 5]
, 'gas': [100, 0.001, 800, 0.974, 0.1, 9, 1]
, 'stable': [100, 0.001, 80, 0.974, 0.01, 9, 1]
, 'blob': [90, 0.002, 100, 0.95, 0.1, 20, 1, 'springy']
})
const settings = confTable.get('blob')
{
minDistance: 90
, attractionStrength: 0.002
, repulsionStrength: 100
, damping: 0.95
, minVelocity: 0.1
, maxVelocity: 20
, itercount: 1
, method: 'springy'
}
The get method returns an object, with the keys given. If a property from the
row does not exist, the keypair is not assigned to the result.
We can provide defaults for missing keys:
js
confTable.get('default', { method: 'egg' })
Meta Data
| title | Table |
| dependencies | () |
| unused_keys | () |
| unknown_keys | () |
| filepath_exists | True |
| path | table |
| filepath | table.js |
| clean_files | () |