當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。