Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

modification

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

modification - npm Package Compare versions

Comparing version 0.0.0 to 1.0.0

.npmignore

37

index.js
'use strict';
module.exports = function (obj, prop, fn) {
/**
* Return a function which will process changes on the instance based on the
* object that is provided and emit a dedicated "change" event.
*
* @param {String} suffix The suffix for the event we emit.
* @returns {Function}
* @api public
*/
module.exports = function modification(suffix) {
suffix = arguments.length ? suffix : '';
/**
* Changes processor.
*
* @param {Object} changed Properties that have to be changed.
* @returns {That} What ever the value of `this` is.
* @api public
*/
return function change(changed) {
var currently, previously
, that = this
, key;
if (!changed) return that;
for (key in changed) {
if (key in that && that[key] !== changed[key]) {
currently = changed[key];
previously = that[key];
that[key] = currently;
that.emit(key + suffix, currently, previously);
}
}
return that;
};
};

32

package.json
{
"name": "modification",
"version": "0.0.0",
"description": "Listen and apply modifications",
"version": "1.0.0",
"description": "Process changes that should be made on the prototype and emit `change` event for each changed property",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"100%": "istanbul check-coverage --statements 100 --functions 100 --lines 100 --branches 100",
"test": "mocha test.js",
"watch": "mocha --watch test.js",
"coverage": "istanbul cover ./node_modules/.bin/_mocha -- test.js",
"test-travis": "istanbul cover node_modules/.bin/_mocha --report lcovonly -- test.js"
},
"repository": {
"type": "git",
"url": "https://github.com/observing/modification"
"url": "https://github.com/unshiftio/modification"
},
"keywords": [
"change",
"observe",
"diff",
"changes",
"modification",
"changes",
"observer",
"observing",
"object"
"modify",
"process",
"update"
],

@@ -26,5 +28,11 @@ "author": "Arnout Kazemier",

"bugs": {
"url": "https://github.com/observing/modification/issues"
"url": "https://github.com/unshiftio/modification/issues"
},
"homepage": "https://github.com/observing/modification"
"homepage": "https://github.com/unshiftio/modification",
"devDependencies": {
"assume": "1.1.x",
"istanbul": "0.3.x",
"mocha": "2.1.x",
"pre-commit": "1.0.x"
}
}
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