Using the extend method
Explaining extend
Exceptions with ampersand
in ES6 you have now
object.assign
For example in the model definitions:The
Object.assign()
method is used to copy the values of all enumerable own properties from one or more source objects to a target object. It will return the target object.
export default Model.extend(githubMixin, {
props: {...}
})
We extend the base ampersand model with what we pass into it.In lodash it's also called
assign
Exceptions with ampersand extend
method
They look for
props
, derived
, session
, collection
, child
properties, and they use these to create additional properties, like a getter and setter for props
.The setters checks that type (string, number) we want to pass matches with what we originally set in the definition.
Demonstrates
Babel will not polyfill everything for you unless you specifiy.
.at(0)
getter.