Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
encrypted_brainkey: maybe(Str),
brainkey_pubkey: Str,
brainkey_sequence: Num,
brainkey_backup_date: maybe(Dat),
deposit_keys: maybe(Obj),
// password_checksum: Str,
chain_id: Str
},
"WalletTcomb"
);
let PrivateKeyTcomb = struct(
{
id: maybe(Num),
pubkey: Str,
label: maybe(Str),
import_account_names: maybe(Arr),
brainkey_sequence: maybe(Num),
encrypted_key: Str
},
"PrivateKeyTcomb"
);
export {WalletTcomb, PrivateKeyTcomb};
test('maybe', function (assert) {
assert.plan(1);
var expected = {
kind: 'irreducible',
required: false,
name: 'String',
predicate: t.String.meta.predicate
};
var actual = toObject(t.maybe(t.String));
assert.deepEqual(actual, expected);
});
function foo(x: ?tc.String) {
tc.assert(tc.maybe(tc.String).is(x), 'Invalid argument x (expected a ' + tc.getTypeName(tc.maybe(tc.String)) + ')');
return x || 'Empty';
}
const Tc = require('tcomb')
const Thing = Tc.struct({
name: Tc.String,
description: Tc.maybe(Tc.String),
}, 'Thing')
const Things = Tc.list(Thing, 'Things')
module.exports = {
Resource: Things
}
var t = require('tcomb');
var Type = t.irreducible('Type', t.isType);
var ActionDictionary = t.dict(t.String, Type);
var ActionStruct = t.subtype(t.Object, function (x) {
return t.String.is(x.type);
});
var Name = t.maybe(t.String);
function values(actions) {
return Object.keys(actions).map(function (type) {
return actions[type];
});
}
function createUnion(actions, name) {
if (process.env.NODE_ENV !== 'production') {
t.assert(ActionDictionary.is(actions), function () { return 'Invalid argument action ' + t.stringify(actions) + ' supplied to createUnion(actions, name) function (expected a dictionary String -> Type)'; });
t.assert(Name.is(name), function () { return 'Invalid argument name ' + t.stringify(name) + ' supplied to createUnion(actions, name) function (expected a string)'; });
}
name = name || 'Action';
object: function(s) {
var props = {};
var hasProperties = false;
var required = {};
if (s.required) {
s.required.forEach(function(k) {
required[k] = true;
});
}
for (var k in s.properties) {
if (s.properties.hasOwnProperty(k)) {
hasProperties = true;
var type = transform(s.properties[k]);
props[k] = required[k] || type === t.Boolean ? type : t.maybe(type);
}
}
return hasProperties ? t.struct(props, s.description) : t.Object;
},
function getDeafultPatch(State) {
debug('using default `Patch` constructor');
return t.struct({
token: t.maybe(State),
spec: t.Obj
}, 'Patch');
}
})
const DataWithMaybeId = Data.extend({
[idField]: Tc.maybe(Id)
})
const actionIds = createActionIds(options)
const actionTypes = createActionTypes(options)
const actions = createActions(options)
const StartPayload = sectionUnion(serviceName, actionTypes, 'start')
const SuccessPayload = sectionUnion(serviceName, actionTypes, 'success')
const ErrorPayload = sectionUnion(serviceName, actionTypes, 'error')
const Records = Tc.dict(Id, DataWithMaybeId, 'Records')
const PendingStartPayload = StartPayload.extend({
previousData: Tc.maybe(DataWithId)
}, 'PendingStartPayload')
const Pending = Tc.dict(Cid, PendingStartPayload, 'Pending')
const Success = Tc.dict(Cid, SuccessPayload, 'Success')
const Error = Tc.dict(Cid, ErrorPayload, 'Error')
const State = Tc.struct({
records: Records,
pending: Pending,
success: Success,
error: Error,
}, {
name: `${ServiceName}State`,
defaultProps: {
records: {},
pending: {},
success: {},
description: string
photo: m.TcombPhotoSize[],
text?: string
text_entities?: TcombMessageEntity[],
animation?: m.TcombAnimation
}
export const Message = t.declare('Message')
Message.define(t.struct({
message_id: t.Number,
from: t.maybe(User),
edit_date: t.maybe(t.Number),
date: t.Number,
chat: Chat,
forward_from: t.maybe(User),
forward_from_chat: t.maybe(Chat),
forward_date: t.maybe(t.Number),
reply_to_message: t.maybe(Message),
text: t.maybe(t.String),
entities: t.maybe(t.list(MessageEntity)),
audio: t.maybe(m.Audio),
document: t.maybe(m.Document),
game: t.maybe(Game),
photo: t.maybe(t.list(m.PhotoSize)),
sticker: t.maybe(m.Sticker),
video: t.maybe(m.Video),
voice: t.maybe(m.Voice),
caption: t.maybe(t.String),
contact: t.maybe(m.Contact),
location: t.maybe(m.Location),
venue: t.maybe(m.Venue),
new_chat_member: t.maybe(User),
mochawesome: t.struct({
options: t.Object,
version: t.String
}),
marge: t.struct({
options: t.Object,
version: t.String
})
});
const Test = t.struct({
title: t.String,
fullTitle: t.String,
timedOut: t.maybe(t.Boolean),
duration: Duration,
state: t.maybe(TestState),
speed: t.maybe(TestSpeed),
pass: t.Boolean,
fail: t.Boolean,
pending: t.Boolean,
code: t.String,
err: t.Object,
uuid: Uuid,
parentUUID: t.maybe(Uuid),
skipped: t.Boolean,
context: t.maybe(t.String),
isHook: t.Boolean,
});
const Suite = t.declare('Suite');
Suite.define(
t.struct({