How to use the of function from highland

Find comprehensive JavaScript highland.of code examples handpicked from public code repositorys.

8
9
10
11
12
13
14
15
16
17
18
19


let resolveAbsolutePath = p => path.resolve(process.cwd(), p);


let resolveTemplate = template => {
    if (!/https:\/\//.test(template)) {
        return hl.of(template)
            .map(resolveAbsolutePath)
            .flatMap(fs.statStream);
    } else {
        return hl.of(1);
fork icon7
star icon5
watch icon0

+ 25 other calls in file

23
24
25
26
27
28
29
30
31
32
    return (post.author.username || post.author.id) + ' - ' + (new Date(post.time)).toString() + '\n' +
    '  ' + post.content + '\n'
  })
},
help: function () {
  return _.of(
    'usage: blipper <command> [<arg>]\n' +
    'commands:\n' +
    '  name     Set your username\n' +
    '  about    Set your about info\n' +
fork icon1
star icon1
watch icon0

41
42
43
44
45
46
47
48
49
    return push(new Error(message));
  };
}

function errIfNotOk(res) {
  if (res.ok) return h.of(res);
  return h(res.text()) // you must read the response to close the client
    .map(() => {
      const err = new Error();
fork icon1
star icon0
watch icon16

+ 7 other calls in file

27
28
29
30
31
32
33
34
35
36
37
  return h.wrapCallback(q.get, r.nthArg(1))(url)
    .map(JSON.parse)
}


module.exports.matchAgainst = fuseConfig => recurse => match => prop => response => {
  return h.of(response)
    .map(r.prop(prop))
    .map(r.map(r.reject(r.isNil)))
    .flatMap(r.pipe(
      r.construct(F)(r.__, fuseConfig),
fork icon0
star icon1
watch icon0

+ 2 other calls in file

5
6
7
8
9
10
11
12
13
14
15
16
const { get, mutateUrl } = require('./utils')


const baseUrl = url.parse('https://transit.land/api/v1/schedule_stop_pairs?offset=0&per_page=50&sort_key=origin_departure_time&sort_order=asc&origin_onestop_id=foo&origin_departure_between=foo&service_from_date=foo', true)


module.exports = function (options) {
  const getSchedules = stop => url => h.of(url)
    .map(r.compose(
      r.over(r.lensProp('query'), r.reject(r.isNil)),
      r.set(r.lensPath(['query', 'origin_onestop_id']), r.prop('onestop_id')(stop)),
      r.over(r.lensPath(['query', 'origin_departure_between']), () => {
fork icon0
star icon1
watch icon0