All files / lib/utils getModelName.ts

66.67% Statements 6/9
50% Branches 3/6
100% Functions 1/1
83.33% Lines 5/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11    1x 251x 251x 251x         1x
import { HookContext } from "@feathersjs/feathers";
 
const getModelName = (modelName: string | ((context: HookContext) => string), context: HookContext): string => {
  Iif (modelName === undefined) { return context.path; }
  Iif (typeof modelName === "string") { return modelName; }
  Eif (typeof modelName === "function") { return modelName(context); }
 
  throw new Error("feathers-casl: 'modelName' is not a string or function");
};
 
export default getModelName;