Comparing version 0.1.0-alpha.3 to 0.1.0-alpha.4
@@ -10,3 +10,3 @@ /** | ||
* @providesModule areEqual | ||
* @flow | ||
* | ||
*/ | ||
@@ -27,3 +27,3 @@ | ||
*/ | ||
function areEqual(a /*: any*/, b /*: any*/) /*: boolean*/ { | ||
function areEqual(a, b) { | ||
var aStack = aStackPool.length ? aStackPool.pop() : []; | ||
@@ -39,3 +39,3 @@ var bStack = bStackPool.length ? bStackPool.pop() : []; | ||
function eq(a /*: any*/, b /*: any*/, aStack /*: Array<any>*/, bStack /*: Array<any>*/) /*: boolean*/ { | ||
function eq(a, b, aStack, bStack) { | ||
if (a === b) { | ||
@@ -42,0 +42,0 @@ // Identical objects are equal. `0 === -0`, but they aren't identical. |
@@ -11,3 +11,3 @@ /** | ||
* @typechecks | ||
* @flow | ||
* | ||
*/ | ||
@@ -32,3 +32,3 @@ | ||
var Deferred = (function () { | ||
function Deferred /*:: <Tvalue, Treason>*/() { | ||
function Deferred() { | ||
var _this = this; | ||
@@ -40,4 +40,4 @@ | ||
this._promise = new Promise(function (resolve, reject) { | ||
_this._resolve = (resolve /*: any*/); | ||
_this._reject = (reject /*: any*/); | ||
_this._resolve = resolve; | ||
_this._reject = reject; | ||
}); | ||
@@ -50,3 +50,3 @@ } | ||
Deferred.prototype.resolve = function resolve(value /*: Tvalue*/) /*: void*/ { | ||
Deferred.prototype.resolve = function resolve(value) { | ||
this._settled = true; | ||
@@ -56,3 +56,3 @@ this._resolve(value); | ||
Deferred.prototype.reject = function reject(reason /*: Treason*/) /*: void*/ { | ||
Deferred.prototype.reject = function reject(reason) { | ||
this._settled = true; | ||
@@ -62,11 +62,11 @@ this._reject(reason); | ||
Deferred.prototype.then = function then() /*: Promise*/ { | ||
Deferred.prototype.then = function then() { | ||
return Promise.prototype.then.apply(this._promise, arguments); | ||
}; | ||
Deferred.prototype.done = function done() /*: void*/ { | ||
Deferred.prototype.done = function done() { | ||
Promise.prototype.done.apply(this._promise, arguments); | ||
}; | ||
Deferred.prototype.isSettled = function isSettled() /*: boolean*/ { | ||
Deferred.prototype.isSettled = function isSettled() { | ||
return this._settled; | ||
@@ -73,0 +73,0 @@ }; |
@@ -10,3 +10,3 @@ /** | ||
* @providesModule everyObject | ||
* @flow | ||
* | ||
* @typechecks | ||
@@ -37,3 +37,3 @@ */ | ||
*/ | ||
function everyObject(object /*: ?Object*/, callback /*: (value: any, name: string, object: Object) => any*/, context /*:: ?: any*/) /*: boolean*/ { | ||
function everyObject(object, callback, context) { | ||
for (var name in object) { | ||
@@ -40,0 +40,0 @@ if (hasOwnProperty.call(object, name)) { |
@@ -14,2 +14,3 @@ /** | ||
module.exports = require('whatwg-fetch'); | ||
require('whatwg-fetch'); | ||
module.exports = self.fetch.bind(self); |
@@ -11,3 +11,3 @@ /** | ||
* @typechecks | ||
* @flow | ||
* | ||
*/ | ||
@@ -26,13 +26,2 @@ | ||
/*:: type InitWitRetries = { | ||
body?: mixed; | ||
cache?: ?string; | ||
credentials?: ?string; | ||
fetchTimeout?: number; | ||
headers?: mixed; | ||
method?: ?string; | ||
mode?: ?string; | ||
retryDelays?: Array<number>; | ||
};*/ | ||
var DEFAULT_FETCH_TIMEOUT = 15000; | ||
@@ -46,3 +35,3 @@ var DEFAULT_RETRY_DELAYS = [1000, 3000]; | ||
*/ | ||
function fetchWithRetries(uri /*: string*/, initWithRetries /*: InitWitRetries*/) /*: Promise*/ { | ||
function fetchWithRetries(uri, initWithRetries) { | ||
var fetchTimeout = initWithRetries.fetchTimeout; | ||
@@ -65,3 +54,3 @@ var retryDelays = initWithRetries.retryDelays; | ||
*/ | ||
function sendTimedRequest() /*: void*/ { | ||
function sendTimedRequest() { | ||
requestsAttempted++; | ||
@@ -111,3 +100,3 @@ requestStartTime = Date.now(); | ||
*/ | ||
function retryRequest() /*: void*/ { | ||
function retryRequest() { | ||
var retryDelay = nonNullRetryDelays[requestsAttempted - 1]; | ||
@@ -122,3 +111,3 @@ var retryStartTime = requestStartTime + retryDelay; | ||
*/ | ||
function shouldRetry(attempt /*: number*/) /*: boolean*/ { | ||
function shouldRetry(attempt) { | ||
return ExecutionEnvironment.canUseDOM && attempt <= nonNullRetryDelays.length; | ||
@@ -125,0 +114,0 @@ } |
@@ -10,3 +10,3 @@ /** | ||
* @providesModule nullthrows | ||
* @flow | ||
* | ||
*/ | ||
@@ -16,3 +16,3 @@ | ||
var nullthrows = function /*:: <T>*/(x /*: ?T*/) /*: T*/ { | ||
var nullthrows = function (x) { | ||
if (x != null) { | ||
@@ -19,0 +19,0 @@ return x; |
@@ -10,5 +10,10 @@ /** | ||
* @providesModule PromiseMap | ||
* @flow | ||
* | ||
*/ | ||
/** | ||
* A map of asynchronous values that can be get or set in any order. Unlike a | ||
* normal map, setting the value for a particular key more than once throws. | ||
* Also unlike a normal map, a key can either be resolved or rejected. | ||
*/ | ||
'use strict'; | ||
@@ -22,10 +27,4 @@ | ||
/** | ||
* A map of asynchronous values that can be get or set in any order. Unlike a | ||
* normal map, setting the value for a particular key more than once throws. | ||
* Also unlike a normal map, a key can either be resolved or rejected. | ||
*/ | ||
/*:: import type * as Promise from 'Promise';*/ | ||
var PromiseMap = (function () { | ||
function PromiseMap /*:: <Tvalue, Treason>*/() { | ||
function PromiseMap() { | ||
_classCallCheck(this, PromiseMap); | ||
@@ -36,7 +35,7 @@ | ||
PromiseMap.prototype.get = function get(key /*: string*/) /*: Promise*/ { | ||
PromiseMap.prototype.get = function get(key) { | ||
return getDeferred(this._deferred, key).getPromise(); | ||
}; | ||
PromiseMap.prototype.resolveKey = function resolveKey(key /*: string*/, value /*: Tvalue*/) /*: void*/ { | ||
PromiseMap.prototype.resolveKey = function resolveKey(key, value) { | ||
var entry = getDeferred(this._deferred, key); | ||
@@ -47,3 +46,3 @@ !!entry.isSettled() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'PromiseMap: Already settled `%s`.', key) : invariant(false) : undefined; | ||
PromiseMap.prototype.rejectKey = function rejectKey(key /*: string*/, reason /*: Treason*/) /*: void*/ { | ||
PromiseMap.prototype.rejectKey = function rejectKey(key, reason) { | ||
var entry = getDeferred(this._deferred, key); | ||
@@ -57,3 +56,3 @@ !!entry.isSettled() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'PromiseMap: Already settled `%s`.', key) : invariant(false) : undefined; | ||
function getDeferred(entries /*: {[key: string]: Deferred}*/, key /*: string*/) /*: Deferred*/ { | ||
function getDeferred(entries, key) { | ||
if (!entries.hasOwnProperty(key)) { | ||
@@ -60,0 +59,0 @@ entries[key] = new Deferred(); |
@@ -11,3 +11,3 @@ /** | ||
* @typechecks | ||
* @flow | ||
* | ||
*/ | ||
@@ -20,3 +20,3 @@ | ||
function removeFromArray /*:: <T>*/(array /*: Array<T>*/, element /*: T*/) /*: void*/ { | ||
function removeFromArray(array, element) { | ||
var index = array.indexOf(element); | ||
@@ -23,0 +23,0 @@ if (index !== -1) { |
@@ -10,3 +10,3 @@ /** | ||
* @providesModule resolveImmediate | ||
* @flow | ||
* | ||
*/ | ||
@@ -23,3 +23,3 @@ | ||
*/ | ||
function resolveImmediate(callback /*: () => any*/) /*: void*/ { | ||
function resolveImmediate(callback) { | ||
resolvedPromise.then(callback)['catch'](throwNext); | ||
@@ -26,0 +26,0 @@ } |
@@ -11,3 +11,3 @@ /** | ||
* @typechecks | ||
* @flow | ||
* | ||
*/ | ||
@@ -24,3 +24,3 @@ | ||
*/ | ||
function shallowEqual(objA /*: mixed*/, objB /*: mixed*/) /*: boolean*/ { | ||
function shallowEqual(objA, objB) { | ||
if (objA === objB) { | ||
@@ -27,0 +27,0 @@ return true; |
@@ -10,3 +10,3 @@ /** | ||
* @providesModule someObject | ||
* @flow | ||
* | ||
* @typechecks | ||
@@ -37,3 +37,3 @@ */ | ||
*/ | ||
function someObject(object /*: ?Object*/, callback /*: (value: any, name: string, object: Object) => any*/, context /*:: ?: any*/) /*: boolean*/ { | ||
function someObject(object, callback, context) { | ||
for (var name in object) { | ||
@@ -40,0 +40,0 @@ if (hasOwnProperty.call(object, name)) { |
@@ -11,3 +11,3 @@ /** | ||
* @typechecks | ||
* @flow | ||
* | ||
*/ | ||
@@ -14,0 +14,0 @@ |
{ | ||
"name": "fbjs", | ||
"version": "0.1.0-alpha.3", | ||
"version": "0.1.0-alpha.4", | ||
"description": "", | ||
@@ -16,3 +16,2 @@ "main": "index.js", | ||
"babel": "^5.4.7", | ||
"babel-plugin-flow-comments": "^1.0.9", | ||
"del": "^1.2.0", | ||
@@ -19,0 +18,0 @@ "gulp": "^3.8.11", |
@@ -13,3 +13,2 @@ /** | ||
var babelPluginModules = require('../babel/rewrite-modules'); | ||
var babelPluginFlowComments = require('babel-plugin-flow-comments'); | ||
@@ -25,3 +24,3 @@ module.exports = { | ||
stage: 1, | ||
plugins: [babelPluginModules, babelPluginFlowComments], | ||
plugins: [babelPluginModules], | ||
_moduleMap: { | ||
@@ -28,0 +27,0 @@ 'core-js/library/es6/map': 'core-js/library/es6/map', |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
144229
10
111
4119
2