Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {custom, serializable} from 'serializr';
export type PathTypes = Path | string;
export class Path {
public static separator: string = '/';
@serializable public value: string;
@serializable(custom((val) => val, (val) => val))
public args: any;
get parts () {
return this.value.split(Path.separator);
}
get root () {
return this.parts[0];
}
constructor (
value: string = '',
args: any = {}
) {
this.value = value;
this.args = args;
function _default() {
return serializr_1.custom(_walk, function (v) { return v; });
}
function object(s) {
function _default() {
return custom(_walk, (v: any) => v)
}
static serializr () {
return custom(StatItem.serialize, StatItem.deserialize);
}
function getSerializer(options, defaultSerializer) {
if (options.serializer) {
return customSerializer(
options.serializer[0],
options.serializer[1],
);
}
const fns = (CustomSerializerTypes[options.type] || defaultSerializer)();
if (options.writeOnly) {
return {
serializer: () => SKIP,
deserializer: fns.deserializer,
};
}
return fns;
}
import { serializable, list, createSimpleSchema, primitive, object, custom, SKIP } from 'serializr';
import { observable, toJS } from 'mobx';
var Action = createSimpleSchema({
type: primitive(),
payload: custom(
(value) => value === undefined ? SKIP : toJS(value),
(value) => value
),
});
var Milestone = createSimpleSchema({
chapterId: primitive(),
index: primitive(),
});
class TutorialState {
@serializable @observable currentChapterId;
@serializable(list(object(Action))) @observable actions = [];
@serializable(list(object(Milestone))) @observable milestones = [];
static create({ chapters }) {