Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* @returns boolean
*/
const isEnvVariableOn = (name) => {
const value = process.env[name]
if (!value) {
return false
}
return value === 'true'
|| value === 'TRUE'
|| value === 'on'
|| value === '1'
|| value === 'yes'
}
const isForced = process.argv.some(equals('--force')) || isEnvVariableOn('FORCE_DEPLOY')
const isValidEnvironment = is.oneOf(['staging', 'production'])
/* eslint-disable no-console */
/**
* Checks if current Git branch (develop, master, hot-fix-1)
* is allowed to deploy to the target environment
*
* @param env {string} Target environment, like "staging" or "production"
*/
function isRightBranch (env) {
la(is.unemptyString(env), 'expected environment name', env)
// allow multiple branches to deploy to staging environment,
// add to the keys in this object
it('tests currying', function() {
assert.isTrue(
RA.lensSatisfies(equals('bar'))(lensProp('foo'))({ foo: 'bar' })
);
assert.isTrue(
RA.lensSatisfies(equals('bar'), lensProp('foo'))({ foo: 'bar' })
);
assert.isTrue(
RA.lensSatisfies(equals('bar'))(lensProp('foo'))({ foo: 'bar' })
);
});
});
return getPackage()
.then(({ name }) => read(name))
.then(render)
.tap(console.log.bind(console))
.catch(() => reject(new Error('Unable to read database')));
}
function cliClear() {
return getPackage()
.then(({ name }) => clear(name))
.catch(() => reject(new Error('Unable to clear database')));
}
export default pipe(prop('option'), cond([
[equals('read'), cliRead],
[equals('clear'), cliClear],
[T, option => reject(new Error(`Unknown option ${option}`))]
]));
componentWillReceiveProps(nextProps) {
if (!R.equals(this.props.fixedKeys, nextProps.fixedKeys)) {
const keys = calculateKeys(nextProps.fixedKeys);
this.setState({
keys,
hasChanges: false,
});
}
}
componentDidUpdate(prevProps: CombinedProps) {
if (
!equals(prevProps.domainRecords, this.props.domainRecords) ||
!equals(prevProps.domain, this.props.domain)
) {
this.setState({ types: this.generateTypes() });
}
}
const duration =
getState().newWorkout.data.sec +
getState().newWorkout.data.hr * 3600 +
getState().newWorkout.data.min * 60
const distance = getState().newWorkout.data.distanceMi
const newPace =
Number.isNaN(duration / distance) || equals(duration / distance, Infinity)
? 0
: duration / distance
dispatch({
type: NEW_WORKOUT_FORM_UPDATED,
payload: { paceSecPerMi: newPace }
})
if (equals(category, 'Swim')) {
const stroke = getState().newWorkout.data.stroke
const newCalories = dispatch(
caloriesBurned(category, distance, duration, stroke)
)
dispatch({
type: NEW_WORKOUT_FORM_UPDATED,
payload: { calories: newCalories }
})
return
}
const newCalories = dispatch(caloriesBurned(category, distance, duration))
dispatch({
type: NEW_WORKOUT_FORM_UPDATED,
'secondary'
)
)
],
[
Requals('dependencies'),
Ralways(
this.renderTooltipIcon(
CodeIcon,
'dependency',
'secondary'
)
)
],
[
Requals('devDependencies'),
Ralways(
this.renderTooltipIcon(
BuildIcon,
'devDependency',
'primary'
)
)
],
[
Requals('optionalDependencies'),
Ralways(
this.renderTooltipIcon(
OptIcon,
'optionalDependency',
'error'
)
() => (
),
],
/**
* HEX
*
* @author Michael Hsu
*/
[
R.equals('HEX_CONTROL'),
() => (
eventHandler({ type: 'SUBMIT', id, values })}
onChange={e =>
eventHandler({
type: 'CHANGE',
id,
values: { value: e.target.value },
})
}
onClear={() => eventHandler({ type: 'CLEAR', id, values: {} })}
/>
),
],
removeValue(id) {
const selected = this.getSelected()
if (this.props.many) {
this.props.onChange(
R.remove(
R.findIndex(R.equals(id), selected),
1,
selected
)
)
} else {
this.props.onChange(null)
}
}