To check that a key could be injected into a value with value and a keyPath, run the following steps. The result of these steps is either true or false.

    1. Let identifiers be the result of keyPath on U+002E FULL STOP characters (.).

    2. Assert: identifiers is not empty.

    3. Remove the last of identifiers.

    4. For each remaining identifier of identifiers, if any:

      1. If value is not an or an Array, return false.

      2. Let hop be HasOwnProperty(value, identifier).

      3. If hop is false, return true.

    5. Return true if value is an or an Array, or false otherwise.

    Assertions can be made in the above steps because this algorithm is only applied to values that are the output of .

    To inject a key into a value using a key path with value, a key and a keyPath, run these steps:

    1. Let identifiers be the result of strictly splitting keyPath on U+002E FULL STOP characters (.).

    2. : identifiers is not empty.

    3. Let last be the last item of identifiers and remove it from the list.

    4. remaining identifier of identifiers:

      1. Assert: value is an or an Array.

      2. Let value be Get(value, identifier).

    5. : value is an Object or an .

    6. Let keyValue be the result of running convert a key to a value with key.

    7. Let status be (value, last, keyValue).

    Assertions can be made in the above steps because this algorithm is only applied to values that are the output of StructuredDeserialize, and the steps to have been run.