TypeScript @angular-core-src-facade-lang.isString类(方法)实例源码

下面列出了TypeScript @angular-core-src-facade-lang.isString 类(方法)源码代码实例,从而了解它的用法。

作者:Angular-Referenc    项目:ng2-validat   
public static check(control: AbstractControl): boolean {
        if (isBlank(control.value) || (isString(control.value) && control.value.trim() === '')) {
            return false;
        }

        return true;
    }

作者:ajeetkanoji    项目:ReDo   
transform(value) {
   if (isBlank(value)) return value;
   if (!isString(value)) {
     throw new InvalidPipeArgumentException(JsonPointerEscapePipe, value);
   }
   return JsonPointer.escape(value);
 }

作者:node-packag    项目:dashboar   
transform(value:number):any {
        if (isNumber(value)) {
            return new Date(value * 1000);
        } else {
            if (isString(value)) {
                return new Date(value);
            }
        }

    }

作者:ajeetkanoji    项目:ReDo   
_normalizeOptions() {
    // modify scrollYOffset to always be a function
    if (!isFunction(this._options.scrollYOffset)) {
      if (isFinite(this._options.scrollYOffset)) {
        // if number specified create function that returns this value
        let numberOffset = parseFloat(this._options.scrollYOffset);
        this.options.scrollYOffset = () => numberOffset;
      } else {
        // if selector or node function that returns bottom offset of this node
        let el = this._options.scrollYOffset;
        if (!(el instanceof Node)) {
          el = this.dom.query(el);
        }
        if (!el) {
          this._options.scrollYOffset = () => 0;
        } else {
          this._options.scrollYOffset = () => el.offsetTop + el.offsetHeight;
        }
      }
    }

    if (isString(this._options.disableLazySchemas)) this._options.disableLazySchemas = true;
    if (isString(this._options.suppressWarnings)) this._options.suppressWarnings = true;
  }

作者:BerniceChu    项目:land   
export function stringifyElement(el): string {
  var result = '';
  if (DOM.isElementNode(el)) {
    var tagName = DOM.tagName(el).toLowerCase();
    // Opening tag
    result += `<${tagName}`;
    // Attributes in an ordered way
    var attributeMap = DOM.attributeMap(el);
    var keys = [];
    attributeMap.forEach((v, k) => { keys.push(k); });
    keys.sort();
    for (let i = 0; i < keys.length; i++) {
      var key = keys[i];
      var attValue = attributeMap.get(key);
      if (!isString(attValue)) {
        result += ` ${key}`;
      } else {
        result += ` ${key}="${attValue}"`;
      }
    }
    result += '>';
    // Children
    var children = DOM.childNodes(DOM.templateAwareRoot(el));
    for (let j = 0; j < children.length; j++) {
      result += stringifyElement(children[j]);
    }
    // Closing tag
    if (!ListWrapper.contains(_singleTagWhitelist, tagName)) {
      result += `</${tagName}>`;
    }
  } else if (DOM.isCommentNode(el)) {
    result += `<!--${DOM.nodeValue(el)}-->`;
  } else {
    result += DOM.getText(el);
  }
  return result;
}


问题


面经


文章

微信
公众号

扫码关注公众号