Socket
Socket
Sign inDemoInstall

merge-descriptors

Package Overview
Dependencies
Maintainers
19
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

merge-descriptors - npm Package Compare versions

Comparing version 0.0.2 to 1.0.0

LICENSE

55

index.js

@@ -1,3 +0,52 @@

module.exports = function (dest, src) {
Object.getOwnPropertyNames(src).forEach(function (name) {
/*!
* merge-descriptors
* Copyright(c) 2014 Jonathan Ong
* MIT Licensed
*/
/**
* Module exports.
* @public
*/
module.exports = merge
/**
* Module variables.
* @private
*/
var hasOwnProperty = Object.prototype.hasOwnProperty
/**
* Merge the property descriptors of `src` into `dest`
*
* @param {object} dest Object to add descriptors to
* @param {object} src Object to clone descriptors from
* @param {boolean} [redefine=true] Redefine `dest` properties with `src` properties
* @returns {object} Reference to dest
* @public
*/
function merge(dest, src, redefine) {
if (!dest) {
throw new TypeError('argument dest is required')
}
if (!src) {
throw new TypeError('argument src is required')
}
if (redefine === undefined) {
// Default to true
redefine = true
}
Object.getOwnPropertyNames(src).forEach(function forEachOwnPropertyName(name) {
if (!redefine && hasOwnProperty.call(dest, name)) {
// Skip desriptor
return
}
// Copy descriptor
var descriptor = Object.getOwnPropertyDescriptor(src, name)

@@ -8,2 +57,2 @@ Object.defineProperty(dest, name, descriptor)

return dest
}
}

13

package.json
{
"name": "merge-descriptors",
"description": "Merge objects using descriptors",
"version": "0.0.2",
"version": "1.0.0",
"author": {

@@ -11,2 +11,5 @@ "name": "Jonathan Ong",

},
"contributors": [
"Douglas Christopher Wilson <doug@somethingdoug.com>"
],
"license": "MIT",

@@ -21,5 +24,7 @@ "repository": {

},
"scripts": {
"test": "make test;"
}
"files": [
"LICENSE",
"README.md",
"index.js"
]
}

@@ -1,2 +0,2 @@

# Merge Descriptors [![Build Status](https://travis-ci.org/component/merge-descriptors.png)](https://travis-ci.org/component/merge-descriptors)
# Merge Descriptors

@@ -25,26 +25,11 @@ Merge objects using descriptors.

Overwrites `destination`'s descriptors with `source`'s.
Redefines `destination`'s descriptors with `source`'s.
## License
### merge(destination, source, false)
The MIT License (MIT)
Defines `source`'s descriptors on `destination` if `destination` does not have
a descriptor by the same name.
Copyright (c) 2013 Jonathan Ong me@jongleberry.com
## License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
[MIT](LICENSE)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc