How to use the @hpcc-js/util.Dictionary function in @hpcc-js/util

To help you get started, we’ve selected a few @hpcc-js/util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hpcc-systems / Visualization / packages / comms / src / clienttools / eclMeta.ts View on Github external
}
            }
        }
        return retVal;
    }

    resolvePartialID(filePath: string, partialID: string, charOffset: number): ECLScope | undefined {
        partialID = partialID.toLowerCase();
        const partialIDParts = partialID.split(".");
        partialIDParts.pop();
        const partialIDQualifier = partialIDParts.length === 1 ? partialIDParts[0] : partialIDParts.join(".");
        return this.resolveQualifiedID(filePath, partialIDQualifier, charOffset);
    }
}

const workspaceCache = new Dictionary();
export function attachWorkspace(_workspacePath: string, eclccPath?: string): Workspace {
    const workspacePath = path.normalize(_workspacePath);
    if (!workspaceCache.has(workspacePath)) {
        const workspace = new Workspace(workspacePath, eclccPath);
        workspaceCache.set(workspacePath, workspace);
        workspace.refresh();
    }
    return workspaceCache.get(workspacePath);
}

function isQualifiedIDChar(lineText: string, charPos: number, reverse: boolean) {
    if (charPos < 0) return false;
    const testChar = lineText.charAt(charPos);
    return (reverse ? /[a-zA-Z\d_\.$]/ : /[a-zA-Z\d_]/).test(testChar);
}