Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(private readonly $dotMachine: DotMachine, initial = 0,
index = 0) {
super();
this.value = initial;
this.$el = $N('div', {class: 'dot-cell'}, $dotMachine.$wrap);
this.$value = $N('div', {class: 'cell-value', html: initial}, this.$el);
const order = numberFormat(index > 0 ? Math.pow($dotMachine.base, index) :
1 / Math.pow($dotMachine.base, -index)); // Prevent rounding errors
$N('div', {class: 'cell-order', html: order}, this.$el);
if (initial) {
this.rearrange(initial);
for (let i = 0; i < initial; ++i) this.addDot(undefined, {count: false});
}
}
function numberAnimation(n: number, $el: ElementView, t: number) {
const digits = numberFormat(n).split('');
const length = digits.length;
return animate((p) => {
const num = digits.map((n, i) => {
if (i > p * length + 1) return '';
if (isOneOf(n, ',', '.')) return n;
if (i > p * length - 1) return Random.integer(10);
return n;
});
$el.text = num.join('');
}, t);
}
$section.model.set('tsnPaths', function(x) {
return list(x, 1).join(' × ') + ' = ' + numberFormat(factorial(x));
});
}
$section.model.set('tsnPaths', (x: number) => {
return list(x, 1).join(' × ') + ' = ' + numberFormat(factorial(x));
});
}
.then((result) => $section.model.set('result', numberFormat(result)))
.catch(() => $section.model.set('result', `Couldn‘t find a prime :(`));
.then(({data}) => $section.model.set('result', numberFormat(data)))
.catch(() => $section.model.set('result', `Couldn‘t find a prime :(`));
$section.model.set('factorial', x => numberFormat(factorial(x)));
}
(a: number, d: number, i: number) => numberFormat(a + i * d, 4));
pow: (n: number) => numberFormat(Math.pow(2, n)),
nines: (n: number) => '0.' + '9'.repeat(Math.ceil(n * log2))