示例#1
0
文件: get.js 项目: javari78/ember.js
  compute() {
    let { lastPath, innerReference, innerTag } = this;

    let path = this.lastPath = this.pathReference.value();

    if (path !== lastPath) {
      if (path !== undefined && path !== null) {
        let pathType = typeof path;

        if (pathType === 'string') {
          innerReference = referenceFromParts(this.sourceReference, path.split('.'));
        } else if (pathType === 'number') {
          innerReference = this.sourceReference.get('' + path);
        }

        innerTag.update(innerReference.tag);
      } else {
        innerReference = NULL_REFERENCE;
        innerTag.update(CONSTANT_TAG);
      }

      this.innerReference = innerReference;
    }

    return innerReference.value();
  }
示例#2
0
文件: get.js 项目: javari78/ember.js
 static create(sourceReference, pathReference) {
   if (isConst(pathReference)) {
     let parts = pathReference.value().split('.');
     return referenceFromParts(sourceReference, parts);
   } else {
     return new GetHelperReference(sourceReference, pathReference);
   }
 }