endpoints/endpoints

View on GitHub
es5/store-bookshelf/lib/type.js

Summary

Maintainability
A
1 hr
Test Coverage
/**
 * Return the json-api type of a Bookshelf model. Prefer the static
 * property `typeName`, but failover to tableName on the prototype
 * if needed.
 *
 * @param {Bookshelf.Model} model
 * @return {String}
 */
"use strict";

exports.__esModule = true;
exports["default"] = type;

function type(model) {
  return model.constructor.typeName || model.typeName || model.prototype && model.prototype.tableName || model.tableName;
}

module.exports = exports["default"];