Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(xs => x => {
const typeVarName = S.prop ('typevar') (x);
const newTypeClassName = S.prop ('typeclass') (x);
const typeVarClasses = S.fromMaybe
([])
(S.get
(S.is ($.Array ($.String)))
(typeVarName)
(xs));
return S.insert
(typeVarName)
(S.append (newTypeClassName) (typeVarClasses))
(xs);
})
({});
const operate = curry((op, name, line) =>
S.fromMaybe(line, $do(function* () {
const braceStart = yield S.indexOf('{', line);
const braceEnd = yield S.indexOf('}', line);
const removeAfterStart = braceEnd - braceStart + 1;
const insideBraces = slice(braceStart + 1, braceEnd, line);
const hasSpaceFirst = isSpace(head(insideBraces));
return yield S.match(/[a-zA-Z0-9_]+/g, insideBraces)
.chain(sequence(Just))
.concat(Just([]))
.map(names =>
pipe(
op(__, names),
uniq,
sortBy(toLower),
join(', '),
fmt1(hasSpaceFirst ? '{ %s }' : '{%s}'),
const capitalize = (str) => concat(toUpper(head(str)), tail(str));
const pascalCase = pipe(camelCase, capitalize);
const isUpper = (c) => toUpper(c) === c;
const isCapitalized = pipe(head, isUpper);
const pkgNameAsVar = ifElse(isCapitalized, pascalCase, camelCase);
const ALIAS = /:([^!]+)/;
const EXTEND = /!$/;
const parseAlias = pipe(
S.match(ALIAS), chain(nth(1)));
const parseExtend = pipe(
S.match(EXTEND), map(T));
const rm = replace(__, '');
const cleanArg = pipe(...map(rm, [ EXTEND, ALIAS ]));
const orEmpty = S.fromMaybe({});
const parsePositionalArg = (arg) => {
const cleaned = cleanArg(arg);
return mergeAll([
orEmpty(map(objOf('alias'), parseAlias(arg))),
orEmpty(map(objOf('extend'), parseExtend(arg))),
{ npa: npa(cleaned) }
]);
};
const contextForPkg = curry((_require, obj) => {
const module = _require(obj.name);
return merge(
obj.extend ? module : {},
{ [obj.alias]: module }
);