Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
define-prop
Advanced tools
#define-prop
###Easy and type safe custom object property define
###Usage:
<object> defineProperty( <object> obj, <string>/<number> key, <any type> value, <string> descriptorNames )
Default, the enumerable, configurable and writable descriptor values are set to false, which is the default behaviour of Object.defineProperty. You can set them individually to true by passing their names as last arguments or in a space seperated string.
var defineProp= require( 'define-prop' );
var obj= {};
// define obj.hello and give it the value 'world!', it will be
// immutable by default, we only set enumerable to be able to log it
defineProp( obj, 'hello', 'world!', 'enumerable' );
obj.hello= 'cannot be set..';
console.log( obj );
// { hello: 'world!' }
// define a getter and setter similar to native Object.defineProperty
defineProp( obj, 'count', ( () => {
var count= 0;
return {
get: () => count
,set: ( value ) => count= value
};
})(), 'enumerable' );
obj.count++;
console.log( obj.count );
// 1
// define an object to be deeply immutable
defineProp( obj, 'protected', {
notWritable : 'this is a frozen object'
,test : true
}, 'enumerable' );
obj.protected.cannotAssign = 'when "writable" is not set';
obj.protected.test = 'futile';
console.log( obj );
// { hello: 'world!',
// count: [Getter/Setter],
// protected: { notWritable: 'this is a frozen object', test: true } }
// have custom input error handler
defineProp.log= ( err ) => {
// do something with err?
};
0.0.5
--
0.0.4
--
0.0.3
--
###license
MIT
FAQs
Easy and type safe custom object property define
We found that define-prop demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.