return githubRepos('tachyons-css').then(function (repos) { if (isPresent(repos)) { return repos.filter(isCssModule) } else { return Promise.reject(new Error('No results found for tachyons-css')) } })
test('returns an object with values', t => { t.plan(2) const d = diatonic() t.true(isPresent(d)) t.is(d.inch, '6rem') })
css.walkDecls(function (decl) { var klass = decl.parent && decl.parent.selectors && decl.parent.selectors[0] if (isPresent(klass)) { props[klass] = props[klass] || {} props[klass][decl.prop] = [] || props[klass][decl.prop] props[klass][decl.prop].push(decl.value) } })
rule.selectors = rule.selectors.map(function(selector) { var shouldIgnore = false; if (hasClassSelector(selector)) { // Ensure that the selector doesn't match the ignored list if (isPresent(ignored)) { shouldIgnore = ignored.some(function(opt) { if (typeof opt == 'string') { return selector === opt; } else if (opt instanceof RegExp) { return opt.exec(selector); } }); } return shouldIgnore ? selector : selector.split('.').join('.' + prefix); } else { return selector; } });
return new Promise((resolve, reject) => { let currencyId = null let url = null if (isPresent(currency)) { currencyId = tickersMap[currency.toLowerCase()] || currency url = `${baseUrl}${currencyId}` } else { url = baseUrl } fetch(url) .then(d => { d.json().then(d => { const response = isPresent(currency) ? d[0] : d isPresent(response) ? resolve(response) : reject(response) }) }) .catch(() => reject('Failed to fetch currency data')) })
cp.execFile('../cli.js', ['-h'], (err, stdout, stderr) => { t.true(isPresent(stdout)) t.end() })
d.json().then(d => { const response = isPresent(currency) ? d[0] : d isPresent(response) ? resolve(response) : reject(response) })
import Color from 'color' const App = React.createClass({ propTypes: { location: PropTypes.object.isRequired, navigate: PropTypes.func.isRequired }, contextTypes: { router: PropTypes.object }, getCombo () { let { location: { query: { hex } } } = this.props if (isPresent(hex)) { hex = `#${hex}` } return random(hex) }, render () { let combos = [] for (let i = 0; i < 30; i++) { combos.push(this.getCombo()) } return ( <div className='sans-serif relative'> <Header /> <div className='ph4 mw8 center'> <h2 className='f5 tl b pt4 mb3'>
navigate: PropTypes.func.isRequired, setCurrentCombo: PropTypes.func.isRequired, upvote: PropTypes.func.isRequired, downvote: PropTypes.func.isRequired, currentCombo: PropTypes.array, currentVote: PropTypes.string }, contextTypes: { router: PropTypes.object }, cycleCurrentCombo () { let { location: { query: { hex } } } = this.props if (isPresent(hex)) { hex = `#${hex}` } this.props.setCurrentCombo(random(hex)) }, initializeCompare () { let { location: { query: { hex, compare } } } = this.props hex = `#${hex}` compare = `#${compare}` if (isPresent(hex) && isPresent(compare)) { this.props.setCurrentCombo([hex, compare]) } },