Closed kwhitley closed 10 years ago
var tree = new Treeize();
tree.setOptions({ log: true }).grow([
{ 'foo:name': 'bar', 'foo:age': 1 },
{ 'foo:name': 'baz', 'foo:age': 3 },
]);
Produces error:
SIGNATURE> { nodes:
[ { path: 'foo',
attributes:
[ { name: 'name', key: 'foo:name' },
{ name: 'age', key: 'foo:age' } ],
blueprint:
[ { name: 'name', key: 'foo:name' },
{ name: 'age', key: 'foo:age' } ],
isCollection: false,
name: 'foo',
depth: 1,
parent: '' } ],
type: 'object',
isFixed: false }
PROCESSING NODE> { path: 'foo',
attributes:
[ { name: 'name', key: 'foo:name' },
{ name: 'age', key: 'foo:age' } ],
blueprint:
[ { name: 'name', key: 'foo:name' },
{ name: 'age', key: 'foo:age' } ],
isCollection: false,
name: 'foo',
depth: 1,
parent: '' }
creating attribute "name" within blueprint bar
creating attribute "age" within blueprint 1
creating attribute "name" within extended blueprint bar
creating attribute "age" within extended blueprint 1
EXTENDED BLUEPRINT> { name: 'bar', age: 1 }
BLUEPRINT> { name: 'bar', age: 1 }
path MISSING for location ""
..attempting path location for ""
..attempting path location for ""
..attempting path location for ""
..attempting path location for ""
..attempting path location for ""
..attempting path location for ""
path FOUND for location for "" after removing 6 segments
creating or trailing path segment {object} ""
/Users/kevinwhitley/dev/kwhitley/treeize/lib/treeize.js:336
trail = trail[segment] = trail[segment] || {};
^
TypeError: Cannot read property '' of undefined
at Treeize.<anonymous> (/Users/kevinwhitley/dev/kwhitley/treeize/lib/treeize.js:336:49)
at /Users/kevinwhitley/dev/kwhitley/treeize/node_modules/lodash/dist/lodash.js:4446:21
at Function.forEach (/Users/kevinwhitley/dev/kwhitley/treeize/node_modules/lodash/dist/lodash.js:2590:15)
at Treeize.<anonymous> (/Users/kevinwhitley/dev/kwhitley/treeize/lib/treeize.js:326:17)
at /Users/kevinwhitley/dev/kwhitley/treeize/node_modules/lodash/dist/lodash.js:4446:21
at Function.forEach (/Users/kevinwhitley/dev/kwhitley/treeize/node_modules/lodash/dist/lodash.js:2590:15)
at Treeize.<anonymous> (/Users/kevinwhitley/dev/kwhitley/treeize/lib/treeize.js:235:7)
at /Users/kevinwhitley/dev/kwhitley/treeize/node_modules/lodash/dist/lodash.js:4446:21
at Function.forEach (/Users/kevinwhitley/dev/kwhitley/treeize/node_modules/lodash/dist/lodash.js:2590:15)
at Treeize.grow (/Users/kevinwhitley/dev/kwhitley/treeize/lib/treeize.js:202:5)
e.g.
Shouldnt add deep attributes to unknown object (currently dumps to root because trail not added).
NOTES
option
to enable this functionality?