🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@stamp/named

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stamp/named

(Re)Name a stamp factory function

Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
12
-25%
Maintainers
1
Weekly downloads
 
Created
Source

@stamp/named

Changes the Stamp.name property using the new ES6 feature.

Supported platforms: node>=4, iOS>=10, Edge, FF, Chrome, Safari

If used in a non-supported environment (node <v4, or IE any version) then nothing will throw. But the Stamp.name will always be "Stamp".

Example

Default behaviour (without this stamp):

const MyRegularStamp = compose(...);
console.log(MyRegularStamp.name); // 'Stamp'

New behaviour:

import Named from '@stamp/named';

const MyNamedStamp = MyRegularStamp.compose(Named).setName('MyNamedStamp');
console.log(MyNamedStamp.name); // 'MyNamedStamp'

Derived stamps behaviour:

// All derived stamps will also be named 'MyNamedStamp' until changed:
let Stamp2 = compose(..., MyNamedStamp, ...);
console.log(Stamp2.name); // WARNING! Still 'MyNamedStamp' !!!

// Overwriting the name
Stamp2 = Stamp2.setName('Stamp2');
console.log(Stamp2.name); // 'Stamp2' :)

FAQs

Package last updated on 29 Jul 2017

Did you know?

Socket

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.

Install

Related posts