• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript lodash.uniqueId函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: it

 it('should work', done => {
     const user = {
         id: parseInt(_.uniqueId(), 10),
         accountName: 'test-oauth-tokens-accountName'
     };
     const testClient = {
         clientId: 'test-oauth-tokens-save-and-get-token',
         clientSecret: 'secret',
         name: 'test-oauth-tokens-save-and-get-token name',
         description: null,
         redirectUri: 'http://example.com'
     };
     const accessTokenValue = _.uniqueId('testAccessToken');
     ClientStorage
         .deleteAllClientsExtremelyUnsafePrepareToSuffer()
         .then(() => ClientStorage.createClient(testClient))
         .then(() => TokenStorage.saveAccessToken(accessTokenValue, testClient.clientId, null, user))
         .then(() => TokenStorage.getAccessToken(accessTokenValue))
         .then((retrievedAccessToken: TokenInfo) => {
             expect(retrievedAccessToken).to.be.not.null;
             expect(retrievedAccessToken.token).to.be.equal(accessTokenValue);
             expect(retrievedAccessToken.user).to.be.eql(user);
             expect(retrievedAccessToken.expires).to.be.null;
         })
         .then(done);
 });
开发者ID:itsuryev,项目名称:tp-oauth-server,代码行数:26,代码来源:tokensTests.ts


示例2: PathLayer

  const nodeToLayerDataFn = (node: Node): Layer => {
    if (!isElement(node)) {
      return undefined;
    }

    if (node.tagName === 'path') {
      return new PathLayer({
        id: _.uniqueId(),
        name: makeFinalNodeIdFn(node.getAttribute('android:name'), 'path'),
        children: [],
        pathData: getPath(node),
        fillColor: getColor(node, 'fillColor', ''),
        fillAlpha: getNumber(node, 'fillAlpha', '1'),
        strokeColor: getColor(node, 'strokeColor', ''),
        strokeAlpha: getNumber(node, 'strokeAlpha', '1'),
        strokeWidth: getNumber(node, 'strokeWidth', '0'),
        strokeLinecap: get(node, 'strokeLineCap', 'butt') as StrokeLineCap,
        strokeLinejoin: get(node, 'strokeLineJoin', 'miter') as StrokeLineJoin,
        strokeMiterLimit: getNumber(node, 'strokeMiterLimit', '4'),
        trimPathStart: getNumber(node, 'trimPathStart', '0'),
        trimPathEnd: getNumber(node, 'trimPathEnd', '1'),
        trimPathOffset: getNumber(node, 'trimPathOffset', '0'),
        fillType: get(node, 'fillType', 'nonZero') as FillType,
      });
    }

    if (node.tagName === 'clip-path') {
      return new ClipPathLayer({
        id: _.uniqueId(),
        name: makeFinalNodeIdFn(get(node, 'name', ''), 'clip-path'),
        children: [],
        pathData: getPath(node),
      });
    }

    if (node.childNodes.length) {
      const children = Array.from(node.childNodes)
        .map(child => nodeToLayerDataFn(child))
        .filter(child => !!child);
      if (children && children.length) {
        return new GroupLayer({
          id: _.uniqueId(),
          name: makeFinalNodeIdFn(get(node, 'name', ''), 'group'),
          children,
          pivotX: getNumber(node, 'pivotX', '0'),
          pivotY: getNumber(node, 'pivotY', '0'),
          rotation: getNumber(node, 'rotation', '0'),
          scaleX: getNumber(node, 'scaleX', '1'),
          scaleY: getNumber(node, 'scaleY', '1'),
          translateX: getNumber(node, 'translateX', '0'),
          translateY: getNumber(node, 'translateY', '0'),
        });
      }
    }

    return undefined;
  };
开发者ID:arpitsaan,项目名称:ShapeShifter,代码行数:57,代码来源:VectorDrawableLoader.ts


示例3: function

export default function(state: State = [], action: Action): State {
  switch (action.type) {
    case 'ADD_GLOBAL_MESSAGE':
      return [{ id: action.id, message: action.message, level: action.level }];

    case 'REQUIRE_AUTHORIZATION':
      // FIXME l10n
      return [
        {
          id: uniqueId('global-message-'),
          message:
            'You are not authorized to access this page. ' +
            'Please log in with more privileges and try again.',
          level: MessageLevel.Error
        }
      ];

    case 'CLOSE_GLOBAL_MESSAGE':
      return state.filter(message => message.id !== action.id);

    case 'CLOSE_ALL_GLOBAL_MESSAGES':
      return [];
    default:
      return state;
  }
}
开发者ID:flopma,项目名称:sonarqube,代码行数:26,代码来源:globalMessages.ts


示例4: parseInt

const addUsers = (count, knex, date) => {
  count = parseInt(count)
  const rows = []

  for (let i = 0; i < count; i++) {
    const channel = _.sample(channels)
    const id = _.uniqueId()

    const first_name = { key: 'first_name', value: generateName(), type: 'string' }
    const last_name = { key: 'last_name', value: generateName(), type: 'string' }
    const gender = { key: 'gender', value: Math.random() < vary(0.65, 0.35) ? 'male' : 'female', type: 'string' }
    const locale = { key: 'locale', value: _.sample(['en_US', 'fr_CA', 'en_CA']), type: 'string' }
    const timezone = { key: 'timezone', value: _.random(-6, 12, false), type: 'string' }

    const user = {
      user_id: id,
      channel: channel,
      attributes: JSON.stringify([first_name, last_name, gender, locale, timezone]),
      created_at: date
    }

    users.push(user)
    rows.push(user)
  }

  return knex.batchInsert('srv_channel_users', rows, 20).then(() => console.log('Added', count, 'users'))
}
开发者ID:alexsandrocruz,项目名称:botpress,代码行数:27,代码来源:seed.ts


示例5: if

 _.forEach(object, (value, key) => {
     if (_.isFunction(value)) {
         const id = _.uniqueId('CARTE_BLANCHE_FUNCTION_');
         functionStore[id] = value.toString();
         object[key] = id; // eslint-disable-line no-param-reassign
     } else if (_.isObject(value)) {
         extractAndReplaceFunctions(value);
     }
 });
开发者ID:joaogarin,项目名称:carte-blanche-angular2,代码行数:9,代码来源:propsToVariation.ts


示例6: constructor

  constructor(panel: Object) {
    this.datasource = panel['datasource'];
    this.id         = panel['id'];
    this.scopedVars = panel['scopedVars'];
    this.targets    = panel['targets'];
    this.title      = panel['title'];
    this.uid        = _.uniqueId();

    this.thresholds = this.getThresholds(panel);
  };
开发者ID:mark-5,项目名称:grafana-kpi-panel,代码行数:10,代码来源:panel.ts


示例7: createTestServer

export default function createTestServer() {
    logger.level = 'warn';

    const server = ServerFactory.createServer({
        configFileName: path.resolve(__dirname, '../config/config.tests.json')
    });

    nconf.set('devModeFakeUserIdToSkipAuthentication', _.uniqueId());

    return server;
}
开发者ID:itsuryev,项目名称:tp-oauth-server,代码行数:11,代码来源:testServerFactory.ts


示例8: it

 it('should build for proxied configuration', () => {
     const configuration = {
         resolver: AccountInfo.AccountResolver.TpOndemandCom,
         targetprocessAuthorizationProxyPath: '/oauth/authorize',
         useRequestHostNameForTpLoginReturnUrl: false
     };
     const testAccountName = _.uniqueId('testAccountName-');
     const currentRequestUrl = 'http://unused:1234/unusedAsWell?foo=1&bar=2';
     const returnUrl = AccountInfo.buildTargetprocessAuthReturnUrl(configuration, testAccountName, currentRequestUrl);
     expect(returnUrl).to.be.equal(`http://${testAccountName}.tpondemand.com/oauth/authorize?foo=1&bar=2`);
 });
开发者ID:itsuryev,项目名称:tp-oauth-server,代码行数:11,代码来源:accountInfoTests.ts


示例9: startTimer

 startTimer(): number {
   if (!this.proccessing) {
     console.log('Start Timer');
     this.proccessing = true;
     this.startTime = lodash.now();
     this.filterId = '' + this.startTime + lodash.uniqueId();
     this.endTime = null;
     this.textFinished = null;
   }
   return this.startTime;
 }
开发者ID:ovrmrw,项目名称:shuttle-store-sample,代码行数:11,代码来源:page4.component.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript lodash.unset函数代码示例发布时间:2022-05-25
下一篇:
TypeScript lodash.uniqWith函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap