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


TypeScript lodash.trim函數代碼示例

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


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

示例1: getImportBindingName

function getImportBindingName(node: ImportOrExportDeclaration) {
    if (isImportRequireStatement(node)) {
        return _.trim(node.moduleReference.getText(), '\'"');
    } else if (isExportStatement(node)) {
        return _.trim(node.moduleSpecifier.getText(), '\'"');
    } else {
        return _.trim(node.moduleSpecifier.getText(), '\'"');
    }
}
開發者ID:OmniSharp,項目名稱:atom-languageclient,代碼行數:9,代碼來源:orderImportsRule.ts

示例2: equalsIgnoreCase

    public static equalsIgnoreCase(val1: string, val2:string): boolean {

                if(isString(val1) && isString(val2) && trim(val1).length > 0 && trim(val2).length > 0){
                    if(val1.toUpperCase() === val2.toUpperCase()){
                        return true;
                    }else{
                        return false;
                    }

                }
                return false;
            }
開發者ID:bbachi,項目名稱:Angular5Sample,代碼行數:12,代碼來源:common.util.ts

示例3: getSortKey

function getSortKey(statement: ImportOrExportDeclaration) {
    try {
        if (isImportStatement(statement) && !isImportRequireStatement(statement)) {
            return _.trim(statement.moduleSpecifier.getText(), '\'"');
        } else if (isExportStatement(statement) && !isImportRequireStatement(statement)) {
            return _.trim(statement.moduleSpecifier.getText(), '\'"');
        } else {
            return _.trim(statement.moduleReference.getText(), '\'"');
        }
    } catch (e) {
        return null;
    }
}
開發者ID:OmniSharp,項目名稱:atom-languageclient,代碼行數:13,代碼來源:orderImportsRule.ts

示例4: customSortKey

function customSortKey(key: string) {
    try {
        let result = key;
        if (key[0] === '@') {
            result = _.trim(key, '@').toLowerCase();
        } else if (_.startsWith(key, 'lodash')) {
            result = `0${key}`;
        } else if (_.startsWith(key, `rxjs`)) {
            result = `0${key}`;
        } else if (_.startsWith(key, './') || _.startsWith(key, '../')) {
            const split = key.split('/');
            let prefix: string;
            result = _.last(split);
            if (result === 'index') {
                result = _.nth(split, -2);
            }
            if (result.match(/^[A-Z]/)) {
                prefix = 'z';
            } else {
                prefix = 'y';
            }
            result = `${prefix}${result}`.toLowerCase();
        }

        return result.replace(/\//g, '');
    } catch (e) {
        return null;
    }
}
開發者ID:OmniSharp,項目名稱:atom-languageclient,代碼行數:29,代碼來源:orderImportsRule.ts

示例5: getTraits

async function getTraits(dispatch: (action: any) => any, payload: FetchTraitInterface) {
  const config: RequestConfig = () => ({
    url: payload.apiHost,
    headers: {
      Authorization: `${client.ACCESS_TOKEN_PREFIX} ${patcher.getAccessToken()}`,
    },
  });
  const res = await webAPI.TraitsAPI.GetTraitsV1(config, client.shardID);
  if (res.ok) {
    const data = JSON.parse(res.data);
    dispatch(onInitializeTraits({
      playerClass: _.trim(payload.playerClass),
      race: payload.race,
      faction: payload.faction,
      banesAndBoons: data,
      initType: payload.initType,
    }));
  } else {
    toastr.error(
      'We are having technical difficulties. You will not be able to create a character until they have been fixed.',
      'Oh No!!',
      { timeOut: 5000 },
    );
  }
}
開發者ID:codecorsair,項目名稱:Camelot-Unchained,代碼行數:25,代碼來源:banesAndBoons.ts

示例6: safeTrim

    static safeTrim(s: string): string {
        if (!s) {
            return null;
        }

        return _.trim(s);
    }
開發者ID:itsuryev,項目名稱:tp-oauth-server,代碼行數:7,代碼來源:models.ts

示例7: substringBefore

 public static substringBefore(val:string, delimiter:string):string {
     var str :string;
     if(isString(val) && trim(val).length > 0){
        str = val.split(delimiter)[0];
     }
     return str;
 }
開發者ID:bbachi,項目名稱:Angular5Sample,代碼行數:7,代碼來源:common.util.ts

示例8: isNotBlank

    public static isNotBlank(val: string): boolean {

        if(isString(val) && trim(val).length > 0 && undefined != val && "null" != val && null != val){
            return true;
        }
        return false;
    }
開發者ID:bbachi,項目名稱:Angular5Sample,代碼行數:7,代碼來源:common.util.ts

示例9: transformPackageVersions

 transformPackageVersions(packageVersions: Array<string>, request: IRequest): Array<IProposal> {
   const {token} = request;
   const trimmedToken = trim(token, '"');
   return packageVersions
     .filter(version => isStableVersion(version))
     .filter(version => startsWith(version, trimmedToken))
     .map(version => createVersionProposal(version, request));
 }
開發者ID:GabrielNicolasAvellaneda,項目名稱:autocomplete-json,代碼行數:8,代碼來源:composer-json-dependency-proposal-provider.ts

示例10:

  keys.forEach((key) => {
    const value = object[key];

    if (!value) delete object[key];
    if (typeof value === 'string' && nullStrings.has(trim(value, trimChars).toLowerCase())) {
      delete object[key];
    }
  });
開發者ID:nusmodifications,項目名稱:nusmods,代碼行數:8,代碼來源:data.ts


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