const depsMatched = fnObj.deps.find((deps) => { const depsArr = deps.split('.'); if (isEqual(depsArr, pathArray)) return true; if (pathArray.length < depsArr.length) { const pathLastIndex = pathArray.length - 1; if (isEqual(pathArray[pathLastIndex], depsArr[pathLastIndex])) return true; } if (pathArray.length <= depsArr.length) { return pathArray.find((keyItem, index) => depsArr[index] !== keyItem); } });
function updateOptionBasepath (result, optionName) { const currentPath = _.get(optionName, result) // process only keys that contains // lamassu-server dir in its path const i = indexOfLs(currentPath) if (i === -1) { return } // workout the relative path // /usr/lib/node_modules/lamassu-server/certs/Lamassu_OP.pem => certs/Lamassu_OP.pem const rPath = _.drop(i + 1, paths(currentPath)) // prepend the current lamassu-server path // certs/Lamassu_OP.pem => /usr/local/lib/node_modules/lamassu-server/certs/Lamassu_OP.pem const newPath = _.join(path.sep, _.concat([currentBasePath], rPath)) // update this option // if the value has changed if (!_.isEqual(currentPath, newPath)) { console.log(`Migrating option ${optionName} to new path ${newPath}`) result[optionName] = newPath } }
async function run () { // load defaults const defaultOpts = require('../lamassu-default') // load current opts const options = load() const currentOpts = options.opts // check if there are new options to add let result = _.mergeAll([defaultOpts, currentOpts]) // get all the options // that ends with "Path" suffix console.log(`Detected lamassu-server basepath: ${currentBasePath}`) _.each(_.wrap(updateOptionBasepath, result), [ 'seedPath', 'caPath', 'certPath', 'keyPath', 'lamassuCaPath' ]) const shouldMigrate = !_.isEqual(result, currentOpts) || _.has('lamassuServerPath', result) // write the resulting lamassu.json if (shouldMigrate) { // remove old lamassuServerPath config result = _.omit('lamassuServerPath', result) // find keys for which values // have been changed const differentValue = _.wrap(_.filter, key => !_.isEqual(result[key], currentOpts[key])) // output affected options const newOpts = _.pick(_.union( // find change keys differentValue(_.keys(result)), // find new opts _.difference(_.keys(result), _.keys(currentOpts)) ), result) console.log('Updating options', newOpts) // store new lamassu.json file fs.writeFileSync(options.path, JSON.stringify(result, null, ' ')) } // get all the new options // that ends with "Dir" suffix mapKeyValuesDeep((v, k) => { if (_.endsWith('Dir', k)) { const path = _.attempt(() => makeDir.sync(v)) if (_.isError(path)) { console.error(`Error while creating folder ${v}`, path) } } }, result) }
const combineSubsequentTexts = (result, component) => { const previousComponent = last(result); if ( isText(component) && isText(previousComponent) && isEqual(component.font, previousComponent.font) ) { previousComponent.content += component.content; } else { result.push(component); } return result; };
return next => (action) => { const previousState: State = getState(); const returnValue = next(action); const nextState: State = getState(); if (!isEqual(nextState.customUnits, previousState.customUnits)) { batchImplementation.setCustomUnits(nextState.customUnits); } const { added, changed, removed } = getAddedChangedRemovedSectionItems( nextState.sectionTextInputs, previousState.sectionTextInputs ); forEach(batchImplementation.unloadSection, removed); const sectionsToLoad = concat(added, changed); forEach(sectionId => ( batchImplementation.loadSection(sectionId, nextState.sectionTextInputs[sectionId]) ), sectionsToLoad); return returnValue; };
1: (v) => _.isEqual(v, notes)
.catch(actual => { const expected = new MockError('afterTimeoutMiddleware middleware after hook timed out in ' + TEST_TIMEOUT + 'ms.'); return fp.isEqual(expected)(actual) || { expected, actual }; });
.catch(actual => { const expected = new MockError('always passes afterEach hook timed out in ' + TEST_TIMEOUT + 'ms.'); return fp.isEqual(expected)(actual) || { expected, actual }; });
.catch(actual => { const expected = new MockError('SUITE NAME after hook timed out in ' + TEST_TIMEOUT + 'ms.'); return fp.isEqual(expected)(actual) || { expected, actual }; });
'use strict'; const {includes, isEqual, overEvery} = require('lodash/fp'); const {isNotUniqueSelector, isUniqueSelector} = require('./check'); const {control: controlOfInput} = require('../pageObject/Input'); const {native: nativeOfCheck} = require('../pageObject/Check'); const {native: nativeOfCheckGroup} = require('../pageObject/CheckGroup'); const {native: nativeOfRadio} = require('../pageObject/Radio'); const {native: nativeOfTumbler} = require('../pageObject/Tumbler'); const allPass = (...checks) => overEvery(checks); const isCheck = allPass(includes(nativeOfCheck), isUniqueSelector); const isCheckGroup = allPass(includes(nativeOfCheckGroup), isNotUniqueSelector); const isInput = allPass(includes(controlOfInput)); const isRadio = allPass(includes(nativeOfRadio)); const isSelect = allPass(isEqual('')); const isTumbler = allPass(includes(nativeOfTumbler)); exports.allPass = allPass; exports.isCheck = isCheck; exports.isCheckGroup = isCheckGroup; exports.isInput = isInput; exports.isRadio = isRadio; exports.isSelect = isSelect; exports.isTumbler = isTumbler;
return _runCreatorCreator(() => {}, TEST_TIMEOUT, Error, [], [])([])({}).then(actual => fp.isEqual(expected)(actual) || { expected, actual }
} else if (some(key => !isEqual(nextState[key], previousState[key]), cacheKeys)) {
}; export const fetchPatientsOnMount = ({ componentDidMount() { this.props.actions.fetchPatientsRequest(); }, }); export const fetchPatientsCountsOnMountAndUpdate = ({ componentDidMount() { const { actions, currentPagePatients } = this.props; actions.fetchPatientCountsRequest(currentPagePatients); }, componentWillReceiveProps({ currentPagePatients, actions, offset }) { const isNewPatients = _.negate(_.isEqual(this.props.currentPagePatients)); return _.cond([ [isNewPatients, actions.fetchPatientCountsRequest], ])(currentPagePatients) }, }); export const fetchHeaderToolbarOnMount = ({ componentDidMount() { const { actions, match } = this.props; const userId = _.get('params.userId', match); if (userId && _.isEmpty(this.props.patientsDemographics[userId])) actions.fetchPatientDemographicsRequest({ userId }) }, componentWillReceiveProps(nextProps) { const { actions, match } = this.props; const nextUserId = _.get('match.params.userId', nextProps);
}; const questionType = { 'choices': buildChoices(['skip', 'core', 'extras']), 'message': 'Select which group of packages to install', 'name': 'installType', 'type': 'list', }; const questionCore = { 'choices': buildChoices( require('../configs/aptget.installs.core.js') ), 'when': _.flow([ fp.property('installType'), fp.isEqual('core'), ]), 'message': 'Install CORE packages', 'name': 'installCore', 'type': 'checkbox', }; const questionExtras = { 'choices': buildChoices( require('../configs/aptget.installs.extras.js') ), 'when': _.flow([ fp.property('installType'), fp.isEqual('extras'), ]), 'message': 'Install EXTRA packages',
const differentValue = _.wrap(_.filter, key => !_.isEqual(result[key], currentOpts[key]))
const changed = reject(sectionId => isEqual( previousItems[sectionId], nextItems[sectionId] ), itemsThatMayHaveChanged);
}).then(actual => assertMany([ fp.isEqual(expected)(actual) || { expected, actual }, fp.isEqual(c.contextTrackers)(expectedContextTrackers) || { actualContextTrackers: c.contextTrackers, expectedContextTrackers } , ]));
.catch(actual => { const expected = new MockError('Root suite before hook timed out in ' + SHORT_TIMEOUT + 'ms.'); return fp.isEqual(expected)(actual) || { expected, actual }; });
'use strict'; var _extends2 = require('babel-runtime/helpers/extends'); var _extends3 = _interopRequireDefault(_extends2); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var _ = require('lodash/fp'); var editorconfig = require('editorconfig'); var maxLineLengthIsNumber = _.flow(_.get('max_line_length'), _.isNumber); var indentStyleIsTab = _.conforms({ indent_style: _.isEqual('tab') }); var indentSizeIsTab = _.conforms({ indent_size: _.isEqual('tab') }); var tabWidthIsNumber = _.conforms({ tab_width: _.isNumber }); var shouldUseTabWidth = _.overEvery([tabWidthIsNumber, _.overSome([indentSizeIsTab, indentStyleIsTab])]); var indentSizeIsNumber = _.conforms({ indent_size: _.isNumber }); var indentStyleIsSpace = _.conforms({ indent_style: _.isEqual('space') }); var getPrintWidth = _.cond([[maxLineLengthIsNumber, function (opts) { return { printWidth: opts.max_line_length }; }]]); var getTabWidth = _.cond([[shouldUseTabWidth, function (opts) { return { tabWidth: opts.tab_width };
import { isEqual, } from 'lodash/fp' export const isTest = isEqual('node-test') export const isDev = isEqual('develop') export const isProd = isEqual('production')