当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript underscore.rest函数代码示例

本文整理汇总了TypeScript中underscore.rest函数的典型用法代码示例。如果您正苦于以下问题:TypeScript rest函数的具体用法?TypeScript rest怎么用?TypeScript rest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rest函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: shellExecuteNpmInstall

    /**
     * Executes the 'npm install' command for the packages specified in the registry package map.
     *
     * @param packagePath The folder of the package that is to be installed.
     * @param registryMap The map of registry and packages that should be installed.
     */
    public shellExecuteNpmInstall(packagePath: string, registryMap: IDictionary<Array<string>>): void {
        const INSTALLABLE_PACKAGE_CHUNKSIZE: number = 50;

        for (let registry in registryMap) {
            let packages = registryMap[registry];

            if (!packages || packages.length === 0) continue;

            // Install packages in bundles because command line lengths aren't infinite. Windows for example has
            // a command line limit of 8192 characters. It's variable on *nix and OSX but will in the 100,000s

            let installablePackages = _.first(packages, INSTALLABLE_PACKAGE_CHUNKSIZE);
            packages = _.rest(packages, INSTALLABLE_PACKAGE_CHUNKSIZE);

            while (installablePackages && installablePackages.length > 0) {
                var installArgs = ["install"].concat(installablePackages);

                if (packagePath === process.cwd()) {
                    installArgs.push("--ignore-scripts");
                }

                if (registry !== "*") {
                    installArgs.push("--registry");
                    installArgs.push(registry);
                }

                this.shellExecuteNpm(packagePath, installArgs);

                installablePackages = _.first(packages, INSTALLABLE_PACKAGE_CHUNKSIZE);
                packages = _.rest(packages, INSTALLABLE_PACKAGE_CHUNKSIZE);
            }
        }
    }
开发者ID:i-e-b,项目名称:gulp-npmworkspace,代码行数:39,代码来源:NpmPluginBinding.ts

示例2: setExpandedAndCollapsed

 private setExpandedAndCollapsed() {
   if (this.facetValues.length > this.facet.options.numberOfValuesInBreadcrumb) {
     this.collapsed = _.rest(this.facetValues, this.facet.options.numberOfValuesInBreadcrumb - 1);
     this.expanded = _.first(this.facetValues, this.facet.options.numberOfValuesInBreadcrumb - 1);
   } else {
     this.collapsed = [];
     this.expanded = this.facetValues;
   }
 }
开发者ID:erocheleau,项目名称:search-ui,代码行数:9,代码来源:BreadcrumbValuesList.ts

示例3: encodeKeyValuePair

  private static encodeKeyValuePair(pair: string) {
    const split = pair.split('=');
    if (split.length == 0) {
      return pair;
    }

    let key = split[0];
    let value = rest(split, 1).join('');

    if (!key) {
      return pair;
    }
    if (!value) {
      return pair;
    }

    key = this.removeProblematicChars(key);
    if (!this.isEncoded(value)) {
      value = Utils.safeEncodeURIComponent(value);
    }

    return `${key}=${value}`;
  }
开发者ID:coveo,项目名称:search-ui,代码行数:23,代码来源:UrlUtils.ts

示例4: on

 on(actions.dismissStatusMessage, (state, action) => {
   return {
     ...state,
     messages: rest(state.messages),
   };
 });
开发者ID:itchio,项目名称:itch,代码行数:6,代码来源:status.ts

示例5: parseSleep

export function parseSleep(tokens: string[]): Instruction | undefined {
    if (_.first(tokens) === 'SLEEP') {
        return new Instruction('DELAY', _.rest(tokens));
    }
}
开发者ID:gsanta,项目名称:r0,代码行数:5,代码来源:parser.ts

示例6: parseMotion

export function parseMotion(tokens: string[]): Instruction | undefined {
    var commands = ['FORWARD', 'REVERSE', 'TURN_LEFT', 'TURN_RIGHT', 'STOP'];
    if (_.indexOf(commands, _.first(tokens)) !== -1) {
        return new MotionInstruction(_.first(tokens), _.rest(tokens));
    }
}
开发者ID:gsanta,项目名称:r0,代码行数:6,代码来源:parser.ts


注:本文中的underscore.rest函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。