stampit API
Search…
Introduction
Essentials
What is a Stamp
Installation
Specification
FAQ
API
Quick start
Basics
Methods
Properties
Deep properties
Initializers
Static properties
Static deep properties
Configuration
Deep configuration
Composers
Property descriptors
Static property descriptors
Name
Ecosystem
Ecosystem Overview
@stamp/collision
@stamp/required
@stamp/privatize
@stamp/named (DEPRECATED)
@stamp/instanceof
Powered By
GitBook
Name
By default all the stamps name is "Stamp".
1
const
MyStamp
=
stampit
({})
2
3
console
.
log
(
MyStamp
.
name
)
// "Stamp"
Copied!
But you can change it by passing the
name
property to stampit:
1
const
MyStamp
=
stampit
({
name
:
"MyFactoryFunction"
})
2
3
console
.
log
(
MyStamp
.
name
)
// "MyFactoryFunction"
Copied!
This metadata does not have a chaining method. This is illegal:
MyStamp.name("MyFactoryFunction")
.
Gotchas
This feature is not part of the
compose
specification
.
Won’t work in ES5 environments (like IE11). The name will always be
“Stamp”
. Name of a function can be set only in >=ES6 environments.
This code doesn’t work in JavaScript in general:
SmsGateway.name = “bla”
. Because
Function.name
is a special protected property.
If any of the stamps you compose have a name then all the derived stamps will have it too.
The only way to clear the name (reset to the defaults) is to set the name to
"Stamp"
.
1
MyStamp
=
MyStamp
.
compose
({
name
:
"Stamp"
})
Copied!
API - Previous
Static property descriptors
Next - Ecosystem
Ecosystem Overview
Last modified
3yr ago
Copy link
Contents
Gotchas