Object creation internals
function myFactory () {
return { myProperty: 'my value' }
}function Stamp () {
const metadata = Stamp.compose // retrieving metadata from itself
... SNIP ...
return newObject
}function Stamp () {
const metadata = Stamp.compose // retrieving metadata from itself
const properties = metadata.properties // retrieving properties from the metadata
let deepProperties = metadata.deepProperties // retrieving deepProperties from the metadata
deepProperties = JSON.parse(JSON.stringify(deepProperties)) // we need to clone deepProperties
const newObject = Object.assign({}, deepProperties, properties) // creating new object using the properties
... SNIP ...
return newObject
}Last updated