Sha256: f1585ca4528f663aa703b2a4d91677a7b3dc6fbf2b329d571f2471d3d6a300d4

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

"use strict";

module.exports.mixin = function mixin(target, source) {
  const keys = Object.getOwnPropertyNames(source);
  for (let i = 0; i < keys.length; ++i) {
    if (keys[i] in target) {
      continue;
    }

    Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i]));
  }
};

const wrapperSymbol = Symbol("wrapper");
const implSymbol = Symbol("impl");

function wrapperForImpl(impl) {
  return impl ? impl[wrapperSymbol] : null;
};

function implForWrapper(wrapper) {
  return wrapper ? wrapper[implSymbol] : null;
};

function tryWrapperForImpl(impl) {
  const wrapper = wrapperForImpl(impl);
  return wrapper ? wrapper : impl;
};

function tryImplForWrapper(wrapper) {
  const impl = implForWrapper(wrapper);
  return impl ? impl : wrapper;
};

module.exports.wrapperSymbol = wrapperSymbol;
module.exports.implSymbol = implSymbol;
module.exports.wrapperForImpl = wrapperForImpl;
module.exports.implForWrapper = implForWrapper;
module.exports.tryWrapperForImpl = tryWrapperForImpl;
module.exports.tryImplForWrapper = tryImplForWrapper;

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
select_all-rails-0.3.1 node_modules/jsdom/lib/jsdom/living/generated/utils.js