Transform
const { transform } = require('decorators'),
{ Transform } = require('runtime.transform')
@transform('c_random_transform', { environment: 'production', weight: 1 })
class AddRandomTransform extends Transform {
constructor(transformOptions, runtimeOptions) {
super({
opsThreshold: 0.65, // defaults to .8. exits the each() cycle after 65% ops usage.
msThreshold: 0.65, // defaults to .8. exits the each() cycle after 65% time usage.
minMs: 1000, // defaults to null. exits the each() cycle when less that minMs time is left.
minOps: 100000 // defaults to null. exits the each() cycle when less that minOps ops are left.
})
}
each( object ) {
return { ...object, random: Math.random() }
}
// a particularly long running after script could cause the transform to
// fail so the defaults have been tweaked.
after() {
}
}@transform(name, options) / @transform(options)
Constructor Options
Last updated
Was this helpful?