Skip to content

Instantly share code, notes, and snippets.

@msanders
Created April 11, 2014 01:20
Show Gist options
  • Save msanders/dd887cffc4499ebc9514 to your computer and use it in GitHub Desktop.
Save msanders/dd887cffc4499ebc9514 to your computer and use it in GitHub Desktop.
static fromPromise<S>(promise: Parse.Promise<S>): Parse.Promise<Maybe<S>> {
return promise.then(x => Maybe.fromValue(x));
}
// Example
Maybe.fromPromise(
this.stack.moment.tz(today, timezone).isoWeekday() === 1 ? generateWeeklyDigest(today) : Parse.Promise.as()
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment