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

@stamp/arg-over-prop

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stamp/arg-over-prop - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

9

__tests__/index.js
var ArgOverProp = require('..');
describe('@stamp/arg-over-prop', function () {
it('can be used as a standalone function', function () {
var argOverProp = ArgOverProp.argOverProp;
var Stamp = argOverProp('override');
var instance = Stamp({override: 1, dontTouch: 2});
expect(instance.override).toBe(1);
expect(instance).not.toHaveProperty('dontTouch');
});
it('assigns only the requested properties', function () {

@@ -5,0 +14,0 @@ var Stamp = ArgOverProp.argOverProp('override');

12

index.js

@@ -28,6 +28,7 @@ var compose = require('@stamp/compose');

module.exports = compose({
var ArgOverProp = compose({
staticProperties: {
argOverProp: function () {
var propNames = [], defaultProps = {};
'use strict';
var propNames = [], defaultProps;
for (var i = 0; i < arguments.length; i++) {

@@ -41,3 +42,3 @@ var arg = arguments[i];

} else if (isObject(arg)) {
assign(defaultProps, arg);
defaultProps = assign(defaultProps || {}, arg);
propNames = propNames.concat(Object.keys(arg));

@@ -47,3 +48,4 @@ }

return this.compose({
var Stamp = this && this.compose ? this : ArgOverProp;
return Stamp.compose({
deepConfiguration: {ArgOverProp: propNames},

@@ -68,1 +70,3 @@ properties: defaultProps // default property values

});
module.exports = ArgOverProp;
{
"name": "@stamp/arg-over-prop",
"version": "1.0.0",
"version": "1.0.1",
"description": "Assign properties passed to the stamp factory",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -26,2 +26,9 @@ # @stamp/arg-over-prop

Or if you don't want to import the stamp you can import only the method:
```js
import {argOverProp} from '@stamp/arg-over-prop';
const StampA = argOverProp({foo: 1});
```
Basically, the `arg-over-prop` stamp sets properties in an initializer.

@@ -28,0 +35,0 @@ The code below is what the `StampA` becomes.

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