Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function assertFailure(codec: t.Any, value: unknown, errors: Array): void {
const result = codec.decode(value)
pipe(
result,
fold(
() => {
assert.deepStrictEqual(PathReporter.report(result), errors)
},
/* istanbul ignore next */
() => {
throw new Error(`${result} is not a left`)
}
)
)
}
it('success', () => {
expect(
pipe(
success(1),
toEither(initialL, pendingL),
),
).toEqual(right(1));
});
});
function writeMarkdownFiles(files: Array): AppEff {
const cleanOut: AppEff = C =>
pipe(
C.log(`Writing markdown...`),
TE.chain(() => C.debug(`Clean up docs folder: deleting ${outPattern}...`)),
TE.chain(() => C.clean(outPattern))
)
return pipe(
cleanOut,
RTE.chain(() => writeFiles(files))
)
}
option.map(additionalProperties =>
pipe(
serializeSchemaObjectWithRecursion(from, additionalProperties, false),
either.map(getSerializedDictionaryType()),
either.map(getSerializedRecursiveType(from, shouldTrackRecursion)),
),
),
findPreviousOccurence(editorId: string, range: FlatRange): O.Option {
return pipe(
this.findDecorationIdAndRanges(editorId, range),
O.map(([_, ranges]) => {
const newIndex = ranges.findIndex(this.isPointingRange(range)) - 1;
return ranges[newIndex < 0 ? ranges.length - 1 : newIndex];
})
);
}
import * as E from "../index";
import * as P from "./Printer";
import * as C from "./Counter";
import * as T from "./Tracer";
import { Do } from "fp-ts-contrib/lib/Do";
import { pipe } from "fp-ts/lib/pipeable";
import { withControllerSpan, withTracer } from "./Tracer";
export const module = pipe(
E.noEnv,
E.mergeEnv(P.printer),
E.mergeEnv(C.counter),
E.mergeEnv(T.tracer),
E.mergeEnv(T.tracerFactoryDummy)
);
export const program = withTracer(
E.provide(C.counterState())(
Do(E.effectMonad)
.bind("start", C.currentCount())
.do(withControllerSpan("controller-a")(C.count()))
.do(withControllerSpan("controller-b")(C.count()))
.bind("end", C.currentCount())
.doL(({ start, end }) => P.print(`done - ${start} <-> ${end}`))
.done()
() =>
pipe(
this.back,
l.reverse,
l.catac(
(h, t) => some([h, new DequeueImpl(t, nil)] as const),
() => none
)
)
);
const serializeProperties = (
from: Ref,
schemaObject: ObjectSchemaObject,
shouldTrackRecursion: boolean,
name?: string,
): Option> =>
pipe(
schemaObject.properties,
option.map(properties =>
pipe(
properties,
record.collect((name, property) => {
const isRequired = pipe(
schemaObject.required,
option.map(required => required.has(name)),
option.getOrElse(constFalse),
);
const serialized = ReferenceObjectCodec.is(property)
? pipe(fromString(property.$ref), either.map(getSerializedRefType(from)))
: serializeSchemaObjectWithRecursion(from, property, false);
return pipe(serialized, either.map(getSerializedOptionPropertyType(name, isRequired)));
function deserializeAndValidate(content: IMediaTypeContent, schema: JSONSchema, target: string) {
const encodings = get(content, 'encodings', []);
const encodedUriParams = splitUriParams(target);
return pipe(
validateAgainstReservedCharacters(encodedUriParams, encodings),
E.map(decodeUriEntities),
E.map(decodedUriEntities => deserializeFormBody(schema, encodings, decodedUriEntities)),
E.chain(deserialised =>
pipe(
validateAgainstSchema(deserialised, schema, true),
E.fromOption(() => deserialised),
E.swap
)
)
);
}
),
);
const backgroundImage = pipe(
fills,
option.chain(nonEmptyArray.filter(fill => fill.fillType === 'Gradient')),
option.map(fills =>
pipe(
fills,
nonEmptyArray.map(fill => serializeGradient(fill.gradient)),
nonEmptyArray.nonEmptyArray.sequence(either.either),
either.map(gradients => `backgroundImage: '${gradients.join(', ')}'`),
),
),
sequenceOptionEither,
);
const backgroundBlendMode = pipe(
fills,
option.map(array.filterMap(fill => option.fromEither(getBackgroundBlendMode(fill.contextSettings.blendMode)))),
option.chain(array.last),
option.filter(mode => mode !== 'normal'),
option.map(mode => `backgroundBlendMode: '${mode}'`),
);
const mixBlendMode = pipe(
style.contextSettings,
option.chain(settings => option.fromEither(getMixBlendMode(settings.blendMode))),
option.filter(mode => mode !== 'normal'),
option.map(mode => `mixBlendMode: '${mode}'`),
);
const opacity = pipe(
style.contextSettings,
option.map(settings => settings.opacity),
option.filter(n => n !== 1),