MCPcopy
hub / github.com/microsoft/SandDance / powish

Function powish

docs/app/js/sanddance-app.js:129041–129050  ·  view source on GitHub ↗
(transform)

Source from the content-addressed store, hash-verified

129039 return x < 0 ? -x * x : x * x;
129040}
129041function powish(transform) {
129042 var scale = transform((0, _continuousJs.identity), (0, _continuousJs.identity)), exponent = 1;
129043 function rescale() {
129044 return exponent === 1 ? transform((0, _continuousJs.identity), (0, _continuousJs.identity)) : exponent === 0.5 ? transform(transformSqrt, transformSquare) : transform(transformPow(exponent), transformPow(1 / exponent));
129045 }
129046 scale.exponent = function(_) {
129047 return arguments.length ? (exponent = +_, rescale()) : exponent;
129048 };
129049 return (0, _linearJs.linearish)(scale);
129050}
129051function pow() {
129052 var scale = powish((0, _continuousJs.transformer)());
129053 scale.copy = function() {

Callers 1

powFunction · 0.70

Calls 2

transformFunction · 0.70
rescaleFunction · 0.70

Tested by

no test coverage detected