mirror of
https://github.com/flynx/object.js.git
synced 2025-10-29 18:40:08 +00:00
fixed the thing...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
89d2aa151c
commit
e5055b4fc5
@ -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
14
test.js
@ -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 ?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user