{"_id":"property","_rev":"16-d6242b4ef193a7c299f7fe97c8688134","name":"property","time":{"modified":"2022-06-24T20:16:10.465Z","created":"2013-07-24T00:06:37.205Z","0.0.0":"2013-07-24T00:06:39.863Z","1.0.0":"2014-02-23T19:52:49.119Z","2.0.0":"2016-03-22T23:50:41.878Z","0.0.1-security":"2016-03-23T22:20:53.462Z","3.0.0":"2016-05-13T07:50:52.512Z"},"maintainers":[{"email":"g.rantila@gmail.com","name":"grantila"}],"dist-tags":{"latest":"3.0.0"},"readme":"# property\n\n*property* is a getter-setter wrapper object, which wraps any value. The value is read by calling the property without an argument, and is set by calling the property with the value as argument.\n\n`property` objects emit events to notify when they are changed.\n\nThe idea behind `property` comes from mithril's `m.prop()` feature, which is useful not only in mithril, but together with other frameworks, e.g. React.\n\n## Usage\n\n```js\nvar property = require( 'property' );\n\nvar prop = property( ); // Creates a property\nprop( );     // Returns undefined\nprop( 5 );   // Sets value 5\nprop( );     // Returns 5\nprop( \"x\" ); // Sets value \"x\"\nprop( );     // Returns \"x\"\n\nvar prop2 = property( \"test\" ); // Creates a property with initial value \"test\"\nprop( ); // Returns \"test\"\n\nvar prop3 = property( 1 );\nprop3.emitter.on( 'data', data => console.log( data ) );\nprop3( prop3( ) + 1 ); // Reads value, adds one, then sets value\n// console.log: 2\n```\n\nSince event emitters are used, if you add a listener, you must remember to remove the listener when appropriate, or your application will leak memory. This applies to all usages of event emitters, `property` is no exception.\n\n### Manually triggering change events\n\nTo trigger an event to be sent, use the `notify( )` function. This can be useful if you want to bypass built-in getter-setter notification by modifying internal properties in the object.\n\n```js\nvar prop = property( { } );\n// ...\nprop( )[ \"hello\" ] = \"world\"; // Modifies the object, but will not notify\nprop.notify( );               // Manually notify\n```\n\n## Masquerading\n\n### Property objects fit in JSON objects\n\nA property object is auto-convertible to JSON.\n\n```js\nvar prop = property( { a: 1 } );\nJSON.stringify( { p: prop } ); // -> { p: { a: 1 } }\n```\n\n### Property objects forward `toString` and `valueOf`.\n\nA property object has a `toString` and a `valueOf` function which forwards to the underlying value.\n\n```js\nvar prop = property( 1 );\n1 + prop; // -> 2\n\nvar prop2 = property( \"world\" );\n\"hello \" + prop2; // -> \"hello world\"\n```\n","versions":{"2.0.0":{"name":"property","version":"2.0.0","description":"","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"","license":"ISC","_id":"property@2.0.0","_shasum":"7e41795c84ce33742ffe97b7f86c2f4d1d2a5d73","_from":".","_npmVersion":"3.7.2","_nodeVersion":"4.3.0","_npmUser":{"name":"nj48","email":"spam@njohnson.me"},"dist":{"shasum":"7e41795c84ce33742ffe97b7f86c2f4d1d2a5d73","tarball":"https://registry.npmjs.org/property/-/property-2.0.0.tgz","integrity":"sha512-AFrfT57TxG4mcorQ3KIbVnVgcpG5jek25t7I6FoWEcN6kVtFrGEZKt2uxWV42gtB+Yqn+G9eZDRM1jJJ6fFB0w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC1IHpC2KzITwNUSspid/F5U1j03BJwX+cgEpQUCqLMDgIgFuTyJSEycef6Bt07+jEigifXiugXkZd/Vngjcoe2r9o="}]},"maintainers":[{"name":"nj48","email":"spam@njohnson.me"}],"directories":{}},"0.0.1-security":{"name":"property","version":"0.0.1-security","description":"This package name is not currently in use, but was formerly occupied by a popular package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/npm/security-holder.git"},"keywords":[],"author":"","license":"ISC","bugs":{"url":"https://github.com/npm/security-holder/issues"},"homepage":"https://github.com/npm/security-holder#readme","gitHead":"d1719e2a152734ed854065de56039770c9104d83","_id":"property@0.0.1-security","_shasum":"a22658b8d4a922f219c009e12758309a0f1f15d2","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.1.0","_npmUser":{"name":"npm","email":"npm@npmjs.com"},"dist":{"shasum":"a22658b8d4a922f219c009e12758309a0f1f15d2","tarball":"https://registry.npmjs.org/property/-/property-0.0.1-security.tgz","integrity":"sha512-NCndh/hdfAEfhfCtmL2f3tsXFJ8Djus1D3GuoGQORxvPlHTGEUu5g9COVyUa+dpW2EYhsGIbyrwpm6RQRNmXLA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDtLRp90apIJjgPvRcKQ7T+PI8C2gnk3BmQkWpabk2KmAIhAKJ8rM3bzgGXERVh+rGhDwfv3wYRpAWfwbV8QM112TYD"}]},"maintainers":[{"name":"nj48","email":"spam@njohnson.me"}],"directories":{}},"0.0.0":{"name":"property","version":"0.0.0","description":"Minimalistic, extensible properties","main":"index.js","scripts":{"test":"fox"},"devDependencies":{"fox":"*"},"repository":{"url":"git@github.com:azer/property.git","type":"git"},"author":"Azer Koculu <azer@kodfabrik.com>","license":"BSD","_id":"property@0.0.0","_npmVersion":"0.0.0-fake","_nodeVersion":"0.0.0-fake","_shasum":"5616f4d3910dbed1597c021981b42b62c1a0f6a6","_npmUser":{"name":"npm","email":"support@npmjs.com"},"_from":".","dist":{"shasum":"5616f4d3910dbed1597c021981b42b62c1a0f6a6","tarball":"https://registry.npmjs.org/property/-/property-0.0.0.tgz","integrity":"sha512-MMPFkG0syqQBc4Se0rcnLq5e/hqDa3MySB4zUWFaM9bDrx/5HZrKC5c9jTtH+dbmb9XHalQ4vJNwDrezROBP3Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF4B7wJIzhPsitU3SM1incMsWki/klCM7RJZ+9VTD13dAiB7tVMI7R+DFz/cIBH/f8t52a/ZYsfCEpqut7giNoTw1Q=="}]},"maintainers":[{"name":"npm","email":"npm@npmjs.com"}]},"1.0.0":{"name":"property","version":"1.0.0","description":"Library for creating functional properties","main":"index.js","scripts":{"test":"prova"},"devDependencies":{"prova":"*"},"repository":{"url":"git@github.com:azer/property.git","type":"git"},"author":"Azer Koculu <azer@kodfabrik.com>","license":"BSD","_id":"property@1.0.0","_npmVersion":"0.0.0-fake","_nodeVersion":"0.0.0-fake","_shasum":"b4920670e9f66603a72a046461abb6895ea4a827","_npmUser":{"name":"npm","email":"support@npmjs.com"},"_from":".","dist":{"shasum":"b4920670e9f66603a72a046461abb6895ea4a827","tarball":"https://registry.npmjs.org/property/-/property-1.0.0.tgz","integrity":"sha512-SP5dFmpTAbtzqBDKlJGx5WoTiXzr5PVt3phrdBzfKdJJ7HYxekErecuiDOaPTQNbwJDG1e278Sgdvx08c1WyYA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDHmjeN0fy2RBRGUg7u2lkElBXEoLNjNC33alDA4WVFTQIgX0ofZZVhTIndYc8Z5OCID6WChCgptL0DmvY3UEfvdyY="}]},"maintainers":[{"name":"npm","email":"npm@npmjs.com"}]},"3.0.0":{"name":"property","description":"Getter-setter wrapper with change notification","license":"MIT","version":"3.0.0","author":{"name":"Gustaf Räntilä","email":"g.rantila@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/grantila/node-property.git"},"scripts":{"test":"mocha"},"pre-commit":["test"],"keywords":["property","getter","setter","gettersetter","change","notify","notification"],"devDependencies":{"chai":"^3.5","mocha":"^2.4","pre-commit":"^1.1"},"gitHead":"7c79e981cb78acfffcf6f6395f64dfb7a4f9d31d","bugs":{"url":"https://github.com/grantila/node-property/issues"},"homepage":"https://github.com/grantila/node-property#readme","_id":"property@3.0.0","_shasum":"7146d20fe692dfed45e4f97876283c30dbc437b9","_from":".","_npmVersion":"3.8.6","_nodeVersion":"6.0.0","_npmUser":{"name":"grantila","email":"g.rantila@gmail.com"},"dist":{"shasum":"7146d20fe692dfed45e4f97876283c30dbc437b9","tarball":"https://registry.npmjs.org/property/-/property-3.0.0.tgz","integrity":"sha512-SPeFWW9BdLv+0sRuMkgOb7Pvu9XRPGiCtw2/8c2TBW6GEHwhUWzJ96pFvcplxF1G2JNC06CO8yDvt5tSnu+9hg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDupnE/GbmeLalD/vIrYwQlLLJ9Iv5SnZ0b6XRHgu7WywIgQB72myq2JsEMwPGM4ydMyG/pKR01cVFlF08CH4U9xnM="}]},"maintainers":[{"name":"npm","email":"npm@npmjs.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/property-3.0.0.tgz_1463125849988_0.6558357565663755"}}},"license":"MIT","readmeFilename":"README.md","description":"Getter-setter wrapper with change notification","homepage":"https://github.com/grantila/node-property#readme","keywords":["property","getter","setter","gettersetter","change","notify","notification"],"repository":{"type":"git","url":"git+https://github.com/grantila/node-property.git"},"bugs":{"url":"https://github.com/grantila/node-property/issues"},"author":{"name":"Gustaf Räntilä","email":"g.rantila@gmail.com"}}