Sha256: a48b2b07d6211fc83cec2bf8937d3eee8ef2cd4569cf08c1d1507f1b80a599df

Contents?: true

Size: 888 Bytes

Versions: 23

Compression:

Stored size: 888 Bytes

Contents

'use strict'

var xtend = require('xtend')
var inherits = require('inherits')

module.exports = unherit

// Create a custom constructor which can be modified without affecting the
// original class.
function unherit(Super) {
  var result
  var key
  var value

  inherits(Of, Super)
  inherits(From, Of)

  // Clone values.
  result = Of.prototype

  for (key in result) {
    value = result[key]

    if (value && typeof value === 'object') {
      result[key] = 'concat' in value ? value.concat() : xtend(value)
    }
  }

  return Of

  // Constructor accepting a single argument, which itself is an `arguments`
  // object.
  function From(parameters) {
    return Super.apply(this, parameters)
  }

  // Constructor accepting variadic arguments.
  function Of() {
    if (!(this instanceof Of)) {
      return new From(arguments)
    }

    return Super.apply(this, arguments)
  }
}

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
trusty-cms-5.0.7 node_modules/unherit/index.js
trusty-cms-5.0.6 node_modules/unherit/index.js
trusty-cms-5.0.5 node_modules/unherit/index.js
trusty-cms-5.0.4 node_modules/unherit/index.js
trusty-cms-5.0.3 node_modules/unherit/index.js
trusty-cms-5.0.2 node_modules/unherit/index.js
trusty-cms-5.0.1 node_modules/unherit/index.js
trusty-cms-4.3.5 node_modules/unherit/index.js
trusty-cms-5.0.0 node_modules/unherit/index.js
trusty-cms-4.3.4 node_modules/unherit/index.js
trusty-cms-4.3.3 node_modules/unherit/index.js
trusty-cms-4.3.2 node_modules/unherit/index.js
trusty-cms-4.3.1 node_modules/unherit/index.js
trusty-cms-4.3 node_modules/unherit/index.js
trusty-cms-4.2.3 node_modules/unherit/index.js
trusty-cms-4.2.2 node_modules/unherit/index.js
trusty-cms-4.2.1 node_modules/unherit/index.js
trusty-cms-4.2 node_modules/unherit/index.js
trusty-cms-4.1.9 node_modules/unherit/index.js
trusty-cms-4.1.8 node_modules/unherit/index.js