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


TypeScript inflection.pluralize函数代码示例

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


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

示例1: function

 locals: function(options) {
   return {
     middlePath: `${inflector.pluralize(options.middlePath)}`,
     projectName: `${options.project.name()}`,
     entityName: `${options.entity.name}`
   }
 }
开发者ID:Flexberry,项目名称:ember-flexberry,代码行数:7,代码来源:index.ts

示例2: pluralize

export function pluralize(str: string): string {
  return inflection.pluralize(str);
}
开发者ID:shiwano,项目名称:typhen,代码行数:3,代码来源:helpers.ts

示例3: authRoutesFor

/**
 * Generate any routes needed based on the facets applied to the given model.
 */
export default function authRoutesFor(modelName: string, router: Router, options: AuthRoutesOptions) {
  options.except = options.except || [];

  let Model = router.container.lookup(`model:${ modelName }`);

  // Generate the root namespace for all the auth related routes we will be
  // adding. Defaults to type/auth, so for the User model, it would be
  // `users/auth/*`.
  router.namespace(Model.authNamespace || `${ pluralize(modelName) }/auth`, (namespace) => {

    // Registerable
    // Adds routes that allow for users to register a new account
    if (Model.isRegisterable) {
      if (!options.except.includes('/register')) {
        namespace.post('/register', 'auth/register', { modelName });
      }
    }

    // Confirmable
    // Adds routes that allow for users to confirm their email address
    if (Model.isConfirmable) {
      if (!options.except.includes('/confirm-email')) {
        namespace.post('/confirm-email', 'auth/confirm-email', { modelName });
      }
      if (!options.except.includes('/resend-email-confirmation')) {
        namespace.post('/resend-email-confirmation', 'auth/resend-email-confirmation', { modelName });
      }
    }

    // Resetable
    // Adds routes that allow users to reset their passwords
    if (Model.isResetable) {
      if (!options.except.includes('/reset-password')) {
        namespace.post('/reset-password', 'auth/reset-password', { modelName });
      }
      if (!options.except.includes('/send-reset-password')) {
        namespace.post('/send-reset-password', 'auth/send-reset-password', { modelName });
      }
    }

    // Invitable
    // Adds routes that allow users to reset their passwords
    if (Model.isInvitable) {
      if (!options.except.includes('/send-invitation')) {
        namespace.post('/send-invitation', 'auth/send-invitation', { modelName });
      }
    }

    // Oauthable
    // Adds routes that allow users to login / register via OAuth providers
    if (Model.isOauthable) {
      if (!options.except.includes('/oauth')) {
        namespace.post('/oauth/:provider', 'auth/oauth', { modelName });
      }
    }

    // Fetchable
    // Adds a route that allow users to fetch their own records when logged in
    if (Model.isFetchable) {
      if (!options.except.includes('/me')) {
        namespace.get('/me', 'auth/fetch-user', { modelName });
      }
    }

    // Authenticable
    // Adds routes allowing users to authenticate and establish a session
    if (Model.isAuthenticatable) {
      if (!options.except.includes('/login')) {
        namespace.post('/login', 'auth/login', { modelName });
      }
      if (!options.except.includes('/logout')) {
        namespace.delete('/logout', 'auth/logout', { modelName });
      }
    }

  });

}
开发者ID:davewasmer,项目名称:denali-auth,代码行数:81,代码来源:routes-for.ts


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