Type Alias Digest<param>

Digest<param>: ((node: EstreeNode<{}>, node_path: EstreeNodePath, file_path: GetDefault<param, "FilePath", string>, node_kind: EstreeNodeKind) => GetDefault<param, "NodeHash", string>)

Hashing function for estree nodes.

Type Parameters

  • param extends {
        FilePath?: unknown;
        NodeHash?: string | number;
    } = {}

Type declaration

    • (node, node_path, file_path, node_kind): GetDefault<param, "NodeHash", string>
    • Parameters

      • node: EstreeNode<{}>

        The estree node to hash.

      • node_path: EstreeNodePath

        The json path of the node in starting from file.root. It is composed of the properties names that lead to the node concatenated with dots. So integers properties are within bracket. For instance: "body.0.declarations.0.init".

      • file_path: GetDefault<param, "FilePath", string>

        The path of the file containing the node as provided by file.path.

      • node_kind: EstreeNodeKind

        The kind of the node -- eg: "Program", "Statement", "Expression", ...

      Returns GetDefault<param, "NodeHash", string>

      The hash of the node. It should be unique for each node in the program file.root. It is safe to simply returns node_path.