Skip to content

Instantly share code, notes, and snippets.

@carmouche
carmouche / mock_context.js
Created May 15, 2020 06:23
Quickly mock array of objects with unique id using lodash
import {times, random} from 'lodash';
const mockContext = {
property: times(10, i => ({
id: (i + 1).toString(),
// get randomized boolean values
isTruthy: !!random(0, 1)
}))
};
import {decorate, observable, action, runInAction} from 'mobx';
class UploadProgress {
public totalPercent!: number;
constructor(initialPercent?: number) {
runInAction(() => {
this.totalPercent = initialPercent || 0;
});
}