當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript lodash.snakeCase函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。