UNPKG

superflected

Version:

A port of ActiveSupport's inflector to Node.js

6 lines (4 loc) 202 B
import { underscore } from "./underscore"; export function foreignKey(className: string, separateWithUnderscore = true) { return `${underscore(className)}${separateWithUnderscore ? "_id" : "id"}`; }