INNER CODE UNIT · JavaScript

validateHookEntry

Sisyphe42/ReignsAgent · packages/core/src/index.js:413

function validateHookEntry(hookEntry, context) {
  assertPlainRecord(hookEntry, `${context} hook entry`);

  if (!hookEntry.id) {
    throw new CoreError(`${context} hook entry requires an id`);
  }

  assertStringArray(hookEntry.tags ?? [], `${context} hook entry '${hookEntry.id}' tags`);

  if (hookEntry.data !== undefined) {
    cloneJsonSafe(hookEntry.data, `${context} hook entry '${hookEntry.id}' data`);
  }

  if (hookEntry.hooks !== undefined) {
    assertPlainRecord(hookEntry.hooks, `${context} hook entry '${hookEntry.id}' hooks`);

    for (const [hookName, hook] of Object.entries(hookEntry.hooks)) {
      if (!HOOK_NAMES.has(hookName)) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…