CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes45downloads
plant.js49 linesDownload Raw Back to lodash
1var baseLodash = require('./_baseLodash'),2    wrapperClone = require('./_wrapperClone');3 4/**5 * Creates a clone of the chain sequence planting `value` as the wrapped value.6 *7 * @name plant8 * @memberOf _9 * @since 3.2.010 * @category Seq11 * @param {*} value The value to plant.12 * @returns {Object} Returns the new `lodash` wrapper instance.13 * @example14 *15 * function square(n) {16 *   return n * n;17 * }18 *19 * var wrapped = _([1, 2]).map(square);20 * var other = wrapped.plant([3, 4]);21 *22 * other.value();23 * // => [9, 16]24 *25 * wrapped.value();26 * // => [1, 4]27 */28function wrapperPlant(value) {29  var result,30      parent = this;31 32  while (parent instanceof baseLodash) {33    var clone = wrapperClone(parent);34    clone.__index__ = 0;35    clone.__values__ = undefined;36    if (result) {37      previous.__wrapped__ = clone;38    } else {39      result = clone;40    }41    var previous = clone;42    parent = parent.__wrapped__;43  }44  previous.__wrapped__ = value;45  return result;46}47 48module.exports = wrapperPlant;49 
basant307/AI_Governance_Project · CoolFace