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


TypeScript strings.dasherize函數代碼示例

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


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

示例1: renameDirs

/**
 * Renames package directories if custom names for packages were specified.
 */
function renameDirs () {
  const config: PackageNamesConfig = getPackageNamesConfig(process.argv);

  for (const packageName of NEBULAR_PACKAGES) {
    const nbPackageDirName = dasherize(packageName);
    const fromDir = join(BUILD_DIR, nbPackageDirName);
    const toDir = join(BUILD_DIR, config.unprefixed[packageName]);
    fsRenameSync(fromDir, toDir);
  }
}
開發者ID:kevinheader,項目名稱:nebular,代碼行數:13,代碼來源:change-prefix.ts

示例2: task

task('generate-ts-config', () => {
  const { theme }: PackageNamesConfig = getPackageNamesConfig(process.argv);
  let stream = src('tsconfig.publish.json');

  for (const packageName of NEBULAR_PACKAGES) {
    stream = stream.pipe(replace(`@nebular/${dasherize(packageName)}`, theme))
  }

  return stream
    .pipe(rename('tsconfig-custom.publish.json'))
    .pipe(dest('.'));
});
開發者ID:kevinheader,項目名稱:nebular,代碼行數:12,代碼來源:change-prefix.ts

示例3: parseArguments

/**
 * Reads package prefix and all package names passed as command line arguments.
 * List of supported arguments:
 * --prefix    - prefix of the package. Also used as prefix in class names, selector prefixes etc.
 * --auth      - replacement for @nebular/auth
 * --bootstrap - replacement for @nebular/bootstrap
 * --date-fns  - replacement for @nebular/date-fns
 * --eva-icons - replacement for @nebular/eva-icons
 * --moment    - replacement for @nebular/moment
 * --theme     - replacement for @nebular/theme
 * --security  - replacement for @nebular/security
 * @param argv command line arguments
 * @returns ParsedArguments
 */
function parseArguments(argv: string[]): ParsedArguments {
  const args = minimist(argv.slice(2));
  const prefix = args.prefix;

  if (!prefix) {
    throwNoPrefixSpecified();
  }

  const parsedArguments = { prefix };
  for (const packageName of NEBULAR_PACKAGES) {
    parsedArguments[packageName] = args[dasherize(packageName)];
  }

  return parsedArguments;
}
開發者ID:kevinheader,項目名稱:nebular,代碼行數:29,代碼來源:change-prefix.ts

示例4: applyDefaults

/**
 * Prefixes packages and fills config with default package names for packages
 * not passed as `--[package-name]` argument.
 * Default package name is `${prefix}/${dasherize(packageName)}`.
 * For example, with prefix set `@custom`, `@nebular/auth` would ne `@custom/auth`.
 * @param parsedArguments parsed command line arguments
 * @returns PackageNamesConfig
 */
function applyDefaults(parsedArguments: ParsedArguments): PackageNamesConfig {
  const { prefix } = parsedArguments;
  const config = {
    prefix,
    unscopedPrefix: prefix.replace(/^@/, ''),
    unprefixed: {},
  };

  for (const nbPackageName of NEBULAR_PACKAGES) {
    const packageName = parsedArguments[nbPackageName] || dasherize(nbPackageName);
    config.unprefixed[nbPackageName] = packageName;
    config[nbPackageName] = `${prefix}/${packageName}`;
  }

  return config as PackageNamesConfig;
}
開發者ID:kevinheader,項目名稱:nebular,代碼行數:24,代碼來源:change-prefix.ts


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