still broken, thinking...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-06-14 17:54:01 +03:00
parent 9da8b306d3
commit 89d2aa151c
3 changed files with 24 additions and 2 deletions

View File

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

View File

@ -1,6 +1,6 @@
{
"name": "ig-object",
"version": "5.0.11",
"version": "5.0.12",
"description": "",
"main": "object.js",
"scripts": {

21
test.js
View File

@ -589,6 +589,27 @@ module.cases = {
assert.error('.parent(..) of anonymous function', function(){
object.parent(function(){}, {}) })
},
'deepKeys': function(assert){
var a = {
a: true
}
var b = {
__proto__: a,
b: true,
}
var c = {
__proto__: b,
c: true,
}
assert(arrayCmp(object.deepKeys(c), ['a', 'b', 'c']), 'full')
assert(arrayCmp(object.deepKeys(c, a), ['a', 'b', 'c']), 'full 2')
// 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']
}
}