Make share data look like apiv2 preprints data and pull out identifiers

@private
@method transformShareData
@param {Object} result - hit from a SHARE ES
@return {Object}
487262
function transformShareData(result) {
    const transformedResult = Ember.assign(result._source, {
        id: result._id,
        type: 'elastic-search-result',
        workType: result._source['@type'],
        abstract: result._source.description,
        subjects: result._source.subjects.map(each => ({ text: each })),
        subject_synonyms: result._source.subject_synonyms.map(each => ({ text: each })),
        providers: result._source.sources.map(item => ({
            name: item,
        })),
        hyperLinks: [ // Links that are hyperlinks from hit._source.lists.links
            {
                type: 'share',
                url: `${config.OSF.shareBaseUrl}${result._source.type.replace(/ /g, '')}/${result._id}`,
            },
        ],
        infoLinks: [], // Links that are not hyperlinks  hit._source.lists.links
        registrationType: result._source.registration_type, // for registries
    });

    result._source.identifiers.forEach(function(identifier) {
        if (identifier.startsWith('http://')) {
            transformedResult.hyperLinks.push({ url: identifier });
        } else {
            const spl = identifier.split('://');
            const [type, uri] = spl;
            transformedResult.infoLinks.push({ type, uri });
        }
    });

    transformedResult.contributors = transformedResult.lists.contributors ?
        sortContributors(transformedResult.lists.contributors) :
        [];

    // Temporary fix to handle half way migrated SHARE ES
    // Only false will result in a false here.
    transformedResult.contributors.map((contributor) => {
        const contrib = contributor;
        contrib.users.bibliographic = !(contributor.users.bibliographic === false);
        return contrib;
    });

    return transformedResult;
}
727342
private static List<String> getResultIds(JsonNode result)
  {
    JsonNode resultIds = result.path("data").path("resultIds");
    if (resultIds.isNull() ||
        resultIds.isMissingNode() ||
        resultIds.asText().isEmpty())
    {
      return Collections.emptyList();
    }
    return new ArrayList<>(Arrays.asList(resultIds.asText().split(",")));
  }
1374821
function normalizeResult(result){
    if (!result || result._isResponseData !== true)
        return ResponseData(result,{default:true})
    return result
}
1040043
function resultToEither(result) {
  if(isFunction(result)) {
    return function(x) {
      const m = result(x)

      if(!isSameType(Result, m)) {
        throw new TypeError('resultToEither: Result returning function required')
      }

      return applyTransform(m)
    }
  }

  if(isSameType(Result, result)) {
    return applyTransform(result)
  }

  throw new TypeError('resultToEither: Result or Result returning function required')
}
307323
def jsonify(result, format=False):
    '''  '''

    result2 = result.copy()
    if format:
        return json.dumps(result2, sort_keys=True, indent=4)
    else:
        return json.dumps(result2, sort_keys=True)
661182
function gotResults(results) {
  results.JSONquery = JSON.stringify(results.query, null, 2);
  console.log('gotResults', results);
  updateResults(results);
}
211853
function createFile(chainedResult) {
	const {owner, repo, path, message, content, branch} = chainedResult
	return github.repos.createFile({owner, repo, path, message, branch, content: encodeContent(content)})
		.then(result=>({...chainedResult, sha: result.data.content.sha}))
}
695443
function(data) {
		if( typeof data == "string" ) {
			var transformed = {};
			$.each(data.split(/\s/), function() {
				transformed[this] = true;
			});
			data = transformed;
		}
		return data;
	}
583226
function executeRelatedResult (result) {
    // load related records or resolve/with in parallel
    return Promise.all([
        this.executeRelatedResultResolve(result),
        this.executeRelatedResultWith(result),
    ])
    // resolve with result with related data merged in
    .then(() => result)
}
1109974
function (responseObject, next) {
    responseObject.fileResult = new FileResult(share, directory, file);
    if (!responseObject.error) {
      responseObject.fileResult.exists = true;
      responseObject.fileResult.getPropertiesFromHeaders(responseObject.response.headers);
      
    } else if (responseObject.error && responseObject.error.statusCode === Constants.HttpConstants.HttpResponseCodes.NotFound) {
      responseObject.error = null;
      responseObject.fileResult.exists = false;
      responseObject.response.isSuccessful = true;
    }

    var finalCallback = function (returnObject) {
      callback(returnObject.error, returnObject.fileResult, returnObject.response);
    };

    next(responseObject, finalCallback);
  }
578809
function formatPageResponse(result) {
    var response = {};

    if (result.posts) {
        response.posts = result.posts;
    }

    if (result.meta && result.meta.pagination) {
        response.pagination = result.meta.pagination;
    }

    _.each(result.data, function (data, name) {
        if (data.meta) {
            // Move pagination to be a top level key
            response[name] = data;
            response[name].pagination = data.meta.pagination;
            delete response[name].meta;
        } else {
            // This is a single object, don't wrap it in an array
            response[name] = data[0];
        }
    });

    return response;
}
1316527
protected void transformTo(final Result result) throws TransformerException {
        withExceptionHandling(new Trans<Object>() {
                public Object transform() {
                    transformation.transformTo(result);
                    return null;
                }
            });
    }
238280
function addUpdated(results) {
  results.forEach(function(result) {
    result = normalizeResult(result);
    if (!lastQuery.results.hits) {
      lastQuery = { results: { hits: { total : 0, hits: [] } } };
    } else {
      var i = 0, l = lastQuery.results.hits.hits.length;
      for (i; i < l; i++) {
        if (lastQuery.results.hits.hits[i]._source.uri === result._source.uri) {
          lastQuery.results.hits.hits.splice(i, 1);
          break;
        }
      }
    }
    lastQuery.results.hits.hits.unshift(result);
  });
  updateResults(lastQuery);
}
909066
function( arr, results ) {
		var ret = results || [];

		if ( arr != null ) {
			if ( isArraylike( Object(arr) ) ) {
				jQuery.merge( ret,
					typeof arr === "string" ?
					[ arr ] : arr
				);
			} else {
				core_push.call( ret, arr );
			}
		}

		return ret;
	}
499576
public void transform(Result result) {
    if (logger.isInfoEnabled())
      logger.info("Transforming source into result");
    try {
      if (content == null) {
        throw new IllegalStateException("No source to transform");
      }

      Transformer transformer = null;
      if (this.transformer != null) {
        transformer = getTransformer();
      } else {
        if (logger.isWarnEnabled())
          logger.warn("No transformer, so using identity transform");
        transformer = TransformerFactory.newInstance().newTransformer();
      }

      transformer.transform(content, result);
    } catch (TransformerException e) {
      logger.error("Failed to transform source into result",e);
      throw new MarkLogicIOException(e);
    }
  }
1328372
function(results) {
        if (results) {
            var isRows = !!results.rows;
            var numResults = (results.rows ? results.rows.length : (results.columns[0] || []).length);
            
            console.log("====== " + numResults + " RESULTS (preview: " + !!results.preview + ") ======");
            
            // If it is in column-major form, transpose it.
            if (!isRows) {
                results = transpose(results);
            }
            
            printRows(results);
        }
    }
1191170
function newInstance (result) {
    // return raw result or new instnace
    return this.args.raw
        ? result
        : this.model.newInstance({
            allow: this.args.allow,
            model: this.model,
            plain: this.args.plain,
            raw: result,
            session: this.session,
        })
}