本文整理汇总了TypeScript中lodash.snakeCase函数的典型用法代码示例。如果您正苦于以下问题:TypeScript snakeCase函数的具体用法?TypeScript snakeCase怎么用?TypeScript snakeCase使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snakeCase函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: joinTableName
joinTableName(firstTableName: string,
secondTableName: string,
firstPropertyName: string,
secondPropertyName: string,
firstColumnName: string,
secondColumnName: string): string {
return _.snakeCase(firstTableName + "_" + firstPropertyName + "_" + secondTableName + "_" + secondColumnName);
}
开发者ID:gitter-badger,项目名称:typeorm,代码行数:8,代码来源:DefaultNamingStrategy.ts
示例2:
Object.entries(settings).forEach(([key, value]) => {
// Avoid snake casing keys that are the result of being flattened, such as `security.principal` and `conf.*`
if (key.includes('.')) {
serializedSettings[key] = value;
} else {
serializedSettings[snakeCase(key)] = value;
}
});
开发者ID:,项目名称:,代码行数:8,代码来源:
示例3: getSpecialValue
export function getSpecialValue(key: string | number):
SPECIAL_VALUES {
const k = snakeCase(("" + key).toUpperCase()).toUpperCase();
const v = get(SPECIAL_VALUES, k, NaN);
if (isUndefined(v) || isNaN(v)) {
throw new Error("Not a SPECIAL_VALUE: " + k);
} else {
return v;
}
}
开发者ID:FarmBot,项目名称:Farmbot-Web-API,代码行数:12,代码来源:constants.ts
示例4: getModel
export function getModel(
sequelize: Sequelize.Sequelize,
kilnModel: IKilnModel,
kiln: IKiln,
): Sequelize.Model<Sequelize.Instance<object>, object> {
const sequelizeDatatypes: Sequelize.DefineAttributes = {}
addSequelizeDatatypes(sequelizeDatatypes, kilnModel.model)
constraints.addPrimaryKey(sequelizeDatatypes, kilnModel.model)
constraints.addAutomanaged(sequelizeDatatypes, kilnModel.model)
constraints.addForeignKeys(sequelizeDatatypes, kilnModel.model, kiln)
const tableName = kilnModel.meta.tableName || snakeCase(kilnModel.meta.plural!)
return sequelize.define(kilnModel.name, sequelizeDatatypes, {
indexes: getIndexes(kilnModel.model, tableName),
tableName,
})
}
开发者ID:patrickhulce,项目名称:klay,代码行数:17,代码来源:model.ts
示例5:
function fieldMap<F> (
model: Model<F> | IResourceObject,
base: _.Dictionary<any> = {}
): _.Dictionary<any> {
const fields: _.Dictionary<any> = _.merge(
base,
model instanceof Model
? model.fields
: model.attributes
)
const result: _.Dictionary<any> = {}
let key: string
for (key in fields) {
if (!_.has(fields, key)) {
continue
}
result[_.snakeCase(key)] = fields[key]
}
return result
}
开发者ID:perpengt,项目名称:jsonapi,代码行数:23,代码来源:query.ts
示例6: GetAllBooks
import { Category } from './enums'; // filename no extension
import { Book, Logger, Author, Librarion , Magazine} from './interfaces';
import { UniversityLibrarian, ReferenceItem} from './classes';
import refBook from './Encyclopedia';
import { CalculateLateFee as CalcFee, MaxBooksAllowed, Purge } from './lib/utilityFunctions';
import Shelf from "./shelf";
import * as _ from 'lodash';
let snakeCaseTitle = _.snakeCase('For Whom the Bell Tolls');
console.log(snakeCaseTitle);
let reference = new refBook("Fact book", 2016, 1);
function GetAllBooks():Book[] {
let books = [
{id: 1, title: 'Ulysses', author: 'James Joyce', available: true, category: Category.Fiction},
{id: 2, title: 'A Farewell to Arms', author: 'Ernest Hemingway', available: false, category: Category.Poetry},
{
id: 3,
title: 'I Know Why the Caged Bird Sings',
author: 'Maya Angelou',
available: true,
category: Category.Poetry
},
{id: 4, title: 'Moby Dick', author: 'Herman Melville', available: true, category: Category.Fiction}
];
return books;
}
开发者ID:marcobrasci1986,项目名称:TypescriptInDepth,代码行数:31,代码来源:app.ts
示例7: getDbName
function getDbName(name) {
return _.snakeCase(name);
}
开发者ID:Blocklevel,项目名称:contoso-express,代码行数:3,代码来源:_modelHelper.ts
示例8:
return _.mapKeys(object, (value, key) => {
return _.snakeCase(key);
});
开发者ID:elastic,项目名称:kibana,代码行数:3,代码来源:case_conversion.ts
示例9: tableName
tableName(className: string, customName: string): string {
return customName ? customName : _.snakeCase(className);
}
开发者ID:gitter-badger,项目名称:typeorm,代码行数:3,代码来源:CustomNamingStrategy.ts
示例10: relationName
relationName(propertyName: string): string {
return _.snakeCase(propertyName);
}
开发者ID:gitter-badger,项目名称:typeorm,代码行数:3,代码来源:CustomNamingStrategy.ts
注:本文中的lodash.snakeCase函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论