当前位置: 首页>>代码示例>>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;未经允许,请勿转载。