コード例 #1
0
ファイル: index.js プロジェクト: spenhar/countdown
 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'))
   }
 })
コード例 #2
0
ファイル: test.js プロジェクト: johnotander/diatonic
test('returns an object with values', t => {
  t.plan(2)

  const d = diatonic()

  t.true(isPresent(d))
  t.is(d.inch, '6rem')
})
コード例 #3
0
ファイル: index.js プロジェクト: johnotander/tachyonify
    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)
      }
    })
コード例 #4
0
      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;
        }
      });
コード例 #5
0
ファイル: index.js プロジェクト: johnotander/coinr
  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'))
  })
コード例 #6
0
ファイル: cli-test.js プロジェクト: johnotander/naka
 cp.execFile('../cli.js', ['-h'], (err, stdout, stderr) => {
   t.true(isPresent(stdout))
   t.end()
 })
コード例 #7
0
ファイル: index.js プロジェクト: johnotander/coinr
 d.json().then(d => {
   const response = isPresent(currency) ? d[0] : d
   isPresent(response) ? resolve(response) : reject(response)
 })
コード例 #8
0
ファイル: Explore.js プロジェクト: johnotander/random-a11y
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'>
コード例 #9
0
ファイル: App.js プロジェクト: johnotander/random-a11y
    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])
    }
  },