index.js
function selfContained(collection) {
  const proto = getPrototypeOf(collection);
  /* istanbul ignore if */
  if (!proto || getPrototypeOf(proto) !== ObjectPrototype) {
    // The loop below is insufficient.
    throw new Error();
  }
  for (const key of getOwnPropertyNames(proto)) {
    defineProperty(collection, key, { value: collection[key] });
  }
  return collection;
}
function selfContained(collection) {
  const proto = getPrototypeOf(collection);
  /* istanbul ignore if */
  if (!proto || getPrototypeOf(proto) !== ObjectPrototype) {
    // The loop below is insufficient.
    throw new Error();
  }
  for (const key of getOwnPropertyNames(proto)) {
    defineProperty(collection, key, { value: collection[key] });
  }
  return collection;
}
function selfContained ( collection ) { const proto = getPrototypeOf ( collection ) ; /* istanbul ignore if */ if ( ! proto || getPrototypeOf ( proto ) !== ObjectPrototype ) { // The loop below is insufficient. throw new Error ( ) ; } for ( const key of getOwnPropertyNames ( proto ) ) { defineProperty ( collection , key , { value : collection [ key ] } ) ; } return collection ; }
eslint-disable-line no-unused-vars, init-declarations 
Called before attacker-controlled code on an internal collections,
copies prototype members onto the instance directly, so that later
changes to prototypes cannot expose collection internals.
@param {!T} collection
@return {!T} collection
@template T
eslint - disable - line no - unused - vars init - declarations Called before attacker - controlled code on an internal collections copies prototype members onto the instance directly so that later changes to prototypes cannot expose collection internals .