function createImportTool({containerId, school, useGroupsOnly}) { var container = document.getElementById(containerId); const store = createFinalStore(reducers); store.dispatch({ type: SET_DEFAULT_SCHOOL, school, }); if (useGroupsOnly) { store.dispatch(setActiveColumnTypes(R.omit(["legacy_role"], AllColumnTypes))); store.dispatch(fetchGroups(school.id)); } else { store.dispatch(setActiveColumnTypes(R.omit(["group"], AllColumnTypes))); store.dispatch(fetchLegacyRoles(school.id)); } container.innerHTML = ""; ReactDOM.render( <div> <Provider store={store}> <ImportTool /> </Provider> </div> , container); }
.then(getResponseJson).then(json => { assert.equal(json.length, 1); assert.containSubset(omit(json[0], 'uids'), omit(queryObject, 'uids')); assert.equal(json[0].uids.length, 6); return deleteGrid(fid, username); });
return getCoupons().then(coupons => { const coupon = coupons[0] assert.instanceOf(coupon.amount, Decimal) assert.equal(coupon.amount.toString(), apiCoupon.amount) // everything else aside from `amount` should be identical const couponProps = R.omit(["amount"], coupon) const apiCouponProps = R.omit(["amount"], apiCoupon) assert.deepEqual(couponProps, apiCouponProps) })
return attachCoupon("success-coupon").then(resp => { assert.equal(apiResponse.message, resp.message) const coupon = resp.coupon, apiCoupon = apiResponse.coupon assert.instanceOf(coupon.amount, Decimal) assert.equal(coupon.amount.toString(), apiCoupon.amount) // everything else aside from `amount` should be identical const couponProps = R.omit(["amount"], coupon) const apiCouponProps = R.omit(["amount"], apiCoupon) assert.deepEqual(couponProps, apiCouponProps) })
export const selectedCellsReducer = (state = {}, action) => { switch (action.type) { case SELECT_BOX: { const { boxId, cellId } = action.payload; return { ...state, [boxId]: [cellId] }; } case UNSELECT_BOX: { const { boxId } = action.payload; return omit([boxId], state); } case SELECT_CELL: { const { boxId, cellId } = action.payload; return { ...state, [boxId]: state[boxId].concat(cellId) }; } case UNSELECT_CELL: { const { boxId, cellId } = action.payload; return { ...state, [boxId]: state[boxId].filter(id => id !== cellId) }; } case RESET_ADD_WINE: { return {}; } default: return state; } };
const processTimetables = R.map((venueTimetable) => { const schoolDays = timify.getSchoolDays(); // remove 'Venue' key from lessons const timetable = R.map(R.omit('Venue'), venueTimetable); return schoolDays.map((day) => { const lessons = R.filter(lesson => lesson.DayText === day, timetable); // Outputs the following: // availability: { // "0800": "vacant", // "0830": "vacant", // "0900": "occupied", // "0930": "occupied", // ... // "2330": "vacant" // } const availability = {}; timify.getTimeRange(SCHOOL_START_HOUR, SCHOOL_END_HOUR).forEach((time) => { availability[time] = 'vacant'; }); // for each time slot that contains lesson, label as occupied lessons.forEach((lesson) => { timify.getTimeRange(lesson.StartTime, lesson.EndTime).forEach((time) => { availability[time] = 'occupied'; }); }); return { Day: day, Classes: lessons, Availability: availability, }; }); });
export const SetRangeHeader = ({request, range}) => { return R.set( R.lensPath(['headers', 'range']), CreateRangeHeader(range), R.omit(['threads', 'offsets'], request) ) }
const books = (state, { type, book }) => { switch (type) { case ADD_BOOK_TO_CART: { const exists = state[book.isbn] ? true : false; let newState = {...state}; newState[book.isbn] = { ...book, amount: exists ? newState[book.isbn].amount + 1 : 1 }; return newState; break; } case REMOVE_BOOK_FROM_CART: return omit([book.isbn], state); break; } return {...state}; };
neutrino.on('test', ({ files, watch }) => new Promise((resolve, reject) => new Server(merge.all([ opts.override ? opts : merge(defaults, opts), { singleRun: !watch, autoWatch: watch, webpack: omit(['plugins'], neutrino.config.toConfig()) }, files && files.length ? { files } : {} ]), exitCode => (exitCode !== 0 ? reject() : resolve())) .start()
function Field(props) { const { value, compare } = props , { label, hidden = false } = value , { warnings , summary , items } = compare ? compareValues(value, compare) : showValues(value) , hide = hidden && R.isEmpty(warnings) return h( Box, R.mergeAll( [ R.omit([ 'value', 'compare' ], props), { mt: 2 }, hide ? { css: {display: 'none'} } : {}, ] ), [ h(Box, { is: 'dt', fontWeight: 'bold', }, label), warnings.length ? h(Warnings, { warnings }) : null, summary, ...wrap({ is: 'dd', ml: 3 })(items) ] ) }
/** * Merge the package.json from our template into the one provided from react-native init. */ async function mergePackageJsons () { // transform our package.json incase we need to replace variables const rawJson = await template.generate({ directory: `${ignite.ignitePluginPath()}/boilerplate`, template: 'package.json.ejs', props: templateProps }) const newPackageJson = JSON.parse(rawJson) // read in the react-native created package.json const currentPackage = filesystem.read('package.json', 'json') // deep merge, lol const newPackage = pipe( assoc( 'dependencies', merge(currentPackage.dependencies, newPackageJson.dependencies) ), assoc( 'devDependencies', merge(currentPackage.devDependencies, newPackageJson.devDependencies) ), assoc('scripts', merge(currentPackage.scripts, newPackageJson.scripts)), merge( __, omit(['dependencies', 'devDependencies', 'scripts'], newPackageJson) ) )(currentPackage) // write this out filesystem.write('package.json', newPackage, { jsonIndent: 2 }) }
/** * Loads the given component. * * @param component: The component Type (e.g. MyComponent) * or created component element (e.g.: <MyComponent/>). */ component(component) { invariant(component, 'Cannot load: a component was not specified (undefined/null)'); // Create a props object of any props set by this.props with props // passed down by JSX. const props = R.merge( this[PROP]('componentProps'), // Existing props from this.props() R.omit('children', component.props) // Don't include props.children in // props plucked from JSX ); // Update the props in internal state. this[PROP]('componentProps', props); // Find the children of the passed JSX component (if any). const children = R.path(['props', 'children'], component); // Update internal state with these children. if (children) this[PROP]('componentChildren', children); // Load the component in the window. api.loadComponent(component); // Update the window state with internal state api.setCurrent(this[PROP].state); return this; }
const messages = messageActions.scan((currentMessages, action) => { if (action.type == 'add') { return ramda.merge(currentMessages, action.data) } else { return ramda.omit(ramda.keys(action.data), currentMessages) } }, {})
module.exports = props => h(Box.withComponent('header'), R.omit(['showSpinner'], props), [ h(Flex, { height: '100%', alignItems: 'center', justifyContent: 'space-around', p: 1, }, [ h(Box, [ h(Heading, { level: 1, m: 0, mr: 2, fontSize: 3, }, [ h('a', { href: '', }, h('img', { src: 'images/periodo-logo.svg', height: 32, })) ]), ]), h(Box, { width: 22 }, [ props.showSpinner && h(Spinner, { size: 22 }), ]), h(Box, ' '), ]) ])
function companyLegalStatus( state: LegalStatusRequirements = {}, action: Action ): LegalStatusRequirements { switch (action.type) { case 'COMPANY_IS_SOLE_PROPRIETORSHIP': return { ...state, soleProprietorship: action.isSoleProprietorship } case 'DEFINE_DIRECTOR_STATUS': return { ...state, directorStatus: action.status } case 'COMPANY_HAS_MULTIPLE_ASSOCIATES': return { ...state, multipleAssociates: action.multipleAssociates } case 'COMPANY_IS_MICROENTERPRISE': return { ...state, autoEntrepreneur: action.autoEntrepreneur } case 'SPECIFY_DIRECTORS_SHARE': return { ...state, minorityDirector: action.minorityDirector } case 'RESET_COMPANY_STATUS_CHOICE': return action.answersToReset ? omit(action.answersToReset, state) : {} case 'SAVE_EXISTING_COMPANY_DETAILS': return action.details.apiDetails.nature_entrepreneur_individuel ? { ...state, soleProprietorship: true } : state } return state }
module.exports = function (name, arr) { var database, changes; /** * Used to add a database to the mock couch * @param {string} name - the name of the database * @param {array} arr - array with the rows */ arr = arr || []; if (!Array.isArray(arr)) { return false; } // Add an _id and a _rev to each document, if necessary. arr = R.map(function (doc) { doc._id = doc._id || createMD5(); doc._rev = doc._rev || '1-' + createMD5(JSON.stringify(doc)); return doc; }, arr); // Prepare the database object. // Is pretty much the passed array, converted to an object, // where each property is the document, indexed by the _id database = R.compose( R.mapObj(R.omit(['_id'])), R.mapObj(R.head), R.groupBy(R.prop('_id')), R.cloneDeep )(arr); changes = R.compose( R.map.idx(function (doc, index) { return { seq : index, id : doc._id, changes : [ { rev : doc._rev } ], doc : doc }; }), R.filter(function (doc) { // don't emit changes for _local documents return doc._id.indexOf('_local') !== 0; }), R.cloneDeep )(arr); this.databases[name] = mockDB(database); this.changes[name] = changes; Object.defineProperty(this.sequence, name, { get : function () { return this.changes[name].length; }.bind(this) }); return this.databases[name]; };
const find = query => { return knex("bookmarks") .returning(allowedFields) .offset(query.offset || 0) .limit(query.limit || null) .where(omit(["limit", "offset"], query)) .orderBy("createdAt", "desc"); };
function Warnings(props) { const { warnings } = props return h( Box, R.omit([ 'warnings' ], props), R.map(warning => h(WarnText, {}, `Warning: ${warning}`), warnings) ) }
module.exports = props => h(LayoutRenderer, R.omit(['patches', 'backend'], Object.assign({}, props, { blocks: { 'patch-list': PatchList, }, createReadStream: () => fromArray.obj(props.patches), extraProps: { backend: props.backend }, })))
export const multivarka = (...reqBuildChain) => compose( tap(startRequest), over(lensProp('query'), RWhen( pathSatisfies(equals(0), ['$and', 'length']), omit(['$and']) )), ...reqBuildChain )(RequestType);
[AppConstants.ADD_TIME_ENTRY]: action => { const body = R.omit(['id'], action.data); return jobApi.addTimeEntry(action.data.id, body) .then(message => { _selected.entries.push(body); }); },
this.app.put('/pets', function(req, res) { var petId = req.body.uuid, pet = R.merge(defaultPet, R.omit(['petId'], req.body)); console.log('req.body', req.body); pet._id = petId; this.pets[petId] = pet; return res.status(200).send(JSON.stringify(pet)); }.bind(this));
const builder = R.memoize(function init(settings) { const schema = builder.schema = new Sequelize( settings.database, settings.username, settings.password, R.omit(['database', 'username'], settings) ); schema.sync(); });
function normalizeSingleCorsBiddingStats(corsBiddingStats) { return corsBiddingStats.map( R.pipe( R.omit(['ModuleCode']), R.evolve({ Group: titleize, Faculty: titleize, StudentAcctType: R.replace('<br>', ''), }), ), ); }
handleChange(e) { const { onValueChange } = this.props , { name, value } = e.target if (!onValueChange) return; const fn = value ? R.assoc(name, value) : R.omit(name) onValueChange(fn(this.props.value)) }
export const bookingRetrieval = (username, password, result, options = {}) => { const namespace = options.namespace || 'http://www.expediaconnect.com/EQC/BR/2014/01'; const fields = [FIELDS.HOTEL_ID, FIELDS.PREVIOUS_DAYS, FIELDS.BOOKING_ID, FIELDS.STATUS]; const query = { BookingRetrievalRQ: R.omit(fields, R.mergeAll([ { $xmlns: namespace, Authentication: { $username: username, $password: password } }, appendHotel(result), { ParamSet: R.omit(fields, R.mergeAll([ appendStatus(result), appendPreviousDays(result), appendBookingId(result) ])) } ])) }; return Xml.builder(query); };
render() { return ( <div {...omit(['onlyIfNotVisible', 'when'], this.props)} style={{ ...this.props.style, ...(!this.props.children ? { position: 'absolute' } : {}) }} ref={ref => (this.ref = ref)} /> ) }
const FieldList = fieldSpecs => props => { const { value, compare } = props , fields = fieldsExtractor(fieldSpecs) return h( Box, R.merge(R.omit([ 'value', 'compare' ], props), { is: 'dl' }), compare ? showChanges(Field)(findChanges(fields(value), fields(compare))) : R.map(show(Field), fields(value)) ) }
module.exports = R.curry((verb_index, insult_data) => R.compose( R.omit(['verbs']), R.assoc('plural', insult_data.verbs[verb_index].plural), R.over( verb_lens, R.compose( R.ifElse( () => insult_data.first_person, R.prop('first_person'), R.prop('third_person')), R.nth(verb_index)))) (insult_data))
User.findOne({ username: username, emailConfirmed: true }, (err, user) => { if (err || !user) { done(null, false) } else { // Check password if (passwordHash.verify(password, user.password)) { user = R.omit(['password', 'emailConfirmationToken', 'emailConfirmed'], user) // @todo: replace with pick done(null, user) } else { done(null, false) } } })