UNPKG

typeorm

Version:

Data-Mapper ORM for TypeScript, ES7, ES6, ES5. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, WebSQL, MongoDB databases.

36 lines (34 loc) 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Converts string into camelCase. * * @see http://stackoverflow.com/questions/2970525/converting-any-string-into-camel-case */ function camelCase(str) { return str.replace(/^([A-Z])|[\s-_](\w)/g, function (match, p1, p2, offset) { if (p2) return p2.toUpperCase(); return p1.toLowerCase(); }); } exports.camelCase = camelCase; /** * Converts string into snake-case. * * @see http://stackoverflow.com/questions/30521224/javascript-convert-pascalcase-to-underscore-case */ function snakeCase(str) { return str.replace(/(?:^|\.?)([A-Z])/g, function (x, y) { return "_" + y.toLowerCase(); }).replace(/^_/, ""); } exports.snakeCase = snakeCase; /** * Converts string into title-case. * * @see http://stackoverflow.com/questions/196972/convert-string-to-title-case-with-javascript */ function titleCase(str) { return str.replace(/\w\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); }); } exports.titleCase = titleCase; //# sourceMappingURL=StringUtils.js.map