1 var test = require('tap').test;
2 var traverse = require('../');
4 test('siblings', function (t) {
5 var obj = { a : 1, b : 2, c : [ 4, 5, 6 ] };
7 var res = traverse(obj).reduce(function (acc, x) {
8 var p = '/' + this.path.join('/');
11 siblings : this.parent.keys,
13 index : this.parent.keys.indexOf(this.key)
27 '/' : { siblings : [], key : undefined, index : -1 },
28 '/a' : { siblings : [ 'a', 'b', 'c' ], key : 'a', index : 0 },
29 '/b' : { siblings : [ 'a', 'b', 'c' ], key : 'b', index : 1 },
30 '/c' : { siblings : [ 'a', 'b', 'c' ], key : 'c', index : 2 },
31 '/c/0' : { siblings : [ '0', '1', '2' ], key : '0', index : 0 },
32 '/c/1' : { siblings : [ '0', '1', '2' ], key : '1', index : 1 },
33 '/c/2' : { siblings : [ '0', '1', '2' ], key : '2', index : 2 }