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


TypeScript lodash.startCase函數代碼示例

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


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

示例1: getDefaultName

function getDefaultName(route: IRouterRoute): string {
  const actionOpts = route.options as IActionRouteOptions
  const action = startCase(actionOpts.type)

  if (!route.kilnModel) return action
  const singular = startCase(route.kilnModel.name)
  const plural = startCase(route.kilnModel.meta.plural!)
  return actionOpts.byList || actionOpts.type === ActionType.List
    ? `${action} ${plural}`
    : `${action} ${singular}`
}
開發者ID:patrickhulce,項目名稱:klay,代碼行數:11,代碼來源:paths.ts

示例2: setRouteDefaults

export function setRouteDefaults(route: RouteConfig, specific?: Partial<RouteConfig>) {

	route = _.defaultsDeep(specific, defaultConfig, route);

	if (!route.title) {
		route.title = typeof route.route === "string"
			? _.startCase(route.route)
			: _.startCase(route.route[1]);
	}

	return route;
}
開發者ID:sketch7,項目名稱:ssv-au-core,代碼行數:12,代碼來源:routing.util.ts

示例3: buildObjectSchema

function buildObjectSchema(
  model: IModel,
  cache?: ISwaggerSchemaCache,
  name?: string,
): swagger.Schema {
  const schema: swagger.Schema = {
    type: 'object',
    properties: {},
  }

  const required = []
  const children = (model.spec.children as IModelChild[]) || []
  for (const child of children) {
    const childName = startCase(child.path).replace(/ +/g, '')
    const childModel = transformSpecialCases(child.model, SwaggerContext.Schema)
    schema.properties![child.path] = getSchema(childModel, cache, `${name}${childName}`)
    if (childModel.spec.required) {
      required.push(child.path)
    }
  }

  if (required.length) {
    schema.required = required
  }

  return schema
}
開發者ID:patrickhulce,項目名稱:klay,代碼行數:27,代碼來源:components.ts

示例4: Date

        inquirer.prompt(prompts).then(answers => {
            if (!answers.moveon) {
                return;
            }

            let today = new Date(),
                year = today.getFullYear().toString();

            answers.appVersion = [
                'v0',
                year.slice(2),
                (today.getMonth() + 1) + padLeft(today.getDate())
            ].join('.');
            answers.appNameSlug = _.slugify(answers.appName);
            answers.appTitle = startCase(answers.appName).split(' ').join('');
            answers.appYear = year;

            gulp.src([
                `${__dirname}/../templates/common/**`,
                `${__dirname}/../templates/${answers.projectType}-package/**`
            ])
                .pipe(template(answers))
                .pipe(rename(file => {
                    if (file.basename[0] === '_') {
                        file.basename = '.' + file.basename.slice(1);
                    }
                }))
                .pipe(conflict('./'))
                .pipe(gulp.dest('./'))
                .on('end', () => {
                    this.log.info(`Successfully created LabShare ${answers.projectType} package...`);
                });
        });
開發者ID:LabShare,項目名稱:lsc,代碼行數:33,代碼來源:package.ts

示例5:

const colorOptionsList = polygons.map(n => {
  return {
    key: `colors[${n}]`,
    display: `${_.startCase(polygonNames.get(n))} Color`,
    type: 'color',
    default: defaultColors[n],
  };
});
開發者ID:tessenate,項目名稱:polyhedra-viewer,代碼行數:8,代碼來源:configOptions.ts

示例6: getUser

export function getUser (username) {
  var user = JSON.parse(fs.readFileSync(getUserFilePath(username), {encoding: 'utf8'}));
  user.name.full = _.startCase(user.name.first + ' ' + user.name.last);
  _.keys(user.location).forEach(function (key) {
      user.location[key] = _.startCase(user.location[key]);
  });
  return user;
};
開發者ID:wpcfan,項目名稱:calltalent_server,代碼行數:8,代碼來源:helpers.ts

示例7: buildDetailsForFailure

export function buildDetailsForFailure(build: CircleCIBuild) {
  return [
    _.startCase(build.status),
    '-',
    timeAgo(build.stop_time),
    'by',
    build.committer_email
  ].join(' ');
}
開發者ID:jvandyke,項目名稱:vscode-circleci,代碼行數:9,代碼來源:format.ts

示例8: buildSpecification

export function buildSpecification(kiln: IKiln, router: IRouter, overrides?: Partial<Spec>): Spec {
  const schemaCache = new SwaggerSchemaCache()
  for (const kilnModel of kiln.getModels()) {
    const arrayModel = defaultModelContext.array().children(kilnModel.model)
    getSchema(kilnModel.model, schemaCache, startCase(kilnModel.name))
    getSchema(arrayModel, schemaCache, `${startCase(kilnModel.meta.plural)}List`)
  }

  return {
    swagger: '2.0',
    basePath: '/',
    produces: ['application/json'],
    host: 'localhost',
    schemes: ['http'],
    info: {
      title: 'Title',
      version: 'Version',
    },
    paths: buildPaths(router, schemaCache),
    definitions: schemaCache.getUniqueSchemas(),
    ...overrides,
  }
}
開發者ID:patrickhulce,項目名稱:klay,代碼行數:23,代碼來源:spec.ts

示例9:

 const copy = (file: string, dest: string) => {
   this.fs.copyTpl(
     this.templatePath(file + '.ejs'),
     this.destinationPath('src', 'views', dest),
     _.assign(
       {},
       this,
       {
         fileBase,
         componentName: _.startCase(this.baseName).replace(/ /g, '')
       },
     )
   )
 }
開發者ID:damplus,項目名稱:generator-plus,代碼行數:14,代碼來源:index.ts

示例10: findBySlug

export function findBySlug(
  crops: CropLiveSearchResult[], slug?: string): CropLiveSearchResult {
  const crop = find(crops, result => result.crop.slug === slug);
  return crop || {
    crop: {
      name: startCase((slug || t("Name")).split("-").join(" ")),
      slug: "slug",
      binomial_name: t("Binomial Name"),
      common_names: [t("Common Names")],
      description: t("Description"),
      sun_requirements: t("Sun Requirements"),
      sowing_method: t("Sowing Method"),
      processing_pictures: 0
    },
    image: DEFAULT_ICON
  };
}
開發者ID:FarmBot,項目名稱:Farmbot-Web-API,代碼行數:17,代碼來源:search_selectors.ts

示例11: run

  async run(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void> {
    const { json } = options;

    if (json) {
      process.stdout.write(JSON.stringify(await this.env.getInfo()));
    } else {
      const results = await this.env.getInfo();

      const groupedInfo: Map<InfoItemGroup, InfoItem[]> = new Map(
        INFO_GROUPS.map((group): [typeof group, InfoItem[]] => [group, results.filter(item => item.group === group)])
      );

      const sortInfo = (a: InfoItem, b: InfoItem): number => {
        if (a.key[0] === '@' && b.key[0] !== '@') {
          return 1;
        }

        if (a.key[0] !== '@' && b.key[0] === '@') {
          return -1;
        }

        return strcmp(a.key.toLowerCase(), b.key.toLowerCase());
      };

      const projectPath = this.project && this.project.directory;

      const splitInfo = (ary: InfoItem[]) => ary
        .sort(sortInfo)
        .map((item): [string, string] => [`   ${item.key}${item.flair ? ' ' + weak('(' + item.flair + ')') : ''}`, weak(item.value) + (item.path && projectPath && !item.path.startsWith(projectPath) ? ` ${weak('(' + item.path + ')')}` : '')]);

      const format = (details: [string, string][]) => columnar(details, { vsep: ':' });

      if (!projectPath) {
        this.env.log.warn('You are not in an Ionic project directory. Project context may be missing.');
      }

      this.env.log.nl();

      for (const [ group, info ] of groupedInfo.entries()) {
        if (info.length > 0) {
          this.env.log.rawmsg(`${strong(`${lodash.startCase(group)}:`)}\n\n`);
          this.env.log.rawmsg(`${format(splitInfo(info))}\n\n`);
        }
      }
    }
  }
開發者ID:driftyco,項目名稱:ionic-cli,代碼行數:46,代碼來源:info.ts

示例12: formatPermissionLabel

export function formatPermissionLabel(
  plugin: GraclPlugin,
  perm: string
): string {
  const components = parsePermissionString(plugin, perm);
  const obj = getPermissionObject(plugin, perm);
  const format = obj && obj.format;

  if (format) {
    if (typeof format === 'string') {
      return format;
    } else {
      return format(components.action, components.collection);
    }
  } else {
    return startCase(perm);
  }
}
開發者ID:CrossLead,項目名稱:tyranid-gracl,代碼行數:18,代碼來源:formatPermissionLabel.ts

示例13: resolve

 resolve(route: ActivatedRouteSnapshot) {
   const path = route.params.name;
   const text = _.startCase(path);
   return [{ text: text, path: path }];
 }
開發者ID:,項目名稱:,代碼行數:5,代碼來源:

示例14: return

 return (target: any) => {
     metadata.define(symbols.atomConfig, _.defaults(context, { type: 'boolean', title: _.startCase(target.name), name: _.camelCase(target.name) }) , target);
 };
開發者ID:OmniSharp,項目名稱:atom-languageclient,代碼行數:3,代碼來源:decorators.ts

示例15: buildDetailsForGeneric

export function buildDetailsForGeneric(build: CircleCIBuild) {
  return [
    _.startCase(build.status),
  ].join(' ');
}
開發者ID:jvandyke,項目名稱:vscode-circleci,代碼行數:5,代碼來源:format.ts


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