When the getOwnPropertyDescriptors function is called, the following steps are taken:
- Let obj be ToObject(O).
- ReturnIfAbrupt(obj).
- Let keys be the result of calling the [[OwnPropertyKeys]] internal method of obj.
- ReturnIfAbrupt(keys).
- Let descriptors be the result of ObjectCreate(null).
- Let gotAllNames be false.
- Repeat while gotAllNames is false,
1. Let next be the result of IteratorStep(keys).
1. ReturnIfAbrupt( next ).
1. If next is false, then let gotAllNames be true.
1. Else,
- Let nextKey be IteratorValue(next).
- Let nextKey be ToPropertyKey(nextKey).
- ReturnIfAbrupt(nextKey).
- Let desc be the result of calling the [[GetOwnProperty]] internal method of obj with argument nextKey.
- ReturnIfAbrupt(desc).
- Let descriptor be FromPropertyDescriptor(desc).
- ReturnIfAbrupt(descriptor).
- Let status be the result of CreateDataProperty(descriptors, nextKey, descriptor).
- Assert: status is not an abrupt completion.
- Return descriptors.
yes, GetOwnPropertyKeys ( O, Type ) works perfectly for the goal, thanks !
One minor note on point 5,
ObjectCreate(null)
it's a nice to have but actuallydescriptors
are accepted as genericObject
and parsed through the hasOwnProperty check if enumerable, as specified here