How to use the datx.isView function in datx

To help you get started, we’ve selected a few datx 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 infinum / datx / packages / datx-jsonapi / src / mixin.ts View on Github external
export function jsonapi(
  Base: IModelConstructor|ICollectionConstructor|IViewConstructor,
) {
  if (isModel(Base)) {
    // @ts-ignore
    return decorateModel(Base);
  } else if (isCollection(Base)) {
    // @ts-ignore
    return decorateCollection(Base);
  } else if (isView(Base)) {
    // @ts-ignore
    return decorateView(Base);
  }

  throw new Error('The instance needs to be a model, collection or a view');
}