The steps to check that a key could be injected into a value are as follows. The algorithm takes a value and a keyPath, and outputs 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 member of identifiers.

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

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

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

      3. If hop is false, return true.

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

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

    The steps to inject a key into a value using a key path are as follows. The algorithm takes a value, a key and a keyPath.

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

    2. Assert: identifiers is not empty.

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

    4. For each remaining identifier in identifiers:

      1. Assert: value is an Object or an .

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

    5. Assert: value is an Object or an .

    6. Let keyValue be the result of running the steps to 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.