Skip to content

postgrelize / useInflection

Function: useInflection() ​

useInflection(custom): void

Defined in: src/model/inflector.ts:38

Replaces the inflection library used to singularize and pluralize association names and to underscore column names (Sequelize v6 useInflection). Call it before defining models.

Parameters ​

custom ​

Inflection

Library with singularize, pluralize and underscore.

Returns ​

void

See ​

Sequelize.useInflection

Example ​

ts
useInflection({
  singularize: (word) => word.replace(/s$/, ''),
  pluralize: (word) => `${word}s`,
  underscore: (word) => word.replace(/([A-Z])/g, '_$1').toLowerCase(),
});

Released under the MIT License.