This can also be used for singleton objects, i.e. to check that you have the
same instance of an object.
here's an example of using this to ensure you recieve the same instance of a
database configuration.
// the instance you want to recieve constdbInstance = newDB({ url:configURL, pass:password }) constasDBInstance = asConst(dbInstance)
constanotherInstance = newDB({ url:configURL, pass:password }) asDBInstance.decode(anotherInstance) //> fails because anotherInstance is not dbInstance
Takes a constant value and produces a decoder that can only decode that value.
example:
This can also be used for singleton objects, i.e. to check that you have the same instance of an object.
here's an example of using this to ensure you recieve the same instance of a database configuration.