How to use the data.task.of function in data

To help you get started, we’ve selected a few data examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github futurize / future-io / lib / wrap-function.js View on Github external
function wrapper (/* arguments */) {
          try {
            const result = f.apply(null, arguments)
            if (isPromise(result)) {
              return new Task((reject, resolve) => result.then(resolve, reject))
            } else if (isTask(result)) {
              return result
            } else {
              return Task.of(result)
            }
          } catch (error) {
            return Task.rejected(error)
          }
        },
        Array.prototype.slice.call(arguments)
github philbot9 / youtube-comment-api / test / fetch-comments.js View on Github external
it('fetches a comment page without a pageToken', function () {
    var videoId = 'abc1234'
    var commentPage = { comment: 'page' }

    var fetchCommentsTask = td.replace('../lib/youtube-comments-task-wrapper')
    var fetchComments = require('../lib/fetch-comments')

    td.when(fetchCommentsTask(videoId), { ignoreExtraArgs: true })
      .thenReturn(Task.of(commentPage))

    return fetchComments(videoId)
      .then(function (p) {
        expect(p).to.deep.equal(commentPage)
      })
  })
github DrBoolean / Practically-Functional / todo-app / src / todolist.js View on Github external
const setTodos = todos =>
  Task.of(JSON.stringify(todos))
  .chain(str => setItem('todos', str))
  .map(() => todos)
github salesforce-ux / design-system / scripts / vrt.js View on Github external
const getRef = () =>
  Task.of(path.resolve(__dirname, 'snap.json'))
    .chain(filepath => statOrDownload(snapUrl(branch), filepath))
    .chain(readFile);
github philbot9 / youtube-comments-task / src / lib / fetch-replies.js View on Github external
({ replies, nextRepliesToken }) =>
        (nextRepliesToken
          ? fetchAllReplies(videoId, nextRepliesToken).map(nextReplies =>
              replies.concat(nextReplies)
            )
          : Task.of(replies))
    )

data

A Javascript data representation library.

Unknown
Latest version published 13 years ago

Package Health Score

36 / 100
Full package analysis