
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
proptypes-helper
Advanced tools
a helper to generate class names for blocks, elements, and modifiers.
Tired of writing propTypes on your React App? Try using propTypesHelper. it provides proptypes from the default values in the object.
import * as helper from 'proptypes-helper';
const types = {
optional: {
Array: [],
Bool: true,
Func: ()=>{},
Number: 1,
Object: {},
String: '',
Symbol: Symbol('desc'),
Element: <div />
},
required: {
Array2: [ 1 ],
Number2: NaN,
},
external: {
Instance: PropTypes.instanceOf(Message)
}
}
function StatelessButton(props) {
...
}
StatelessButton.defaultProps = { ...helpers.defaultProps(types) };
StatelessButton.propTypes = { ...helpers.propTypes(types) };
// or
StatelessButton = helpers.attachTypes(StatelessButton, types);
class Button extends Compoment {
static defaultProps = { ...helpers.defaultProps(types) }
static propTypes = { ...helpers.propTypes(types) }
...
}
** if your linter barks at proptypes, try use spread ({...xxx}
).
It should be the same as StatelessButton.propTypes = helpers.propTypes(types);
.
You can also easily toggle between optional and required since it use the same form.
only in dev env,
setDebug(true)
will show console.log
for keys and propTyes
setDebug
will show the followings for the upper example
If one of those is needed
any
customProp
oneOf
oneOfType
node
objectOf
instanceOf
object
; generated as shape
array
; generated only for empyt array.or precise proptypes, please write that in the external
parameter.
MIT License
FAQs
a helper to generate class names for blocks, elements, and modifiers.
The npm package proptypes-helper receives a total of 0 weekly downloads. As such, proptypes-helper popularity was classified as not popular.
We found that proptypes-helper 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.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.