lib/jsonpath-object-transform.js
/**
   * Get single property from data object.
   *
   * @param {object} data
   * @param {string} pathStr
   * @param {object} result
   * @param {string} key
   */
Get single property from data object.
Get single property from data object .
function seekSingle(data, pathStr, result, key) {
    if(pathStr.indexOf('$') < 0){
      result[key] = pathStr;
    }else{
      var seek = jsonPath.eval(data, pathStr) || [];
      result[key] = seek.length ? seek[0] : undefined;
    }
  }
function seekSingle ( data , pathStr , result , key ) { if ( pathStr . indexOf ( '$' ) < 0 ) { result [ key ] = pathStr ; } else { var seek = jsonPath . eval ( data , pathStr ) || [ ] ; result [ key ] = seek . length ? seek [ 0 ] : undefined ; } }
Get single property from data object.
Get single property from data object .