Skip to content

Instantly share code, notes, and snippets.

@spencercwood
spencercwood / SimplePromise.js
Last active January 3, 2018 23:57
Simple (?) promise implementation, definitely not spec compliant
class SimplePromise {
static resolve(value) {
return new SimplePromise((resolve) => resolve(value));
}
static reject(value) {
return new SimplePromise((resolve, reject) => reject(value));
}
// fixme
var someObj = {
someMethod: function() {
this.someProp = 'huzzah!';
console.log(this);
// this refers to someObj:
// { ..., someProp: 'huzzah!' }
someNestedFunction();
const config = require('./config');
const fetch = require('node-fetch');
const querystring = require('querystring');
module.exports = {
get,
post,
put,
delete: httpDelete, // function name can't be 'delete'
fetchJsonWithAuth,