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

TypeScript array.A函数代码示例

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

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



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

示例1: test

  test('it honors an explicit key', function(assert) {
    const logger = debugLogger('test:sample-key');
    logger('placeholder message');

    let [message] = A(log.args).get('lastObject') || [''];
    assert.ok(/test:sample-key/.test(message), 'Log entry should contain the namespace');
    assert.ok(/placeholder message/.test(message), 'Log entry should contain the message');
  });
开发者ID:salsify,项目名称:ember-debug-logger,代码行数:8,代码来源:debug-logger-test.ts


示例2: getHeader

/**
 * Do a case-insensitive lookup of an HTTP header
 *
 * @function getHeader
 * @private
 */
export default function getHeader(
  headers: Headers | undefined,
  name: string | undefined
): string | undefined | null {
  if (isNone(headers) || isNone(name)) {
    return undefined;
  }

  const matchedKey = A(Object.keys(headers)).find(key => {
    return key.toLowerCase() === name.toLowerCase();
  });

  return matchedKey ? headers[matchedKey] : undefined;
}
开发者ID:knownasilya,项目名称:ember-ajax,代码行数:20,代码来源:get-header.ts


示例3: items

 @computed('value.@each')
 get items() : MutableArray<string> {
   return this.value ? this.value : A();
 }
开发者ID:pjcarly,项目名称:ember-mist-components,代码行数:4,代码来源:component.ts


示例4: A

import { assertType } from './lib/assert';
import EmberObject from '@ember/object';
import EmberArray, { A } from '@ember/array';
import MutableArray from '@ember/array/mutable';

type Person = typeof Person.prototype;
const Person = EmberObject.extend({
    name: '',
    isHappy: false
});

const people = A([
    Person.create({ name: 'Yehuda', isHappy: true }),
    Person.create({ name: 'Majd', isHappy: false }),
]);

assertType<number>(people.get('length'));
assertType<Person>(people.get('lastObject'));
assertType<Person>(people.get('firstObject'));
assertType<boolean>(people.isAny('isHappy'));
assertType<boolean>(people.isAny('isHappy', 'false'));

const persons1: Person[] = people.filterBy('isHappy');
const persons2: MutableArray<Person> = people.filterBy('isHappy');
const persons3: Person[] = people.rejectBy('isHappy');
const persons4: MutableArray<Person> = people.rejectBy('isHappy');
const persons5: Person[] = people.filter((person) => person.get('name') === 'Yehuda');
const persons6: MutableArray<Person> = people.filter((person) => person.get('name') === 'Yehuda');

assertType<typeof people>(people.get('[]'));
assertType<Person>(people.get('[]').get('firstObject')); // $ExpectType any
开发者ID:AlexGalays,项目名称:DefinitelyTyped,代码行数:31,代码来源:array.ts


示例5: A

 (function() {
   return A(records).every(record => record.hasOwnProperty('_internalModel') === true);
 })()
开发者ID:emberjs,项目名称:data,代码行数:3,代码来源:internal-model.ts


示例6: deserialize

 deserialize(serialized: any) {
   serialized = A(serialized);
   return serialized;
 }
开发者ID:pjcarly,项目名称:ember-mist-components,代码行数:4,代码来源:strings.ts


示例7: _shouldSendHeaders

   * This hook is used to help prevent sending headers to every host, regardless
   * of the destination, since this could be a security issue if authentication
   * tokens are accidentally leaked to third parties.
   *
   * To avoid that problem, subclasses should utilize the `headers` computed
   * property to prevent authentication from being sent to third parties, or
   * implement this hook for more fine-grain control over when headers are sent.
   *
   * By default, the headers are sent if the host of the request matches the
   * `host` property designated on the class.
   */
  _shouldSendHeaders({ url, host }: AJAXOptions) {
    url = url || '';
    host = host || get(this, 'host') || '';

    const trustedHosts = get(this, 'trustedHosts') || A<Matcher>();
    const { hostname } = parseURL(url);

    // Add headers on relative URLs
    if (!isFullURL(url)) {
      return true;
    } else if (
      trustedHosts.find(matcher => this._matchHosts(hostname, matcher))
    ) {
      return true;
    }

    // Add headers on matching host
    return haveSameHost(url, host);
  },
开发者ID:knownasilya,项目名称:ember-ajax,代码行数:30,代码来源:ajax-request.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript component.extend函数代码示例发布时间:2022-05-28
下一篇:
TypeScript instance.lookup函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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