• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript lodash.snakeCase函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript lodash.some函数代码示例发布时间:2022-05-25
下一篇:
TypeScript lodash.slice函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap