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


TypeScript lang.isBlank函数代码示例

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


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

示例1: _processAsPostChrome44Event

 private _processAsPostChrome44Event(event, categories) {
   var name = event['name'];
   var args = event['args'];
   if (this._isEvent(categories, name, ['devtools.timeline', 'v8'], 'MajorGC')) {
     var normArgs = {
       'majorGc': true,
       'usedHeapSize': isPresent(args['usedHeapSizeAfter']) ? args['usedHeapSizeAfter'] :
                                                              args['usedHeapSizeBefore']
     };
     return normalizeEvent(event, {'name': 'gc', 'args': normArgs});
   } else if (this._isEvent(categories, name, ['devtools.timeline', 'v8'], 'MinorGC')) {
     var normArgs = {
       'majorGc': false,
       'usedHeapSize': isPresent(args['usedHeapSizeAfter']) ? args['usedHeapSizeAfter'] :
                                                              args['usedHeapSizeBefore']
     };
     return normalizeEvent(event, {'name': 'gc', 'args': normArgs});
   } else if (this._isEvent(categories, name, ['devtools.timeline', 'v8'], 'FunctionCall') &&
              (isBlank(args) || isBlank(args['data']) ||
               (!StringWrapper.equals(args['data']['scriptName'], 'InjectedScript') &&
                !StringWrapper.equals(args['data']['scriptName'], '')))) {
     return normalizeEvent(event, {'name': 'script'});
   } else if (this._isEvent(categories, name, ['devtools.timeline', 'blink'],
                            'UpdateLayoutTree')) {
     return normalizeEvent(event, {'name': 'render'});
   } else if (this._isEvent(categories, name, ['devtools.timeline'], 'UpdateLayerTree') ||
              this._isEvent(categories, name, ['devtools.timeline'], 'Layout') ||
              this._isEvent(categories, name, ['devtools.timeline'], 'Paint')) {
     return normalizeEvent(event, {'name': 'render'});
   }
   return null;  // nothing useful in this event
 }
开发者ID:hankduan,项目名称:angular,代码行数:32,代码来源:chrome_driver_extension.ts

示例2: _format

 static _format(value: number, style: NumberFormatStyle, digits: string, currency: string = null,
                currencyAsSymbol: boolean = false): string {
   if (isBlank(value)) return null;
   if (!isNumber(value)) {
     throw new InvalidPipeArgumentException(NumberPipe, value);
   }
   var minInt = 1, minFraction = 0, maxFraction = 3;
   if (isPresent(digits)) {
     var parts = RegExpWrapper.firstMatch(_re, digits);
     if (isBlank(parts)) {
       throw new BaseException(`${digits} is not a valid digit info for number pipes`);
     }
     if (isPresent(parts[1])) {  // min integer digits
       minInt = NumberWrapper.parseIntAutoRadix(parts[1]);
     }
     if (isPresent(parts[3])) {  // min fraction digits
       minFraction = NumberWrapper.parseIntAutoRadix(parts[3]);
     }
     if (isPresent(parts[5])) {  // max fraction digits
       maxFraction = NumberWrapper.parseIntAutoRadix(parts[5]);
     }
   }
   return NumberFormatter.format(value, defaultLocale, style, {
     minimumIntegerDigits: minInt,
     minimumFractionDigits: minFraction,
     maximumFractionDigits: maxFraction,
     currency: currency,
     currencyAsSymbol: currencyAsSymbol
   });
 }
开发者ID:beta3000,项目名称:hola-angular2,代码行数:30,代码来源:number_pipe.ts

示例3:

 return templateBindings.map(binding => {
   if (binding.keyIsVar) {
     return '#' + binding.key + (isBlank(binding.name) ? '=null' : '=' + binding.name);
   } else {
     return binding.key + (isBlank(binding.expression) ? '' : `=${binding.expression}`)
   }
 });
开发者ID:hankduan,项目名称:angular,代码行数:7,代码来源:parser_spec.ts

示例4: _resolveUrl

/**
 * Resolves a URL.
 * @param {string} base The URL acting as the base URL.
 * @param {string} to The URL to resolve.
 * @return {string}
 */
function _resolveUrl(base: string, url: string): string {
  var parts = _split(encodeURI(url));
  var baseParts = _split(base);

  if (isPresent(parts[_ComponentIndex.Scheme])) {
    return _joinAndCanonicalizePath(parts);
  } else {
    parts[_ComponentIndex.Scheme] = baseParts[_ComponentIndex.Scheme];
  }

  for (var i = _ComponentIndex.Scheme; i <= _ComponentIndex.Port; i++) {
    if (isBlank(parts[i])) {
      parts[i] = baseParts[i];
    }
  }

  if (parts[_ComponentIndex.Path][0] == '/') {
    return _joinAndCanonicalizePath(parts);
  }

  var path = baseParts[_ComponentIndex.Path];
  if (isBlank(path)) path = '/';
  var index = path.lastIndexOf('/');
  path = path.substring(0, index + 1) + parts[_ComponentIndex.Path];
  parts[_ComponentIndex.Path] = path;
  return _joinAndCanonicalizePath(parts);
}
开发者ID:chiragjraval,项目名称:AdvisroySystemPOC,代码行数:33,代码来源:url_resolver.ts

示例5: createMetric

 function createMetric(perfLogs, microMetrics = null, perfLogFeatures = null, forceGc = null,
                       captureFrames = null) {
   commandLog = [];
   if (isBlank(perfLogFeatures)) {
     perfLogFeatures = new PerfLogFeatures({render: true, gc: true, frameCapture: true});
   }
   if (isBlank(microMetrics)) {
     microMetrics = StringMapWrapper.create();
   }
   var bindings = [
     Options.DEFAULT_PROVIDERS,
     PerflogMetric.BINDINGS,
     bind(Options.MICRO_METRICS).toValue(microMetrics),
     bind(PerflogMetric.SET_TIMEOUT)
         .toValue((fn, millis) => {
           commandLog.push(['setTimeout', millis]);
           fn();
         }),
     bind(WebDriverExtension)
         .toValue(new MockDriverExtension(perfLogs, commandLog, perfLogFeatures))
   ];
   if (isPresent(forceGc)) {
     bindings.push(bind(Options.FORCE_GC).toValue(forceGc));
   }
   if (isPresent(captureFrames)) {
     bindings.push(bind(Options.CAPTURE_FRAMES).toValue(captureFrames));
   }
   return Injector.resolveAndCreate(bindings).get(PerflogMetric);
 }
开发者ID:hankduan,项目名称:angular,代码行数:29,代码来源:perflog_metric_spec.ts

示例6: _sameDirIndex

function _sameDirIndex(a: ProtoRecord, b: ProtoRecord): boolean {
  var di1 = isBlank(a.directiveIndex) ? null : a.directiveIndex.directiveIndex;
  var ei1 = isBlank(a.directiveIndex) ? null : a.directiveIndex.elementIndex;

  var di2 = isBlank(b.directiveIndex) ? null : b.directiveIndex.directiveIndex;
  var ei2 = isBlank(b.directiveIndex) ? null : b.directiveIndex.elementIndex;

  return di1 === di2 && ei1 === ei2;
}
开发者ID:chiragjraval,项目名称:AdvisroySystemPOC,代码行数:9,代码来源:coalesce.ts

示例7: _parseChromeVersion

 private _parseChromeVersion(userAgent: string): number {
   if (isBlank(userAgent)) {
     return -1;
   }
   var v = StringWrapper.split(userAgent, /Chrom(e|ium)\//g)[2];
   if (isBlank(v)) {
     return -1;
   }
   v = StringWrapper.split(v, /\./g)[0];
   if (isBlank(v)) {
     return -1;
   }
   return NumberWrapper.parseInt(v, 10);
 }
开发者ID:hankduan,项目名称:angular,代码行数:14,代码来源:chrome_driver_extension.ts

示例8: kvChangesAsString

export function kvChangesAsString(
    {map, previous, additions, changes, removals}:
        {map?: any[], previous?: any[], additions?: any[], changes?: any[], removals?: any[]}):
    string {
  if (isBlank(map)) map = [];
  if (isBlank(previous)) previous = [];
  if (isBlank(additions)) additions = [];
  if (isBlank(changes)) changes = [];
  if (isBlank(removals)) removals = [];

  return "map: " + map.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" +
         "additions: " + additions.join(', ') + "\n" + "changes: " + changes.join(', ') + "\n" +
         "removals: " + removals.join(', ') + "\n";
}
开发者ID:hankduan,项目名称:angular,代码行数:14,代码来源:util.ts

示例9: transform

 transform(value: any, args: any[] = null): any {
   if (isBlank(args) || args.length == 0) {
     throw new BaseException('Slice pipe requires one argument');
   }
   if (!this.supports(value)) {
     throw new InvalidPipeArgumentException(SlicePipe, value);
   }
   if (isBlank(value)) return value;
   var start: number = args[0];
   var end: number = args.length > 1 ? args[1] : null;
   if (isString(value)) {
     return StringWrapper.slice(value, start, end);
   }
   return ListWrapper.slice(value, start, end);
 }
开发者ID:,项目名称:,代码行数:15,代码来源:

示例10:

 elementInjector.getDirectiveVariableBindings().forEach((directiveIndex, name) => {
   if (isBlank(directiveIndex)) {
     view.locals.set(name, view.elementRefs[boundElementIdx].nativeElement);
   } else {
     view.locals.set(name, elementInjector.getDirectiveAtIndex(directiveIndex));
   }
 });
开发者ID:beta3000,项目名称:hola-angular2,代码行数:7,代码来源:view_manager_utils.ts


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