static anchorName(link) { return ( '#' + dasherize(underscore(link.replace(/[A-Z]{2,}(?=[A-Z])/, (v) => camelize(v.toLowerCase())).replace(/#/g, '-'))) ); }
/** Model name matching filename (not classname) Used throughout Ash to reference the model Example: For a model class named `MyPostModel` or `MyPostsModel`, `modelName` will be `my-post` @property modelName @static @public @return {string} model name */ static get modelName () { const nameWithoutModel = this.name.replace('Model', '') const nameUnderscored = underscore(nameWithoutModel) const nameDasherized = dasherize(nameUnderscored) return singularize(nameDasherized) }
/** Exposes a pluralised version of the models name Matches up with jsonapi specs `type` attribute Example: for a model `post`, type would be `posts` @property type @static @public @return {string} model type */ static get type () { const nameWithoutModel = this.name.replace('Model', '') const nameUnderscored = underscore(nameWithoutModel) const nameDasherized = dasherize(nameUnderscored) return pluralize(nameDasherized) }