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


TypeScript RegExpWrapper.create方法代码示例

本文整理汇总了TypeScript中angular2/src/facade/lang.RegExpWrapper.create方法的典型用法代码示例。如果您正苦于以下问题:TypeScript RegExpWrapper.create方法的具体用法?TypeScript RegExpWrapper.create怎么用?TypeScript RegExpWrapper.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在angular2/src/facade/lang.RegExpWrapper的用法示例。


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

示例1: _propertiesFromRule

 _propertiesFromRule(rule): string {
   var cssText = rule.style.cssText;
   // TODO(sorvell): Safari cssom incorrectly removes quotes from the content
   // property. (https://bugs.webkit.org/show_bug.cgi?id=118045)
   // don't replace attr rules
   var attrRe = RegExpWrapper.create('[\'"]+|attr');
   if (rule.style.content.length > 0 &&
       !isPresent(RegExpWrapper.firstMatch(attrRe, rule.style.content))) {
     var contentRe = RegExpWrapper.create('content:[^;]*;');
     cssText =
         StringWrapper.replaceAll(cssText, contentRe, 'content: \'' + rule.style.content + '\';');
   }
   // TODO(sorvell): we can workaround this issue here, but we need a list
   // of troublesome properties to fix https://github.com/Polymer/platform/issues/53
   //
   // inherit rules can be omitted from cssText
   // TODO(sorvell): remove when Blink bug is fixed:
   // https://code.google.com/p/chromium/issues/detail?id=358273
   // var style = rule.style;
   // for (var i = 0; i < style.length; i++) {
   //  var name = style.item(i);
   //  var value = style.getPropertyValue(name);
   //  if (value == 'initial') {
   //    cssText += name + ': initial; ';
   //  }
   //}
   return cssText;
 }
开发者ID:188799958,项目名称:angular,代码行数:28,代码来源:shadow_css.ts

示例2: _makeScopeMatcher

 _makeScopeMatcher(scopeSelector) {
   var lre = RegExpWrapper.create('\\[');
   var rre = RegExpWrapper.create('\\]');
   scopeSelector = StringWrapper.replaceAll(scopeSelector, lre, '\\[');
   scopeSelector = StringWrapper.replaceAll(scopeSelector, rre, '\\]');
   return RegExpWrapper.create('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:7,代码来源:shadow_css.ts

示例3: _propertiesFromRule

 _propertiesFromRule(rule) {
   var cssText = rule.style.cssText;
   var attrRe = RegExpWrapper.create('[\'"]+|attr');
   if (rule.style.content.length > 0 && !isPresent(RegExpWrapper.firstMatch(attrRe, rule.style.content))) {
     var contentRe = RegExpWrapper.create('content:[^;]*;');
     cssText = StringWrapper.replaceAll(cssText, contentRe, 'content: \'' + rule.style.content + '\';');
   }
   return cssText;
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:9,代码来源:shadow_css.ts

示例4: normalizeCSS

export function normalizeCSS(css: string): string {
  css = StringWrapper.replaceAll(css, RegExpWrapper.create('\\s+'), ' ');
  css = StringWrapper.replaceAll(css, RegExpWrapper.create(':\\s'), ':');
  css = StringWrapper.replaceAll(css, RegExpWrapper.create("\\'"), '"');
  css = StringWrapper.replaceAllMapped(css, RegExpWrapper.create('url\\(\\"(.+)\\"\\)'),
                                       (match) => `url(${match[1]})`);
  css = StringWrapper.replaceAllMapped(css, RegExpWrapper.create('\\[(.+)=([^"\\]]+)\\]'),
                                       (match) => `[${match[1]}="${match[2]}"]`);
  return css;
}
开发者ID:AsherBarak,项目名称:angular,代码行数:10,代码来源:utils.ts

示例5: _applyStrictSelectorScope

 // return a selector with [name] suffix on each simple selector
 // e.g. .foo.bar > .zot becomes .foo[name].bar[name] > .zot[name]
 _applyStrictSelectorScope(selector: string, scopeSelector: string): string {
   var isRe = RegExpWrapper.create('\\[is=([^\\]]*)\\]');
   scopeSelector = StringWrapper.replaceAllMapped(scopeSelector, isRe, (m) => m[1]);
   var splits = [' ', '>', '+', '~'],
     scoped = selector,
     attrName = '[' + scopeSelector + ']';
   for (var i = 0; i < splits.length; i++) {
     var sep = splits[i];
     var parts = scoped.split(sep);
     scoped = ListWrapper.map(parts, function(p) {
       // remove :host since it should be unnecessary
       var t = StringWrapper.replaceAll(p.trim(), _polyfillHostRe, '');
       if (t.length > 0 &&
         !ListWrapper.contains(splits, t) &&
         !StringWrapper.contains(t, attrName)) {
         var re = RegExpWrapper.create('([^:]*)(:*)(.*)');
         var m = RegExpWrapper.firstMatch(re, t);
         if (isPresent(m)) {
           p = m[1] + attrName + m[2] + m[3];
         }
       }
       return p;
     }).join(sep);
   }
   return scoped;
 }
开发者ID:tavwizard,项目名称:angular,代码行数:28,代码来源:shadow_css.ts

示例6: it

      it('should return a new string with the pattern replaced', () => {
        var result1 = pipe.transform(str, ['Douglas', 'Hugh']);

        var result2 = pipe.transform(str, [RegExpWrapper.create('a'), '_']);

        var result3 = pipe.transform(str, [RegExpWrapper.create('a', 'i'), '_']);

        var f = (x => { return 'Adams!'; });

        var result4 = pipe.transform(str, ['Adams', f]);

        var result5 = pipe.transform(someNumber, ['2', '4']);

        expect(result1).toEqual('Hugh Adams');
        expect(result2).toEqual('Dougl_s Ad_ms');
        expect(result3).toEqual('Dougl_s _d_ms');
        expect(result4).toEqual('Douglas Adams!');
        expect(result5).toEqual('44');
      });
开发者ID:LordBinary,项目名称:angular,代码行数:19,代码来源:replace_pipe_spec.ts

示例7: function

 scoped = ListWrapper.map(parts, function(p) {
   var t = StringWrapper.replaceAll(p.trim(), _polyfillHostRe, '');
   if (t.length > 0 && !ListWrapper.contains(splits, t) && !StringWrapper.contains(t, attrName)) {
     var re = RegExpWrapper.create('([^:]*)(:*)(.*)');
     var m = RegExpWrapper.firstMatch(re, t);
     if (isPresent(m)) {
       p = m[1] + attrName + m[2] + m[3];
     }
   }
   return p;
 }).join(sep);
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:11,代码来源:shadow_css.ts

示例8: it

 it('should expose the index for each match', () => {
   var re = RegExpWrapper.create('(!)');
   var matcher = RegExpWrapper.matcher(re, '0!23!567!!');
   var indexes = [];
   var m;
   while (isPresent(m = RegExpMatcherWrapper.next(matcher))) {
     ListWrapper.push(indexes, m.index);
     expect(m[0]).toEqual('!');
     expect(m[1]).toEqual('!');
     expect(m.length).toBe(2);
   }
   expect(indexes).toEqual([1, 4, 8, 9]);
 });
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:13,代码来源:lang_spec.ts

示例9: parseParams

  parseParams(url: string): StringMap<string, string> {
    var params = StringMapWrapper.create();
    var urlPart = url;
    for (var i = 0; i < this.segments.length; i++) {
      var segment = this.segments[i];
      var match = RegExpWrapper.firstMatch(RegExpWrapper.create('/' + segment.regex), urlPart);
      urlPart = StringWrapper.substring(urlPart, match[0].length);
      if (segment.name.length > 0) {
        StringMapWrapper.set(params, segment.name, match[1]);
      }
    }

    return params;
  }
开发者ID:AsherBarak,项目名称:angular,代码行数:14,代码来源:path_recognizer.ts


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