Let r be the result of running the steps to with value and keyPath. Rethrow any exceptions.
If r is failure, return failure.
Let key be the result of running the steps to convert a value to a key with r if the multiEntry flag is unset, and the result of running the steps to with r otherwise. Rethrow any exceptions.
If key is invalid, return invalid.
Return key.
The steps to evaluate a key path on a value with value and keyPath are as follows. The result of these steps is an ECMAScript value or failure, or the steps may throw an exception.
If keyPath is a list of strings, then:
Let result be a new Array object created as if by the expression .
Let i be 0.
Return result.
This will only ever “recurse” one level since sequences can’t ever be nested.
Let identifiers be the result of strictly splitting keyPath on U+002E FULL STOP characters (.).
For each identifier in identifiers, jump to the appropriate step below:
If (value) is String, and identifier is “
length
“Let value be a Number equal to the number of elements in value.
If value is an Array and identifier is “
length
“Let value be ToLength( Get(value, “
length
“)).If value is a
[Blob](https://w3c.github.io/FileAPI/#dfn-Blob)
and identifier is “size
“Let value be a Number equal to value’s .
If value is a
[Blob](https://w3c.github.io/FileAPI/#dfn-Blob)
and identifier is “type
“If value is a
[File](https://w3c.github.io/FileAPI/#dfn-file)
and identifier is “name
“Let value be a String equal to value’s .
If value is a
[File](https://w3c.github.io/FileAPI/#dfn-file)
and identifier is “lastModified
“Let value be a Number equal to value’s
[lastModified](https://w3c.github.io/FileAPI/#dfn-lastModified)
.If value is a
[File](https://w3c.github.io/FileAPI/#dfn-file)
and identifier is “lastModifiedDate
“Let value be a new object with [[DateValue]] internal slot equal to value’s .
Otherwise
If Type(value) is not Object, return failure.
Let hop be HasOwnProperty(value, identifier).
If hop is false, return failure.
Let value be Get(value, identifier).
If value is undefined, return failure.
Assert: value is not an .