fixed the thing...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-06-15 16:59:42 +03:00
parent 89d2aa151c
commit e5055b4fc5
2 changed files with 10 additions and 9 deletions

View File

@ -120,10 +120,9 @@ function(obj, stop){
var res = [] var res = []
while(obj != null){ while(obj != null){
res.push(Object.keys(obj)) res.push(Object.keys(obj))
obj = obj.__proto__
// XXX need to stop but include the stop object...
if(obj === stop){ if(obj === stop){
break }} break }
obj = obj.__proto__ }
return [...(new Set(res.flat()))] } return [...(new Set(res.flat()))] }

14
test.js
View File

@ -602,13 +602,11 @@ module.cases = {
c: true, c: true,
} }
assert(arrayCmp(object.deepKeys(c), ['a', 'b', 'c']), 'full') assert.array(object.deepKeys(c), ['c', 'b', 'a'], 'full chain')
assert(arrayCmp(object.deepKeys(c, a), ['a', 'b', 'c']), 'full 2') assert.array(object.deepKeys(c, a), ['c', 'b', 'a'], 'full chain')
assert.array(object.deepKeys(c, b), ['c', 'b'], 'partial chain')
assert.array(object.deepKeys(c, c), ['c'], 'partial chain')
// XXX these are wrong...
console.log('>>>>', object.deepKeys(c, a)) // -/-> ['a', 'b', 'c']
console.log('>>>>', object.deepKeys(c, b)) // -/-> ['b', 'c']
console.log('>>>>', object.deepKeys(c, c)) // -/-> ['c']
} }
} }
@ -714,6 +712,10 @@ object.Constructor('Assert', {
} catch(err){ } catch(err){
this(true, msg) this(true, msg)
return err } }, return err } },
// XXX
array: function(value, expected, msg){
return this(arrayCmp(value, expected),
msg +':', 'expected:', expected, 'got:', value) },
__init__: function(path, stats, verbose){ __init__: function(path, stats, verbose){
this.path = path instanceof Array ? this.path = path instanceof Array ?