MCPcopy Create free account
hub / github.com/Monogatari/Monogatari / label

Method label

src/monogatari.ts:1340–1359  ·  view source on GitHub ↗
(key: string | null = null, language: string | Record<string, unknown[]> | null = null, value: unknown[] | null = null)

Source from the content-addressed store, hash-verified

1338 static label (key: string, language: Record<string, unknown[]>): void;
1339 static label (key: string, language: string, value: unknown[]): void;
1340 static label (key: string | null = null, language: string | Record<string, unknown[]> | null = null, value: unknown[] | null = null): unknown {
1341 if (typeof language === 'string' && value !== null && key !== null) {
1342 if (typeof this._script[language] !== 'object') {
1343 this._script[language] = {};
1344 }
1345 (this._script[language] as Record<string, unknown>)[key] = value;
1346 } else if (typeof language === 'object' && language !== null && value === null && key !== null) {
1347 if (typeof this._script[key] !== 'object') {
1348 this._script[key] = [];
1349 }
1350 this._script[key] = language;
1351 } else if (typeof language === 'string' && value === null && key !== null) {
1352 return (this._script[language] as Record<string, unknown>)?.[key];
1353 } else if (key !== null) {
1354 return this.script (key);
1355 } else {
1356 const labelState = this.state ('label') as string;
1357 return this.script (labelState);
1358 }
1359 }
1360
1361 static fn (name: string, { apply = () => true, revert = () => true }: { apply?: () => boolean; revert?: () => boolean } = {}): { apply: () => boolean; revert: () => boolean } {
1362 if (typeof apply === 'function' && typeof revert === 'function') {

Callers 12

setupMethod · 0.95
applyMethod · 0.80
afterRevertMethod · 0.80
didMountMethod · 0.80
showMainScreenFunction · 0.80
showSplashScreenFunction · 0.80
displayInitialScreenFunction · 0.80
loadFromSlotFunction · 0.80
nextFunction · 0.80
revertFunction · 0.80
commands.jsFile · 0.80

Calls 2

scriptMethod · 0.95
stateMethod · 0.95

Tested by

no test coverage detected