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 parseParams(commandArray: string | string[], extraOpts: Options = {}): IParameters {
// use the command line args if not passed in
if (is(String, commandArray)) {
commandArray = (commandArray as string).split(COMMAND_DELIMITER)
}
// remove the first 2 args if it comes from process.argv
if (equals(commandArray, process.argv)) {
commandArray = commandArray.slice(2)
}
// chop it up yargsParse!
const parsed = yargsParse(commandArray)
const array = parsed._.slice()
delete parsed._
const options = merge(parsed, extraOpts)
return { array, options }
}
render() {
const { name, _field } = this.props;
// Wait until field is initialized
if (!_field) {
return null;
}
const inputProps = merge(_field, {
name,
onChange: this.handleChange,
onFocus: this.handleFocus,
onBlur: this.handleBlur,
});
const { input, meta, rest } = fieldProps(merge(inputProps, this.props));
// TODO SFC not compatibile with class... wtf TS
return React.createElement(Component as any, merge(rest, {
input,
meta,
}));
}
}
export function expandCompiletime(term, context) {
// each compiletime value needs to be expanded with a fresh
// environment and in the next higher phase
let syntaxExpander = new TermExpander(
_.merge(context, {
phase: context.phase + 1,
env: new Env(),
store: context.store,
}),
);
return syntaxExpander.expand(term);
}
many(filters = {}) {
const withDefaults = merge({ limit: 100 });
const filtersModified = withDefaults(filters);
return dbT
.any(sql.transactions.exchange.many(filtersModified))
.map(map(Maybe.fromNullable))
.mapRejected(
errorFactory({
request: 'transactions.exchange.many',
params: filters,
})
);
},
});
newPhone = () => {
const { organization } = this.state
const newPhones = [...organization.phones]
const newOrganization = {}
newPhones.push(blankPhone())
newOrganization.phones = newPhones
const updatedOrganization = R.merge(organization, newOrganization)
this.setState({ organization: updatedOrganization })
}
createSignup: (event, currentUser) =>
mutate({
variables: { eventId: event.id },
optimisticResponse: {
__typename: 'Mutation',
createSignup: {
__typename: 'Signup',
event: R.merge(event, {
users: R.append(currentUser, event.users),
}),
},
},
}),
}),
var build = function build(file, options) {
options = options ? R.merge(defaultOptions, options) : defaultOptions;
var output;
var tests = comments.parse(file.content).tests;
var testsReadyToAssemble = tests.map(function(test) {
var testDetails;
if (test.assertions.length) {
testDetails = extract.extractTestDetails(test.assertions);
} else {
testDetails = '';
}
var utilData = tempUtils.prepDataForTemplating(options.testFW, file.name, test, testDetails);
var jsTestString;
if (options.testFW === 'jasmine') {
jsTestString = tempUtils.addTestDataToBaseTemplateJasmine(utilData, jasmineTemps.base);
}
if (options.testFW === 'tape') {
jsTestString = tempUtils.addTestDataToBaseTemplate(utilData, tapeTemps.base, tapeTemps.plan);
'use strict';
const join = require('path').join;
const merge = require('ramda').merge;
const base = require('./webpack.config.backend-base');
module.exports = merge({
entry: './source/delayed-job/index.js',
output: {
filename: 'delayed-job.js',
path: join(__dirname, 'build'),
libraryTarget: 'commonjs2',
},
}, base);
reduce((result, key) => merge(result, { [capitalizeString(key)]: obj[key] }), {}, keys(obj))
export default async (body: any, ioContext: any) => {
const { data: { orderFormId, paymentToken } } = body
const checkout = createClient(ioContext.account, orderFormId, ioContext.authToken)
const response = await checkout.addToken(paymentToken)
const { data: { paymentData: { availableTokens } } } = response
const tokensToRemove = reject(propEq('tokenId', paymentToken.tokenId), availableTokens)
if (tokensToRemove.length === 0) {
return { data: merge(body.data, response.data) }
}
const lastDeleteResponse = await mapSeries(tokensToRemove, ({ tokenId }: any) => checkout.removeToken(tokenId)).then(last)
return { data: merge(body.data, lastDeleteResponse.data) }
}