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


TypeScript humps.camelizeKeys函數代碼示例

本文整理匯總了TypeScript中humps.camelizeKeys函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript camelizeKeys函數的具體用法?TypeScript camelizeKeys怎麽用?TypeScript camelizeKeys使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了camelizeKeys函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: fetchOptionsWithDebug

export async function callApi<T = void>(
  fetchOptions: KFetchOptions,
  { camelcase = true, prependBasePath = true } = {}
): Promise<T> {
  const combinedFetchOptions = fetchOptionsWithDebug(fetchOptions);
  const res = await kfetch(combinedFetchOptions, { prependBasePath });
  return camelcase ? camelizeKeys(res) : res;
}
開發者ID:gingerwizard,項目名稱:kibana,代碼行數:8,代碼來源:callApi.ts

示例2: dispatch

 .subscribe(responce => {
     let body = responce.json();
     body = humps.camelizeKeys(body);
     if (body.status === `OK`) {
         dispatch(this.SET_ENTITIES(body.results));
     } else {
         console.error('FETCH_ENTITIES', body.results);
     }
 }, error => console.error('FETCH_ENTITIES', error));
開發者ID:KulikovskyIgor,項目名稱:sport-route,代碼行數:9,代碼來源:explore-page-actions.ts

示例3: normalize

  protected normalize(response, schema) {

    let camelizedJson = camelizeKeys(response);

    let normalizedResponse = normalize(camelizedJson, schema);

    return {
      result: fromJS(normalizedResponse.result),
      entities: fromJS(normalizedResponse.entities)
    };
  }
開發者ID:dghijben,項目名稱:dashboard,代碼行數:11,代碼來源:Api.ts

示例4: function

	split: /^[A-Z0-9_]+$/
};
let someOptions3: humps.HumpsOptions = {
	separator: '-',
	process: function (key: string, convert: humps.HumpsProcessorParameter, options: humps.HumpsOptions) {
		return /^[A-Z0-9_]+$/.test(key) ? key : convert(key, options);
	}
};


humps.camelize('hello_world')

humps.decamelize('fooBar')
humps.decamelize('fooBarBaz', someOptions)

humps.camelizeKeys(someObject);

humps.camelizeKeys(someArray);

humps.camelizeKeys(someObject, function (key, convert) {
  return /^[A-Z0-9_]+$/.test(key) ? key : convert(key);
});

humps.decamelizeKeys(someObject, function (key, convert, options) {
  return /^[A-Z0-9_]+$/.test(key) ? key : convert(key, options);
});


humps.camelize('hello_world-foo bar');

humps.pascalize('hello_world-foo bar');
開發者ID:AbraaoAlves,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:humps-tests.ts


注:本文中的humps.camelizeKeys函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。