MCPcopy
hub / github.com/OpenWebGAL/WebGAL / getSentenceArgByKey

Function getSentenceArgByKey

packages/webgal/src/Core/util/getSentenceArg.ts:4–10  ·  view source on GitHub ↗
(sentence: ISentence, argKey: string)

Source from the content-addressed store, hash-verified

2import { toSafeBoolean, toSafeNumber, toSafeString } from './toSafeType';
3
4export function getSentenceArgByKey(sentence: ISentence, argKey: string): null | string | boolean | number {
5 const args = sentence.args;
6 const result = args.find((arg) => arg.key === argKey);
7 if (result) {
8 return result.value;
9 } else return null;
10}
11
12export function getBooleanArgByKey(sentence: ISentence, argKey: string): boolean | null {
13 const argValue = getSentenceArgByKey(sentence, argKey);

Callers 3

getBooleanArgByKeyFunction · 0.85
getNumberArgByKeyFunction · 0.85
getStringArgByKeyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected