OOP is better with stamps: Composable object factories. News: https://twitter.com/stampit_org
koresar on master
Fix badge - bundle size (compare)
koresar on master
README refresh: remove bower, u… (compare)
@koresar awesome! thanks!
by the way was playing around and noticed another IMO unexpected behaviour:
const stampit = require('@stamp/it');
const InstanceOf = require('@stamp/instanceof');
const Request = stampit({})
.compose(InstanceOf);
const ErrorRequest = stampit({})
.compose(Request)
.compose(InstanceOf);
const request = Request();
const errorRequest = ErrorRequest();
console.log('is request instance of Request?', request instanceof Request); \\ => TRUE
console.log('is errorRequest instance of ErrorRequest?', errorRequest instanceof ErrorRequest); \\ => TRUE
console.log('is errorRequest instance of Request?', errorRequest instanceof Request); \\ => FALSE
instanceof
in JavaScript.
const PaymentRequest = compose(
Storage,
{
init(request) {
this.request = request
},
props: {
get accountId() {
return this.request.x_account_id
},
}
}
)
Object.assign
apparently tries to evaluate those getters right away
@types/stampit
but trying it in codesandbox I got no type hinting.