Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const isMappable: Predicate = x =>
fromNullable(x)
.filter(isObject)
.filter(not(isDate))
.fold(false, constTrue);
function getSince(annotation: doctrine.Annotation): O.Option {
return pipe(
O.fromNullable(annotation.tags.filter(tag => tag.title === 'since')[0]),
O.mapNullable(tag => tag.description)
)
}
resp.text().then(b => {
r(
left({
_tag: H.HttpErrorReason.Response,
response: {
headers: h,
status: resp.status,
body: fromNullable(
d[H.httpDeserializerEnv].errorResponse(b)
)
}
})
);
});
}
function getDescription(annotation: doctrine.Annotation): O.Option {
return pipe(
O.fromNullable(annotation.description),
O.filter(s => s !== '')
)
}
const emailPayload = {
Bcc: fromNullable(addresses.bcc)
.map(toMailupAddresses)
.toUndefined(),
Cc: fromNullable(addresses.cc)
.map(toMailupAddresses)
.toUndefined(),
ExtendedHeaders: headers,
From: fromNullable(addresses.from)
.chain(toMailupAddress)
.toUndefined(),
Html: {
Body: mail.data.html
},
ReplyTo: fromNullable(addresses["reply-to"])
.chain(toMailupAddress)
.map(addr => addr.Email)
.toUndefined(),
Subject: mail.data.subject,
Text: mail.data.text,
To: fromNullable(addresses.to)
.map(toMailupAddresses)
.toUndefined()
};
const errorOrEmail = EmailPayload.decode(emailPayload);
if (isLeft(errorOrEmail)) {
const errors = readableReport(errorOrEmail.value);
winston.error("MailUpTransport|errors", errors);
return callback(
function isInternal(annotation) {
return Option_1.fromNullable(annotation.tags.filter(function (tag) { return tag.title === 'internal'; })[0]).isSome();
}
function getExamples(annotation) {
const renderGeneral = (): React.ReactElement => {
const isStashNominating = fromNullable(stakingInfo)
.mapNullable(({ nominators }) => nominators)
.map(nominators => nominators.length > 0)
.getOrElse(false);
const isStashValidating = fromNullable(allStashes)
.map(allStashes => allStashes.includes(createType('AccountId', currentAccount)))
.getOrElse(false);
const accountType = fromNullable(stakingInfo).map(stakingInfo => createType('AccountId', currentAccount).eq(stakingInfo.controllerId) ? 'controller' : 'stash');
const bondingPair = fromNullable(stakingInfo)
.map(stakingInfo => accountType.fold(
undefined,
(accountType) => accountType === 'controller' ? stakingInfo.stashId : stakingInfo.controllerId
))
.getOrElse(undefined);
return (
.chain(pool =>
fromNullable(parsers)
.map(setupParsers(pool))
.getOrElse(taskEither.of(pool)),
)
function getEmailAddressFromProfile(
profile: RetrievedProfile
): Option {
return fromNullable(profile.email).map(email => ({
addressSource: NotificationAddressSourceEnum.PROFILE_ADDRESS,
toAddress: email
}));
}
const renderEraProgress = (): React.ReactElement => {
return (
New Validator Set:
{
fromNullable(sessionInfo)
.map(sessionInfo =>
<progress value="{sessionInfo.eraProgress.toNumber()}" size="small" color="pink">
)
.getOrElse()
}
A New Validator Set is Elected Every Era.
</progress>
);