Comparing version 0.9.2-1 to 0.9.3-0
13
API.md
@@ -10,3 +10,2 @@ #API Reference | ||
- [`.bind(dynamic thisArg)`](#binddynamic-thisarg---promise) | ||
- [`.progressed(Function handler)`](#progressedfunction-handler---promise) | ||
- [`.done([Function fulfilledHandler] [, Function rejectedHandler ] [, Function progressHandler ])`](#donefunction-fulfilledhandler--function-rejectedhandler---function-progresshandler----promise) | ||
@@ -26,2 +25,4 @@ - [`Promise.try(Function fn [, Array<dynamic>|dynamic arguments] [, dynamic ctx] )`](#promisetryfunction-fn--arraydynamicdynamic-arguments--dynamic-ctx----promise) | ||
- [`.asCallback`](#ascallback---function) | ||
- [Progression](#progression) | ||
- [`.progressed(Function handler)`](#progressedfunction-handler---promise) | ||
- [Collections](#collections) | ||
@@ -405,6 +406,2 @@ - [`.all()`](#all---promise) | ||
#####`.progressed(Function handler)` -> `Promise` | ||
Shorthand for `.then(null, null, handler);`. Attach a progress handler that will be called if this promise is progressed. Returns a new promise chained from this promise. | ||
#####`.done([Function fulfilledHandler] [, Function rejectedHandler ] [, Function progressHandler ])` -> `Promise` | ||
@@ -533,2 +530,8 @@ | ||
##Progression | ||
#####`.progressed(Function handler)` -> `Promise` | ||
Shorthand for `.then(null, null, handler);`. Attach a progress handler that will be called if this promise is progressed. Returns a new promise chained from this promise. | ||
##Promise resolution | ||
@@ -535,0 +538,0 @@ |
262
Gruntfile.js
@@ -11,5 +11,61 @@ "use strict"; | ||
var optionalModuleRequireMap = { | ||
"any.js": true, | ||
"call_get.js": true, | ||
"filter.js": true, | ||
"generators.js": true, | ||
"map.js": true, | ||
"nodeify.js": true, | ||
"promisify.js": true, | ||
"props.js": true, | ||
"reduce.js": true, | ||
"settle.js": true, | ||
"some.js": true, | ||
"progress.js": true, | ||
"cancel.js": true, | ||
"simple_thenables.js": true, | ||
"complex_thenables.js": true, | ||
"synchronous_inspection.js": true | ||
}; | ||
function getOptionalRequireCode( srcs ) { | ||
return srcs.reduce(function(ret, cur){ | ||
if( optionalModuleRequireMap[cur] ) { | ||
ret += "require('./"+cur+"')(Promise, Promise$_All);\n"; | ||
} | ||
return ret; | ||
}, "") + "\nPromise.prototype = Promise.prototype;\nreturn Promise;\n"; | ||
} | ||
function getBrowserBuildHeader( sources ) { | ||
var header = "/**\n * bluebird build version " + gruntConfig.pkg.version + "\n"; | ||
var enabledFeatures = ["core"]; | ||
var disabledFeatures = []; | ||
featureLoop: for( var key in optionalModuleRequireMap ) { | ||
for( var i = 0, len = sources.length; i < len; ++i ) { | ||
var source = sources[i]; | ||
if( source.fileName === key ) { | ||
enabledFeatures.push( key.replace( ".js", "") ); | ||
continue featureLoop; | ||
} | ||
} | ||
disabledFeatures.push( key.replace( ".js", "") ); | ||
} | ||
header += ( " * Features enabled: " + enabledFeatures.join(", ") + "\n" ); | ||
if( disabledFeatures.length ) { | ||
header += " * Features disabled: " + disabledFeatures.join(", ") + "\n"; | ||
} | ||
header += "*/\n"; | ||
return header; | ||
} | ||
function applyOptionalRequires( src, optionalRequireCode ) { | ||
return src.replace( /};([^}]*)$/, optionalRequireCode + "\n};$1"); | ||
} | ||
var CONSTANTS_FILE = './src/constants.js'; | ||
var BUILD_DEBUG_DEST = "./js/main/promise.js"; | ||
var BUILD_DEBUG_DEST = "./js/main/bluebird.js"; | ||
@@ -22,2 +78,15 @@ var license; | ||
text = text.split("\n").map(function(line, index){ | ||
return " * " + line; | ||
}).join("\n") | ||
license = "/**\n" + text + "\n */\n"; | ||
} | ||
return license | ||
} | ||
var preserved; | ||
function getLicensePreserve() { | ||
if( !preserved ) { | ||
var fs = require("fs"); | ||
var text = fs.readFileSync("LICENSE", "utf8"); | ||
text = text.split("\n").map(function(line, index){ | ||
if( index === 0 ) { | ||
@@ -28,5 +97,5 @@ return " * @preserve " + line; | ||
}).join("\n") | ||
license = "/**\n" + text + "\n */\n"; | ||
preserved = "/**\n" + text + "\n */\n"; | ||
} | ||
return license; | ||
return preserved; | ||
} | ||
@@ -57,2 +126,3 @@ | ||
__DEBUG__: false, | ||
__BROWSER__: false, | ||
process: false, | ||
@@ -132,2 +202,18 @@ "console": false, | ||
src: [ | ||
"./src/synchronous_inspection.js", | ||
"./src/simple_thenables.js", | ||
"./src/complex_thenables.js", | ||
"./src/progress.js", | ||
"./src/cancel.js", | ||
"./src/any.js", | ||
"./src/call_get.js", | ||
"./src/filter.js", | ||
"./src/generators.js", | ||
"./src/map.js", | ||
"./src/nodeify.js", | ||
"./src/promisify.js", | ||
"./src/props.js", | ||
"./src/reduce.js", | ||
"./src/settle.js", | ||
"./src/some.js", | ||
"./src/util.js", | ||
@@ -139,3 +225,2 @@ "./src/schedule.js", | ||
"./src/async.js", | ||
"./src/thenable.js", | ||
"./src/catch_filter.js", | ||
@@ -215,3 +300,3 @@ "./src/promise.js", | ||
function buildMain( sources ) { | ||
function buildMain( sources, optionalRequireCode ) { | ||
var fs = require("fs"); | ||
@@ -225,4 +310,7 @@ var Q = require("q"); | ||
src = astPasses.expandConstants( src, source.fileName ); | ||
src = src.replace( /__DEBUG__/g, false ); | ||
src = src.replace( /__DEBUG__/g, "false" ); | ||
src = src.replace( /__BROWSER__/g, "false" ); | ||
if( source.fileName === "promise.js" ) { | ||
src = applyOptionalRequires( src, optionalRequireCode ); | ||
} | ||
var path = root + source.fileName; | ||
@@ -233,3 +321,3 @@ return writeFileAsync(path, src); | ||
function buildDebug( sources ) { | ||
function buildDebug( sources, optionalRequireCode ) { | ||
var fs = require("fs"); | ||
@@ -242,3 +330,7 @@ var Q = require("q"); | ||
src = astPasses.expandConstants( src, source.fileName ); | ||
src = src.replace( /__DEBUG__/g, true ); | ||
src = src.replace( /__DEBUG__/g, "true" ); | ||
src = src.replace( /__BROWSER__/g, "false" ); | ||
if( source.fileName === "promise.js" ) { | ||
src = applyOptionalRequires( src, optionalRequireCode ); | ||
} | ||
var path = root + source.fileName; | ||
@@ -249,3 +341,3 @@ return writeFileAsync(path, src); | ||
function buildZalgo( sources ) { | ||
function buildZalgo( sources, optionalRequireCode ) { | ||
var fs = require("fs"); | ||
@@ -259,4 +351,7 @@ var Q = require("q"); | ||
src = astPasses.asyncConvert( src, "async", "invoke", source.fileName); | ||
src = src.replace( /__DEBUG__/g, false ); | ||
src = src.replace( /__DEBUG__/g, "false" ); | ||
src = src.replace( /__BROWSER__/g, "false" ); | ||
if( source.fileName === "promise.js" ) { | ||
src = applyOptionalRequires( src, optionalRequireCode ); | ||
} | ||
var path = root + source.fileName; | ||
@@ -267,46 +362,108 @@ return writeFileAsync(path, src); | ||
function buildBrowser() { | ||
function buildBrowser( sources ) { | ||
var fs = require("fs"); | ||
var browserify = require("browserify"); | ||
var b = browserify("./js/main/promise.js"); | ||
var b = browserify("./js/main/bluebird.js"); | ||
var dest = "./js/browser/bluebird.js"; | ||
var header = getBrowserBuildHeader( sources ); | ||
return Q.nbind(b.bundle, b)({ | ||
detectGlobals: false, | ||
standalone: "Promise" | ||
detectGlobals: false, | ||
standalone: "Promise" | ||
}).then(function(src) { | ||
return writeFileAsync( "./js/browser/bluebird.js", | ||
getLicense() + src ) | ||
return writeFileAsync( dest, | ||
getLicensePreserve() + src ) | ||
}).then(function() { | ||
return Q.nfcall(fs.readFile, dest, "utf8" ); | ||
}).then(function( src ) { | ||
src = header + src; | ||
src = src.replace( "longStackTraces = false", "longStackTraces = true" ); | ||
return Q.nfcall(fs.writeFile, dest, src ); | ||
}); | ||
} | ||
function getOptionalPathsFromOption( opt ) { | ||
opt = (opt + "").toLowerCase().split(/\s+/g); | ||
return optionalPaths.filter(function(v){ | ||
v = v.replace("./src/", "").replace( ".js", "" ).toLowerCase(); | ||
return opt.indexOf(v) > -1; | ||
}); | ||
} | ||
function build() { | ||
var optionalPaths = [ | ||
"./src/synchronous_inspection.js", | ||
"./src/any.js", | ||
"./src/call_get.js", | ||
"./src/filter.js", | ||
"./src/generators.js", | ||
"./src/map.js", | ||
"./src/nodeify.js", | ||
"./src/promisify.js", | ||
"./src/props.js", | ||
"./src/reduce.js", | ||
"./src/settle.js", | ||
"./src/some.js", | ||
"./src/progress.js", | ||
"./src/cancel.js" | ||
]; | ||
var mandatoryPaths = [ | ||
"./src/bluebird.js", | ||
"./src/assert.js", | ||
"./src/global.js", | ||
"./src/get_promise.js", | ||
"./src/util.js", | ||
"./src/schedule.js", | ||
"./src/queue.js", | ||
"./src/errors.js", | ||
"./src/captured_trace.js", | ||
"./src/async.js", | ||
"./src/catch_filter.js", | ||
"./src/promise.js", | ||
"./src/promise_array.js", | ||
"./src/settled_promise_array.js", | ||
"./src/any_promise_array.js", | ||
"./src/some_promise_array.js", | ||
"./src/properties_promise_array.js", | ||
"./src/promise_inspection.js", | ||
"./src/promise_resolver.js", | ||
"./src/promise_spawn.js" | ||
]; | ||
var mutExPaths = [ | ||
{ | ||
feature: "simple_thenables", | ||
featureDisabled: "./src/complex_thenables.js", | ||
featureEnabled: "./src/simple_thenables.js" | ||
} | ||
]; | ||
function applyMutExPaths( paths, features ) { | ||
if( !Array.isArray( features ) ) { | ||
features = features.toLowerCase().split( /\s+/g ); | ||
} | ||
mutExPaths.forEach(function( mutExPath ){ | ||
if( features.indexOf( mutExPath.feature ) > -1 ) { | ||
paths.push( mutExPath.featureEnabled ); | ||
} | ||
else { | ||
paths.push( mutExPath.featureDisabled ); | ||
} | ||
}); | ||
return paths; | ||
} | ||
function build( paths ) { | ||
var fs = require("fs"); | ||
astPasses.readConstants(fs.readFileSync(CONSTANTS_FILE, "utf8"), CONSTANTS_FILE); | ||
var paths = [ | ||
"./src/bluebird.js", | ||
"./src/assert.js", | ||
"./src/global.js", | ||
"./src/get_promise.js", | ||
"./src/util.js", | ||
"./src/schedule.js", | ||
"./src/queue.js", | ||
"./src/errors.js", | ||
"./src/captured_trace.js", | ||
"./src/async.js", | ||
"./src/thenable.js", | ||
"./src/catch_filter.js", | ||
"./src/promise.js", | ||
"./src/promise_array.js", | ||
"./src/settled_promise_array.js", | ||
"./src/any_promise_array.js", | ||
"./src/some_promise_array.js", | ||
"./src/properties_promise_array.js", | ||
"./src/promise_inspection.js", | ||
"./src/promise_resolver.js", | ||
"./src/promise_spawn.js" | ||
]; | ||
if( !paths ) { | ||
paths = applyMutExPaths( optionalPaths.concat(mandatoryPaths), [] ); | ||
} | ||
var optionalRequireCode = getOptionalRequireCode(paths.map(function(v) { | ||
return v.replace("./src/", ""); | ||
})); | ||
var Q = require("q"); | ||
//spion this is why Promise.props is necessary | ||
var promises = []; | ||
@@ -333,6 +490,9 @@ var sources = paths.map(function(v){ | ||
}); | ||
return Q.all([ | ||
buildMain( sources ).then(buildBrowser), | ||
buildDebug( sources ), | ||
buildZalgo( sources ) | ||
buildMain( sources, optionalRequireCode ).then( function() { | ||
return buildBrowser( sources ); | ||
}), | ||
buildDebug( sources, optionalRequireCode ), | ||
buildZalgo( sources, optionalRequireCode ) | ||
]); | ||
@@ -434,3 +594,11 @@ }); | ||
var done = this.async(); | ||
build().then(function(){ | ||
var features = grunt.option("features"); | ||
var paths = null; | ||
if( features ) { | ||
paths = getOptionalPathsFromOption( features ).concat( mandatoryPaths ); | ||
applyMutExPaths( paths, features ); | ||
} | ||
build( paths ).then(function() { | ||
done(); | ||
@@ -437,0 +605,0 @@ }).catch(function(e) { |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -22,2 +22,3 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
*/ | ||
"use strict"; | ||
module.exports = (function(){ | ||
@@ -24,0 +25,0 @@ var AssertionError = (function() { |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -22,2 +22,4 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
*/ | ||
module.exports = require("./promise.js"); | ||
"use strict"; | ||
var Promise = require("./promise.js")(); | ||
module.exports = Promise; |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -23,2 +23,3 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
"use strict"; | ||
module.exports = function() { | ||
var ASSERT = require("./assert.js"); | ||
@@ -35,4 +36,7 @@ var inherits = require( "./util.js").inherits; | ||
var formatStack = null; | ||
var areNamesMangled = false; | ||
function CapturedTrace( ignoreUntil, isTopLevel ) { | ||
if( !areNamesMangled ) { | ||
} | ||
this.captureStackTrace( ignoreUntil, isTopLevel ); | ||
@@ -62,2 +66,5 @@ | ||
areNamesMangled = CapturedTrace.prototype.captureStackTrace.name !== | ||
"CapturedTrace$captureStackTrace"; | ||
CapturedTrace.combine = function CapturedTrace$Combine( current, prev ) { | ||
@@ -145,3 +152,3 @@ var curLast = current.length - 1; | ||
if( typeof err.stack === "string" && | ||
if( !areNamesMangled && typeof err.stack === "string" && | ||
typeof "".startsWith === "function" && | ||
@@ -199,2 +206,3 @@ ( err.stack.startsWith("stackDetection@")) && | ||
module.exports = CapturedTrace; | ||
return CapturedTrace; | ||
}; |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -23,2 +23,3 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
"use strict"; | ||
var getPromise = require( "./get_promise.js" ); | ||
var global = require("./global.js"); | ||
@@ -29,2 +30,3 @@ var util = require( "./util.js"); | ||
var notEnumerableProp = util.notEnumerableProp; | ||
var Promise = getPromise.get(); | ||
@@ -59,2 +61,12 @@ function isStackAttached( val ) { | ||
function apiRejection( msg ) { | ||
var error = new TypeError( msg ); | ||
var ret = Promise.rejected( error ); | ||
var parent = ret._peekContext(); | ||
if( parent != null ) { | ||
parent._attachExtraTrace( error ); | ||
} | ||
return ret; | ||
} | ||
function attachDefaultState( obj ) { | ||
@@ -115,4 +127,5 @@ try { | ||
isHandled: isHandled, | ||
canAttach: canAttach | ||
canAttach: canAttach, | ||
apiRejection: apiRejection | ||
}; | ||
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -22,2 +22,3 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
*/ | ||
"use strict"; | ||
var P; | ||
@@ -24,0 +25,0 @@ |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -49,2 +49,4 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
} | ||
PromiseArray.PropertiesPromiseArray = function() {}; | ||
PromiseArray.prototype.length = function PromiseArray$length() { | ||
@@ -51,0 +53,0 @@ return this._length; |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -23,2 +23,3 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
"use strict"; | ||
module.exports = function() { | ||
var global = require("./global.js"); | ||
@@ -32,22 +33,11 @@ var ASSERT = require("./assert.js"); | ||
var PromiseArray = require( "./promise_array.js" ); | ||
var SomePromiseArray = require( "./some_promise_array.js" ); | ||
var AnyPromiseArray = require( "./any_promise_array.js" ); | ||
var PropertiesPromiseArray = require( "./properties_promise_array.js" ); | ||
var SettledPromiseArray = require( "./settled_promise_array.js" ); | ||
var CapturedTrace = require( "./captured_trace.js"); | ||
var CapturedTrace = require( "./captured_trace.js")(); | ||
var CatchFilter = require( "./catch_filter.js"); | ||
var PromiseInspection = require( "./promise_inspection.js" ); | ||
var PromiseResolver = require( "./promise_resolver.js" ); | ||
var PromiseSpawn = require( "./promise_spawn.js" ); | ||
var Thenable = require( "./thenable.js" ); | ||
var isArray = util.isArray; | ||
var makeNodePromisified = util.makeNodePromisified; | ||
var THIS = util.THIS; | ||
var notEnumerableProp = util.notEnumerableProp; | ||
var isPrimitive = util.isPrimitive; | ||
var isObject = util.isObject; | ||
var ensurePropertyExpansion = util.ensurePropertyExpansion; | ||
var deprecated = util.deprecated; | ||
var errorObj = util.errorObj; | ||
@@ -67,6 +57,7 @@ var tryCatch1 = util.tryCatch1; | ||
var canAttach = errors.canAttach; | ||
var apiRejection = errors.apiRejection; | ||
var APPLY = {}; | ||
var thenable = new Thenable( errorObj ); | ||
function isPromise( obj ) { | ||
@@ -136,7 +127,2 @@ if( typeof obj !== "object" ) return false; | ||
Promise.prototype.progressed = function Promise$progressed( fn ) { | ||
return this._then( void 0, void 0, fn, void 0, void 0, this.progressed ); | ||
}; | ||
function thrower( r ) { | ||
@@ -175,76 +161,2 @@ throw r; | ||
Promise.prototype.inspect = function Promise$inspect() { | ||
return new PromiseInspection( this ); | ||
}; | ||
Promise.prototype.cancel = function Promise$cancel() { | ||
if( !this.isCancellable() ) return this; | ||
var cancelTarget = this; | ||
while( cancelTarget._cancellationParent !== void 0 ) { | ||
cancelTarget = cancelTarget._cancellationParent; | ||
} | ||
if( cancelTarget === this ) { | ||
var err = new CancellationError(); | ||
this._attachExtraTrace( err ); | ||
this._reject( err ); | ||
} | ||
else { | ||
async.invoke( cancelTarget.cancel, cancelTarget, void 0 ); | ||
} | ||
return this; | ||
}; | ||
Promise.prototype.uncancellable = function Promise$uncancellable() { | ||
var ret = new Promise(); | ||
ret._setTrace( this.uncancellable, this ); | ||
ret._unsetCancellable(); | ||
ret._assumeStateOf( this, true ); | ||
ret._boundTo = this._boundTo; | ||
return ret; | ||
}; | ||
Promise.prototype.fork = | ||
function Promise$fork( didFulfill, didReject, didProgress ) { | ||
var ret = this._then( didFulfill, didReject, didProgress, | ||
void 0, void 0, this.fork ); | ||
ret._cancellationParent = void 0; | ||
return ret; | ||
}; | ||
Promise.prototype.call = function Promise$call( propertyName ) { | ||
var len = arguments.length; | ||
var args = new Array(len-1); | ||
for( var i = 1; i < len; ++i ) { | ||
args[ i - 1 ] = arguments[ i ]; | ||
} | ||
return this._then( function( obj ) { | ||
return obj[ propertyName ].apply( obj, args ); | ||
}, | ||
void 0, | ||
void 0, | ||
void 0, | ||
void 0, | ||
this.call | ||
); | ||
}; | ||
function Promise$getter( obj ) { | ||
var prop = typeof this === "string" | ||
? this | ||
: ("" + this); | ||
return obj[ prop ]; | ||
} | ||
Promise.prototype.get = function Promise$get( propertyName ) { | ||
return this._then( | ||
Promise$getter, | ||
void 0, | ||
void 0, | ||
propertyName, | ||
void 0, | ||
this.get | ||
); | ||
}; | ||
Promise.prototype.then = | ||
@@ -289,3 +201,2 @@ function Promise$then( didFulfill, didReject, didProgress ) { | ||
Promise.prototype.toJSON = function Promise$toJSON() { | ||
var inspection = this.inspect(); | ||
var ret = { | ||
@@ -297,8 +208,8 @@ isFulfilled: false, | ||
}; | ||
if( inspection.isFulfilled() ) { | ||
ret.fulfillmentValue = inspection.value(); | ||
if( this.isFulfilled() ) { | ||
ret.fulfillmentValue = this._resolvedValue; | ||
ret.isFulfilled = true; | ||
} | ||
else if( inspection.isRejected() ) { | ||
ret.rejectionReason = inspection.error(); | ||
else if( this.isRejected() ) { | ||
ret.rejectionReason = this._resolvedValue; | ||
ret.isRejected = true; | ||
@@ -309,50 +220,2 @@ } | ||
function Promise$_successAdapter( val, receiver ) { | ||
var nodeback = this; | ||
var ret = tryCatch2( nodeback, receiver, null, val ); | ||
if( ret === errorObj ) { | ||
async.invokeLater( thrower, void 0, ret.e ); | ||
} | ||
} | ||
function Promise$_errorAdapter( reason, receiver ) { | ||
var nodeback = this; | ||
var ret = tryCatch1( nodeback, receiver, reason ); | ||
if( ret === errorObj ) { | ||
async.invokeLater( thrower, void 0, ret.e ); | ||
} | ||
} | ||
Promise.prototype.nodeify = function Promise$nodeify( nodeback ) { | ||
if( typeof nodeback == "function" ) { | ||
this._then( | ||
Promise$_successAdapter, | ||
Promise$_errorAdapter, | ||
void 0, | ||
nodeback, | ||
this._isBound() ? this._boundTo : null, | ||
this.nodeify | ||
); | ||
} | ||
return this; | ||
}; | ||
function apiRejection( msg ) { | ||
var error = new TypeError( msg ); | ||
var ret = Promise.rejected( error ); | ||
var parent = ret._peekContext(); | ||
if( parent != null ) { | ||
parent._attachExtraTrace( error ); | ||
} | ||
return ret; | ||
} | ||
Promise.prototype.map = function Promise$map( fn ) { | ||
return Promise$_Map( this, fn, true, this.map ); | ||
}; | ||
Promise.prototype.filter = function Promise$filter( fn ) { | ||
return Promise$_Filter( this, fn, true, this.filter ); | ||
}; | ||
Promise.prototype.all = function Promise$all() { | ||
@@ -362,36 +225,4 @@ return Promise$_all( this, true, this.all ); | ||
Promise.prototype.any = function Promise$any() { | ||
return Promise$_Any( this, true, this.any ); | ||
}; | ||
Promise.prototype.settle = function Promise$settle() { | ||
return Promise$_Settle( this, true, this.settle ); | ||
}; | ||
Promise.prototype.some = function Promise$some( count ) { | ||
return Promise$_Some( this, count, true, this.some ); | ||
}; | ||
Promise.prototype.reduce = function Promise$reduce( fn, initialValue ) { | ||
return Promise$_Reduce( this, fn, initialValue, true, this.reduce ); | ||
}; | ||
Promise.prototype.props = function Promise$props() { | ||
return Promise$_Props( this, true, this.props ); | ||
}; | ||
Promise.is = isPromise; | ||
function Promise$_Settle( promises, useBound, caller ) { | ||
return Promise$_All( | ||
promises, | ||
SettledPromiseArray, | ||
caller, | ||
useBound === true ? promises._boundTo : void 0 | ||
).promise(); | ||
} | ||
Promise.settle = function Promise$Settle( promises ) { | ||
return Promise$_Settle( promises, false, Promise.settle ); | ||
}; | ||
function Promise$_all( promises, useBound, caller ) { | ||
@@ -409,29 +240,2 @@ return Promise$_All( | ||
function Promise$_Props( promises, useBound, caller ) { | ||
var ret; | ||
if( isPrimitive( promises ) ) { | ||
ret = Promise.fulfilled( promises, caller ); | ||
} | ||
else if( isPromise( promises ) ) { | ||
ret = promises._then( Promise.props, void 0, void 0, | ||
void 0, void 0, caller ); | ||
} | ||
else { | ||
ret = new PropertiesPromiseArray( | ||
promises, | ||
caller, | ||
useBound === true ? promises._boundTo : void 0 | ||
).promise(); | ||
useBound = false; | ||
} | ||
if( useBound === true ) { | ||
ret._boundTo = promises._boundTo; | ||
} | ||
return ret; | ||
} | ||
Promise.props = function Promise$Props( promises ) { | ||
return Promise$_Props( promises, false, Promise.props ); | ||
}; | ||
Promise.join = function Promise$Join() { | ||
@@ -444,282 +248,2 @@ var ret = new Array( arguments.length ); | ||
}; | ||
function Promise$_Any( promises, useBound, caller ) { | ||
return Promise$_All( | ||
promises, | ||
AnyPromiseArray, | ||
caller, | ||
useBound === true ? promises._boundTo : void 0 | ||
).promise(); | ||
} | ||
Promise.any = function Promise$Any( promises ) { | ||
return Promise$_Any( promises, false, Promise.any ); | ||
}; | ||
function Promise$_Some( promises, howMany, useBound, caller ) { | ||
if( ( howMany | 0 ) !== howMany ) { | ||
return apiRejection("howMany must be an integer"); | ||
} | ||
var ret = Promise$_All( | ||
promises, | ||
SomePromiseArray, | ||
caller, | ||
useBound === true ? promises._boundTo : void 0 | ||
); | ||
ret.setHowMany( howMany ); | ||
return ret.promise(); | ||
} | ||
Promise.some = function Promise$Some( promises, howMany ) { | ||
return Promise$_Some( promises, howMany, false, Promise.some ); | ||
}; | ||
function Promise$_mapper( fulfilleds ) { | ||
var fn = this; | ||
var receiver = void 0; | ||
if( typeof fn !== "function" ) { | ||
receiver = fn.receiver; | ||
fn = fn.fn; | ||
} | ||
var shouldDefer = false; | ||
if( receiver === void 0 ) { | ||
for( var i = 0, len = fulfilleds.length; i < len; ++i ) { | ||
if( fulfilleds[i] === void 0 && | ||
!(i in fulfilleds) ) { | ||
continue; | ||
} | ||
var fulfill = fn( fulfilleds[ i ], i, len ); | ||
if( !shouldDefer && isPromise( fulfill ) ) { | ||
if( fulfill.isFulfilled() ) { | ||
fulfilleds[i] = fulfill._resolvedValue; | ||
continue; | ||
} | ||
else { | ||
shouldDefer = true; | ||
} | ||
} | ||
fulfilleds[i] = fulfill; | ||
} | ||
} | ||
else { | ||
for( var i = 0, len = fulfilleds.length; i < len; ++i ) { | ||
if( fulfilleds[i] === void 0 && | ||
!(i in fulfilleds) ) { | ||
continue; | ||
} | ||
var fulfill = fn.call( receiver, fulfilleds[ i ], i, len ); | ||
if( !shouldDefer && isPromise( fulfill ) ) { | ||
if( fulfill.isFulfilled() ) { | ||
fulfilleds[i] = fulfill._resolvedValue; | ||
continue; | ||
} | ||
else { | ||
shouldDefer = true; | ||
} | ||
} | ||
fulfilleds[i] = fulfill; | ||
} | ||
} | ||
return shouldDefer | ||
? Promise$_All( fulfilleds, PromiseArray, | ||
Promise$_mapper, void 0 ).promise() | ||
: fulfilleds; | ||
} | ||
function Promise$_Map( promises, fn, useBound, caller ) { | ||
if( typeof fn !== "function" ) { | ||
return apiRejection( "fn is not a function" ); | ||
} | ||
if( useBound === true ) { | ||
fn = { | ||
fn: fn, | ||
receiver: promises._boundTo | ||
}; | ||
} | ||
return Promise$_All( | ||
promises, | ||
PromiseArray, | ||
caller, | ||
useBound === true ? promises._boundTo : void 0 | ||
).promise() | ||
._then( | ||
Promise$_mapper, | ||
void 0, | ||
void 0, | ||
fn, | ||
void 0, | ||
caller | ||
); | ||
} | ||
Promise.map = function Promise$Map( promises, fn ) { | ||
return Promise$_Map( promises, fn, false, Promise.map ); | ||
}; | ||
function Promise$_reducer( fulfilleds, initialValue ) { | ||
var fn = this; | ||
var receiver = void 0; | ||
if( typeof fn !== "function" ) { | ||
receiver = fn.receiver; | ||
fn = fn.fn; | ||
} | ||
var len = fulfilleds.length; | ||
var accum = void 0; | ||
var startIndex = 0; | ||
if( initialValue !== void 0 ) { | ||
accum = initialValue; | ||
startIndex = 0; | ||
} | ||
else { | ||
startIndex = 1; | ||
if( len > 0 ) { | ||
for( var i = 0; i < len; ++i ) { | ||
if( fulfilleds[i] === void 0 && | ||
!(i in fulfilleds) ) { | ||
continue; | ||
} | ||
accum = fulfilleds[i]; | ||
startIndex = i + 1; | ||
break; | ||
} | ||
} | ||
} | ||
if( receiver === void 0 ) { | ||
for( var i = startIndex; i < len; ++i ) { | ||
if( fulfilleds[i] === void 0 && | ||
!(i in fulfilleds) ) { | ||
continue; | ||
} | ||
accum = fn( accum, fulfilleds[i], i, len ); | ||
} | ||
} | ||
else { | ||
for( var i = startIndex; i < len; ++i ) { | ||
if( fulfilleds[i] === void 0 && | ||
!(i in fulfilleds) ) { | ||
continue; | ||
} | ||
accum = fn.call( receiver, accum, fulfilleds[i], i, len ); | ||
} | ||
} | ||
return accum; | ||
} | ||
function Promise$_unpackReducer( fulfilleds ) { | ||
var fn = this.fn; | ||
var initialValue = this.initialValue; | ||
return Promise$_reducer.call( fn, fulfilleds, initialValue ); | ||
} | ||
function Promise$_slowReduce( promises, fn, initialValue, useBound, caller ) { | ||
return initialValue._then( function callee( initialValue ) { | ||
return Promise$_Reduce( promises, fn, initialValue, useBound, callee ); | ||
}, void 0, void 0, void 0, void 0, caller); | ||
} | ||
function Promise$_Reduce( promises, fn, initialValue, useBound, caller ) { | ||
if( typeof fn !== "function" ) { | ||
return apiRejection( "fn is not a function" ); | ||
} | ||
if( useBound === true ) { | ||
fn = { | ||
fn: fn, | ||
receiver: promises._boundTo | ||
}; | ||
} | ||
if( initialValue !== void 0 ) { | ||
if( isPromise( initialValue ) ) { | ||
if( initialValue.isFulfilled() ) { | ||
initialValue = initialValue._resolvedValue; | ||
} | ||
else { | ||
return Promise$_slowReduce( promises, | ||
fn, initialValue, useBound, caller ); | ||
} | ||
} | ||
return Promise$_All( promises, PromiseArray, caller, | ||
useBound === true ? promises._boundTo : void 0 ) | ||
.promise() | ||
._then( Promise$_unpackReducer, void 0, void 0, { | ||
fn: fn, | ||
initialValue: initialValue | ||
}, void 0, Promise.reduce ); | ||
} | ||
return Promise$_All( promises, PromiseArray, caller, | ||
useBound === true ? promises._boundTo : void 0 ).promise() | ||
._then( Promise$_reducer, void 0, void 0, fn, void 0, caller ); | ||
} | ||
Promise.reduce = function Promise$Reduce( promises, fn, initialValue ) { | ||
return Promise$_Reduce( promises, fn, | ||
initialValue, false, Promise.reduce); | ||
}; | ||
function Promise$_filterer( fulfilleds ) { | ||
var fn = this; | ||
var receiver = void 0; | ||
if( typeof fn !== "function" ) { | ||
receiver = fn.receiver; | ||
fn = fn.fn; | ||
} | ||
var ret = new Array( fulfilleds.length ); | ||
var j = 0; | ||
if( receiver === void 0 ) { | ||
for( var i = 0, len = fulfilleds.length; i < len; ++i ) { | ||
var item = fulfilleds[i]; | ||
if( item === void 0 && | ||
!( i in fulfilleds ) ) { | ||
continue; | ||
} | ||
if( fn( item, i, len ) ) { | ||
ret[j++] = item; | ||
} | ||
} | ||
} | ||
else { | ||
for( var i = 0, len = fulfilleds.length; i < len; ++i ) { | ||
var item = fulfilleds[i]; | ||
if( item === void 0 && | ||
!( i in fulfilleds ) ) { | ||
continue; | ||
} | ||
if( fn.call( receiver, item, i, len ) ) { | ||
ret[j++] = item; | ||
} | ||
} | ||
} | ||
ret.length = j; | ||
return ret; | ||
} | ||
function Promise$_Filter( promises, fn, useBound, caller ) { | ||
if( typeof fn !== "function" ) { | ||
return apiRejection( "fn is not a function" ); | ||
} | ||
if( useBound === true ) { | ||
fn = { | ||
fn: fn, | ||
receiver: promises._boundTo | ||
}; | ||
} | ||
return Promise$_All( promises, PromiseArray, caller, | ||
useBound === true ? promises._boundTo : void 0 ) | ||
.promise() | ||
._then( Promise$_filterer, void 0, void 0, fn, void 0, caller ); | ||
} | ||
Promise.filter = function Promise$Filter( promises, fn ) { | ||
return Promise$_Filter( promises, fn, false, Promise.filter ); | ||
}; | ||
Promise.fulfilled = function Promise$Fulfilled( value, caller ) { | ||
@@ -787,6 +311,4 @@ var ret = new Promise(); | ||
Promise._cast = cast; | ||
Promise.cast = function Promise$Cast( obj, caller ) { | ||
var ret = cast( obj, caller ); | ||
var ret = Promise._cast( obj, caller ); | ||
if( !( ret instanceof Promise ) ) { | ||
@@ -808,27 +330,3 @@ return Promise.fulfilled( ret, caller ); | ||
Promise.coroutine = function Promise$Coroutine( generatorFunction ) { | ||
if( typeof generatorFunction !== "function" ) { | ||
throw new TypeError( "generatorFunction must be a function" ); | ||
} | ||
var PromiseSpawn$ = PromiseSpawn; | ||
return function anonymous() { | ||
var generator = generatorFunction.apply( this, arguments ); | ||
var spawn = new PromiseSpawn$( void 0, void 0, anonymous ); | ||
spawn._generator = generator; | ||
spawn._next( void 0 ); | ||
return spawn.promise(); | ||
}; | ||
}; | ||
Promise.spawn = function Promise$Spawn( generatorFunction ) { | ||
if( typeof generatorFunction !== "function" ) { | ||
return apiRejection( "generatorFunction must be a function" ); | ||
} | ||
var spawn = new PromiseSpawn( generatorFunction, this, Promise.spawn ); | ||
var ret = spawn.promise(); | ||
spawn._run( Promise.spawn ); | ||
return ret; | ||
}; | ||
var longStackTraces = false || !!( | ||
var longStackTraces = false || false || !!( | ||
typeof process !== "undefined" && | ||
@@ -854,68 +352,2 @@ typeof process.execPath === "string" && | ||
function f(){} | ||
function isPromisified( fn ) { | ||
return fn.__isPromisified__ === true; | ||
} | ||
var hasProp = {}.hasOwnProperty; | ||
var roriginal = new RegExp( "__beforePromisified__" + "$" ); | ||
function _promisify( callback, receiver, isAll ) { | ||
if( isAll ) { | ||
var changed = 0; | ||
var o = {}; | ||
for( var key in callback ) { | ||
if( !roriginal.test( key ) && | ||
!hasProp.call( callback, | ||
( key + "__beforePromisified__" ) ) && | ||
typeof callback[ key ] === "function" ) { | ||
var fn = callback[key]; | ||
if( !isPromisified( fn ) ) { | ||
changed++; | ||
var originalKey = key + "__beforePromisified__"; | ||
var promisifiedKey = key + "Async"; | ||
notEnumerableProp( callback, originalKey, fn ); | ||
o[ promisifiedKey ] = | ||
makeNodePromisified( originalKey, THIS, key ); | ||
} | ||
} | ||
} | ||
if( changed > 0 ) { | ||
for( var key in o ) { | ||
if( hasProp.call( o, key ) ) { | ||
callback[key] = o[key]; | ||
} | ||
} | ||
f.prototype = callback; | ||
} | ||
return callback; | ||
} | ||
else { | ||
return makeNodePromisified( callback, receiver, void 0 ); | ||
} | ||
} | ||
Promise.promisify = function Promise$Promisify( callback, receiver ) { | ||
if( typeof callback === "object" && callback !== null ) { | ||
deprecated( "Promise.promisify for promisifying entire objects " + | ||
"is deprecated. Use Promise.promisifyAll instead." ); | ||
return _promisify( callback, receiver, true ); | ||
} | ||
if( typeof callback !== "function" ) { | ||
throw new TypeError( "callback must be a function" ); | ||
} | ||
if( isPromisified( callback ) ) { | ||
return callback; | ||
} | ||
return _promisify( | ||
callback, | ||
arguments.length < 2 ? THIS : receiver, | ||
false ); | ||
}; | ||
Promise.promisifyAll = function Promise$PromisifyAll( target ) { | ||
if( typeof target !== "function" && typeof target !== "object" ) { | ||
throw new TypeError( "Cannot promisify " + typeof target ); | ||
} | ||
return _promisify( target, void 0, true ); | ||
}; | ||
Promise.prototype._then = | ||
@@ -1052,7 +484,2 @@ function Promise$_then( | ||
Promise.prototype._progressAt = function Promise$_progressAt( index ) { | ||
if( index === 0 ) return this._progress0; | ||
return this[ index + 2 - 5 ]; | ||
}; | ||
Promise.prototype._unsetAt = function Promise$_unsetAt( index ) { | ||
@@ -1145,167 +572,2 @@ if( index === 0 ) { | ||
function cast( obj, caller ) { | ||
if( isObject( obj ) ) { | ||
if( obj instanceof Promise ) { | ||
return obj; | ||
} | ||
var ref = { ref: null, promise: null }; | ||
if( thenable.is( obj, ref ) ) { | ||
if( ref.promise != null ) { | ||
return ref.promise; | ||
} | ||
var resolver = Promise.pending( caller ); | ||
var result = ref.ref; | ||
if( result === errorObj ) { | ||
resolver.reject( result.e ); | ||
return resolver.promise; | ||
} | ||
thenable.addCache( obj, resolver.promise ); | ||
var called = false; | ||
var ret = tryCatch2( result, obj, function t( a ) { | ||
if( called ) return; | ||
called = true; | ||
async.invoke( thenable.deleteCache, thenable, obj ); | ||
var b = cast( a ); | ||
if( b === a ) { | ||
resolver.fulfill( a ); | ||
} | ||
else { | ||
if( a === obj ) { | ||
resolver.promise._resolveFulfill( a ); | ||
} | ||
else { | ||
b._then( | ||
resolver.fulfill, | ||
resolver.reject, | ||
void 0, | ||
resolver, | ||
void 0, | ||
t | ||
); | ||
} | ||
} | ||
}, function t( a ) { | ||
if( called ) return; | ||
called = true; | ||
async.invoke( thenable.deleteCache, thenable, obj ); | ||
resolver.reject( a ); | ||
}); | ||
if( ret === errorObj && !called ) { | ||
resolver.reject( ret.e ); | ||
async.invoke( thenable.deleteCache, thenable, obj ); | ||
} | ||
return resolver.promise; | ||
} | ||
} | ||
return obj; | ||
} | ||
Promise.prototype._resolveThenable = | ||
function Promise$_resolveThenable( x, ref ) { | ||
if( ref.promise != null ) { | ||
this._assumeStateOf( ref.promise, true ); | ||
return; | ||
} | ||
if( ref.ref === errorObj ) { | ||
this._attachExtraTrace( ref.ref.e ); | ||
async.invoke( this._reject, this, ref.ref.e ); | ||
} | ||
else { | ||
thenable.addCache( x, this ); | ||
var then = ref.ref; | ||
var localX = x; | ||
var localP = this; | ||
var key = {}; | ||
var called = false; | ||
var t = function t( v ) { | ||
if( called && this !== key ) return; | ||
called = true; | ||
var fn = localP._fulfill; | ||
var b = cast( v ); | ||
if( b !== v || | ||
( b instanceof Promise && b.isPending() ) ) { | ||
if( v === x ) { | ||
async.invoke( fn, localP, v ); | ||
async.invoke( thenable.deleteCache, thenable, localX ); | ||
} | ||
else { | ||
b._then( t, r, void 0, key, void 0, t); | ||
} | ||
return; | ||
} | ||
if( b instanceof Promise ) { | ||
var fn = b.isFulfilled() | ||
? localP._fulfill : localP._reject; | ||
v = v._resolvedValue; | ||
b = cast( v ); | ||
if( b !== v || | ||
( b instanceof Promise && b !== v ) ) { | ||
b._then( t, r, void 0, key, void 0, t); | ||
return; | ||
} | ||
} | ||
async.invoke( fn, localP, v ); | ||
async.invoke( thenable.deleteCache, | ||
thenable, localX ); | ||
}; | ||
var r = function r( v ) { | ||
if( called && this !== key ) return; | ||
var fn = localP._reject; | ||
called = true; | ||
var b = cast( v ); | ||
if( b !== v || | ||
( b instanceof Promise && b.isPending() ) ) { | ||
if( v === x ) { | ||
async.invoke( fn, localP, v ); | ||
async.invoke( thenable.deleteCache, thenable, localX ); | ||
} | ||
else { | ||
b._then( t, r, void 0, key, void 0, t); | ||
} | ||
return; | ||
} | ||
if( b instanceof Promise ) { | ||
var fn = b.isFulfilled() | ||
? localP._fulfill : localP._reject; | ||
v = v._resolvedValue; | ||
b = cast( v ); | ||
if( b !== v || | ||
( b instanceof Promise && b.isPending() ) ) { | ||
b._then( t, r, void 0, key, void 0, t); | ||
return; | ||
} | ||
} | ||
async.invoke( fn, localP, v ); | ||
async.invoke( thenable.deleteCache, | ||
thenable, localX ); | ||
}; | ||
var threw = tryCatch2( then, x, t, r); | ||
if( threw === errorObj && | ||
!called ) { | ||
this._attachExtraTrace( threw.e ); | ||
async.invoke( this._reject, this, threw.e ); | ||
async.invoke( thenable.deleteCache, thenable, x ); | ||
} | ||
} | ||
}; | ||
Promise.prototype._tryThenable = function Promise$_tryThenable( x ) { | ||
var ref; | ||
if( !thenable.is( x, ref = {ref: null, promise: null} ) ) { | ||
return false; | ||
} | ||
this._resolveThenable( x, ref ); | ||
return true; | ||
}; | ||
var ignore = CatchFilter.prototype.doFilter; | ||
@@ -1386,3 +648,3 @@ Promise.prototype._resolvePromise = function Promise$_resolvePromise( | ||
} | ||
else if( thenable.couldBe( x ) ) { | ||
else if( Promise._couldBeThenable( x ) ) { | ||
@@ -1531,8 +793,2 @@ if( promise._length() === 0 ) { | ||
Promise.prototype._progress = function Promise$_progress( progressValue ) { | ||
if( this._isFollowingOrFulfilledOrRejected() ) return; | ||
this._resolveProgress( progressValue ); | ||
}; | ||
Promise.prototype._doResolveAt = function Promise$_doResolveAt( i ) { | ||
@@ -1647,41 +903,2 @@ var fn = this.isFulfilled() | ||
Promise.prototype._resolveProgress = | ||
function Promise$_resolveProgress( progressValue ) { | ||
var len = this._length(); | ||
for( var i = 0; i < len; i += 5 ) { | ||
var fn = this._progressAt( i ); | ||
var promise = this._promiseAt( i ); | ||
if( !isPromise( promise ) ) { | ||
fn.call( this._receiverAt( i ), progressValue, promise ); | ||
continue; | ||
} | ||
var ret = progressValue; | ||
if( fn !== void 0 ) { | ||
this._pushContext(); | ||
ret = tryCatch1( fn, this._receiverAt( i ), progressValue ); | ||
this._popContext(); | ||
if( ret === errorObj ) { | ||
if( ret.e != null && | ||
ret.e.name === "StopProgressPropagation" ) { | ||
ret.e["__promiseHandled__"] = 2; | ||
} | ||
else { | ||
promise._attachExtraTrace( ret.e ); | ||
async.invoke( promise._progress, promise, ret.e ); | ||
} | ||
} | ||
else if( isPromise( ret ) ) { | ||
ret._then( promise._progress, null, null, promise, void 0, | ||
this._progress ); | ||
} | ||
else { | ||
async.invoke( promise._progress, promise, ret ); | ||
} | ||
} | ||
else { | ||
async.invoke( promise._progress, promise, ret ); | ||
} | ||
} | ||
}; | ||
var contextStack = []; | ||
@@ -1744,3 +961,2 @@ Promise.prototype._peekContext = function Promise$_peekContext() { | ||
Promise.CancellationError = CancellationError; | ||
@@ -1750,2 +966,21 @@ Promise.TimeoutError = TimeoutError; | ||
module.exports = Promise; | ||
require('./synchronous_inspection.js')(Promise, Promise$_All); | ||
require('./any.js')(Promise, Promise$_All); | ||
require('./call_get.js')(Promise, Promise$_All); | ||
require('./filter.js')(Promise, Promise$_All); | ||
require('./generators.js')(Promise, Promise$_All); | ||
require('./map.js')(Promise, Promise$_All); | ||
require('./nodeify.js')(Promise, Promise$_All); | ||
require('./promisify.js')(Promise, Promise$_All); | ||
require('./props.js')(Promise, Promise$_All); | ||
require('./reduce.js')(Promise, Promise$_All); | ||
require('./settle.js')(Promise, Promise$_All); | ||
require('./some.js')(Promise, Promise$_All); | ||
require('./progress.js')(Promise, Promise$_All); | ||
require('./cancel.js')(Promise, Promise$_All); | ||
require('./complex_thenables.js')(Promise, Promise$_All); | ||
Promise.prototype = Promise.prototype; | ||
return Promise; | ||
}; |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -25,4 +25,2 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
var ASSERT = require("./assert.js"); | ||
var getPromise = require("./get_promise.js"); | ||
var haveGetters = (function(){ | ||
@@ -204,105 +202,5 @@ try { | ||
var THIS = {}; | ||
function makeNodePromisifiedEval( callback, receiver, originalName ) { | ||
var Promise = getPromise.get(); | ||
function getCall(count) { | ||
var args = new Array(count); | ||
for( var i = 0, len = args.length; i < len; ++i ) { | ||
args[i] = "a" + (i+1); | ||
} | ||
var comma = count > 0 ? "," : ""; | ||
if( typeof callback === "string" && | ||
receiver === THIS ) { | ||
return "this['" + callback + "']("+args.join(",")+ comma +" fn);"+ | ||
"break;"; | ||
} | ||
return ( receiver === void 0 | ||
? "callback("+args.join(",")+ comma +" fn);" | ||
: "callback.call("+( receiver === THIS | ||
? "this" | ||
: "receiver" )+", "+args.join(",") + comma + " fn);" ) + | ||
"break;"; | ||
} | ||
function getArgs() { | ||
return "var args = new Array( len + 1 );" + | ||
"var i = 0;" + | ||
"for( var i = 0; i < len; ++i ) { " + | ||
" args[i] = arguments[i];" + | ||
"}" + | ||
"args[i] = fn;"; | ||
} | ||
var callbackName = ( typeof originalName === "string" ? | ||
originalName + "Async" : | ||
"promisified" ); | ||
return new Function("Promise", "callback", "receiver", | ||
"withAppended", "maybeWrapAsError", "nodebackForResolver", | ||
"var ret = function " + callbackName + | ||
"( a1, a2, a3, a4, a5 ) {\"use strict\";" + | ||
"var len = arguments.length;" + | ||
"var resolver = Promise.pending( " + callbackName + " );" + | ||
"var fn = nodebackForResolver( resolver );"+ | ||
"try{" + | ||
"switch( len ) {" + | ||
"case 1:" + getCall(1) + | ||
"case 2:" + getCall(2) + | ||
"case 3:" + getCall(3) + | ||
"case 0:" + getCall(0) + | ||
"case 4:" + getCall(4) + | ||
"case 5:" + getCall(5) + | ||
"default: " + getArgs() + (typeof callback === "string" | ||
? "this['" + callback + "'].apply(" | ||
: "callback.apply(" | ||
) + | ||
( receiver === THIS ? "this" : "receiver" ) + | ||
", args ); break;" + | ||
"}" + | ||
"}" + | ||
"catch(e){ " + | ||
"" + | ||
"resolver.reject( maybeWrapAsError( e ) );" + | ||
"}" + | ||
"return resolver.promise;" + | ||
"" + | ||
"}; ret.__isPromisified__ = true; return ret;" | ||
)(Promise, callback, receiver, withAppended, | ||
maybeWrapAsError, nodebackForResolver); | ||
} | ||
function makeNodePromisifiedClosure( callback, receiver ) { | ||
var Promise = getPromise.get(); | ||
function promisified() { | ||
var _receiver = receiver; | ||
if( receiver === THIS ) _receiver = this; | ||
if( typeof callback === "string" ) { | ||
callback = _receiver[callback]; | ||
} | ||
var resolver = Promise.pending( promisified ); | ||
var fn = nodebackForResolver( resolver ); | ||
try { | ||
callback.apply( _receiver, withAppended( arguments, fn ) ); | ||
} | ||
catch(e) { | ||
resolver.reject( maybeWrapAsError( e ) ); | ||
} | ||
return resolver.promise; | ||
} | ||
promisified.__isPromisified__ = true; | ||
return promisified; | ||
} | ||
var makeNodePromisified = canEvaluate | ||
? makeNodePromisifiedEval | ||
: makeNodePromisifiedClosure; | ||
module.exports ={ | ||
isArray: isArray, | ||
makeNodePromisified: makeNodePromisified, | ||
haveGetters: haveGetters, | ||
THIS: THIS, | ||
notEnumerableProp: notEnumerableProp, | ||
@@ -309,0 +207,0 @@ isPrimitive: isPrimitive, |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -22,2 +22,3 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
*/ | ||
"use strict"; | ||
module.exports = (function(){ | ||
@@ -24,0 +25,0 @@ var AssertionError = (function() { |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -22,2 +22,4 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
*/ | ||
module.exports = require("./promise.js"); | ||
"use strict"; | ||
var Promise = require("./promise.js")(); | ||
module.exports = Promise; |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -23,2 +23,3 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
"use strict"; | ||
module.exports = function() { | ||
var ASSERT = require("./assert.js"); | ||
@@ -35,4 +36,7 @@ var inherits = require( "./util.js").inherits; | ||
var formatStack = null; | ||
var areNamesMangled = false; | ||
function CapturedTrace( ignoreUntil, isTopLevel ) { | ||
if( !areNamesMangled ) { | ||
} | ||
this.captureStackTrace( ignoreUntil, isTopLevel ); | ||
@@ -62,2 +66,5 @@ | ||
areNamesMangled = CapturedTrace.prototype.captureStackTrace.name !== | ||
"CapturedTrace$captureStackTrace"; | ||
CapturedTrace.combine = function CapturedTrace$Combine( current, prev ) { | ||
@@ -145,3 +152,3 @@ var curLast = current.length - 1; | ||
if( typeof err.stack === "string" && | ||
if( !areNamesMangled && typeof err.stack === "string" && | ||
typeof "".startsWith === "function" && | ||
@@ -199,2 +206,3 @@ ( err.stack.startsWith("stackDetection@")) && | ||
module.exports = CapturedTrace; | ||
return CapturedTrace; | ||
}; |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -23,2 +23,3 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
"use strict"; | ||
var getPromise = require( "./get_promise.js" ); | ||
var global = require("./global.js"); | ||
@@ -29,2 +30,3 @@ var util = require( "./util.js"); | ||
var notEnumerableProp = util.notEnumerableProp; | ||
var Promise = getPromise.get(); | ||
@@ -59,2 +61,12 @@ function isStackAttached( val ) { | ||
function apiRejection( msg ) { | ||
var error = new TypeError( msg ); | ||
var ret = Promise.rejected( error ); | ||
var parent = ret._peekContext(); | ||
if( parent != null ) { | ||
parent._attachExtraTrace( error ); | ||
} | ||
return ret; | ||
} | ||
function attachDefaultState( obj ) { | ||
@@ -115,4 +127,5 @@ try { | ||
isHandled: isHandled, | ||
canAttach: canAttach | ||
canAttach: canAttach, | ||
apiRejection: apiRejection | ||
}; | ||
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -22,2 +22,3 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
*/ | ||
"use strict"; | ||
var P; | ||
@@ -24,0 +25,0 @@ |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -49,2 +49,4 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
} | ||
PromiseArray.PropertiesPromiseArray = function() {}; | ||
PromiseArray.prototype.length = function PromiseArray$length() { | ||
@@ -51,0 +53,0 @@ return this._length; |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -23,2 +23,3 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
"use strict"; | ||
module.exports = function() { | ||
var global = require("./global.js"); | ||
@@ -32,22 +33,11 @@ var ASSERT = require("./assert.js"); | ||
var PromiseArray = require( "./promise_array.js" ); | ||
var SomePromiseArray = require( "./some_promise_array.js" ); | ||
var AnyPromiseArray = require( "./any_promise_array.js" ); | ||
var PropertiesPromiseArray = require( "./properties_promise_array.js" ); | ||
var SettledPromiseArray = require( "./settled_promise_array.js" ); | ||
var CapturedTrace = require( "./captured_trace.js"); | ||
var CapturedTrace = require( "./captured_trace.js")(); | ||
var CatchFilter = require( "./catch_filter.js"); | ||
var PromiseInspection = require( "./promise_inspection.js" ); | ||
var PromiseResolver = require( "./promise_resolver.js" ); | ||
var PromiseSpawn = require( "./promise_spawn.js" ); | ||
var Thenable = require( "./thenable.js" ); | ||
var isArray = util.isArray; | ||
var makeNodePromisified = util.makeNodePromisified; | ||
var THIS = util.THIS; | ||
var notEnumerableProp = util.notEnumerableProp; | ||
var isPrimitive = util.isPrimitive; | ||
var isObject = util.isObject; | ||
var ensurePropertyExpansion = util.ensurePropertyExpansion; | ||
var deprecated = util.deprecated; | ||
var errorObj = util.errorObj; | ||
@@ -67,6 +57,7 @@ var tryCatch1 = util.tryCatch1; | ||
var canAttach = errors.canAttach; | ||
var apiRejection = errors.apiRejection; | ||
var APPLY = {}; | ||
var thenable = new Thenable( errorObj ); | ||
function isPromise( obj ) { | ||
@@ -136,7 +127,2 @@ if( typeof obj !== "object" ) return false; | ||
Promise.prototype.progressed = function Promise$progressed( fn ) { | ||
return this._then( void 0, void 0, fn, void 0, void 0, this.progressed ); | ||
}; | ||
function thrower( r ) { | ||
@@ -175,76 +161,2 @@ throw r; | ||
Promise.prototype.inspect = function Promise$inspect() { | ||
return new PromiseInspection( this ); | ||
}; | ||
Promise.prototype.cancel = function Promise$cancel() { | ||
if( !this.isCancellable() ) return this; | ||
var cancelTarget = this; | ||
while( cancelTarget._cancellationParent !== void 0 ) { | ||
cancelTarget = cancelTarget._cancellationParent; | ||
} | ||
if( cancelTarget === this ) { | ||
var err = new CancellationError(); | ||
this._attachExtraTrace( err ); | ||
this._reject( err ); | ||
} | ||
else { | ||
cancelTarget.cancel((void 0)); | ||
} | ||
return this; | ||
}; | ||
Promise.prototype.uncancellable = function Promise$uncancellable() { | ||
var ret = new Promise(); | ||
ret._setTrace( this.uncancellable, this ); | ||
ret._unsetCancellable(); | ||
ret._assumeStateOf( this, true ); | ||
ret._boundTo = this._boundTo; | ||
return ret; | ||
}; | ||
Promise.prototype.fork = | ||
function Promise$fork( didFulfill, didReject, didProgress ) { | ||
var ret = this._then( didFulfill, didReject, didProgress, | ||
void 0, void 0, this.fork ); | ||
ret._cancellationParent = void 0; | ||
return ret; | ||
}; | ||
Promise.prototype.call = function Promise$call( propertyName ) { | ||
var len = arguments.length; | ||
var args = new Array(len-1); | ||
for( var i = 1; i < len; ++i ) { | ||
args[ i - 1 ] = arguments[ i ]; | ||
} | ||
return this._then( function( obj ) { | ||
return obj[ propertyName ].apply( obj, args ); | ||
}, | ||
void 0, | ||
void 0, | ||
void 0, | ||
void 0, | ||
this.call | ||
); | ||
}; | ||
function Promise$getter( obj ) { | ||
var prop = typeof this === "string" | ||
? this | ||
: ("" + this); | ||
return obj[ prop ]; | ||
} | ||
Promise.prototype.get = function Promise$get( propertyName ) { | ||
return this._then( | ||
Promise$getter, | ||
void 0, | ||
void 0, | ||
propertyName, | ||
void 0, | ||
this.get | ||
); | ||
}; | ||
Promise.prototype.then = | ||
@@ -289,3 +201,2 @@ function Promise$then( didFulfill, didReject, didProgress ) { | ||
Promise.prototype.toJSON = function Promise$toJSON() { | ||
var inspection = this.inspect(); | ||
var ret = { | ||
@@ -297,8 +208,8 @@ isFulfilled: false, | ||
}; | ||
if( inspection.isFulfilled() ) { | ||
ret.fulfillmentValue = inspection.value(); | ||
if( this.isFulfilled() ) { | ||
ret.fulfillmentValue = this._resolvedValue; | ||
ret.isFulfilled = true; | ||
} | ||
else if( inspection.isRejected() ) { | ||
ret.rejectionReason = inspection.error(); | ||
else if( this.isRejected() ) { | ||
ret.rejectionReason = this._resolvedValue; | ||
ret.isRejected = true; | ||
@@ -309,50 +220,2 @@ } | ||
function Promise$_successAdapter( val, receiver ) { | ||
var nodeback = this; | ||
var ret = tryCatch2( nodeback, receiver, null, val ); | ||
if( ret === errorObj ) { | ||
async.invokeLater( thrower, void 0, ret.e ); | ||
} | ||
} | ||
function Promise$_errorAdapter( reason, receiver ) { | ||
var nodeback = this; | ||
var ret = tryCatch1( nodeback, receiver, reason ); | ||
if( ret === errorObj ) { | ||
async.invokeLater( thrower, void 0, ret.e ); | ||
} | ||
} | ||
Promise.prototype.nodeify = function Promise$nodeify( nodeback ) { | ||
if( typeof nodeback == "function" ) { | ||
this._then( | ||
Promise$_successAdapter, | ||
Promise$_errorAdapter, | ||
void 0, | ||
nodeback, | ||
this._isBound() ? this._boundTo : null, | ||
this.nodeify | ||
); | ||
} | ||
return this; | ||
}; | ||
function apiRejection( msg ) { | ||
var error = new TypeError( msg ); | ||
var ret = Promise.rejected( error ); | ||
var parent = ret._peekContext(); | ||
if( parent != null ) { | ||
parent._attachExtraTrace( error ); | ||
} | ||
return ret; | ||
} | ||
Promise.prototype.map = function Promise$map( fn ) { | ||
return Promise$_Map( this, fn, true, this.map ); | ||
}; | ||
Promise.prototype.filter = function Promise$filter( fn ) { | ||
return Promise$_Filter( this, fn, true, this.filter ); | ||
}; | ||
Promise.prototype.all = function Promise$all() { | ||
@@ -362,36 +225,4 @@ return Promise$_all( this, true, this.all ); | ||
Promise.prototype.any = function Promise$any() { | ||
return Promise$_Any( this, true, this.any ); | ||
}; | ||
Promise.prototype.settle = function Promise$settle() { | ||
return Promise$_Settle( this, true, this.settle ); | ||
}; | ||
Promise.prototype.some = function Promise$some( count ) { | ||
return Promise$_Some( this, count, true, this.some ); | ||
}; | ||
Promise.prototype.reduce = function Promise$reduce( fn, initialValue ) { | ||
return Promise$_Reduce( this, fn, initialValue, true, this.reduce ); | ||
}; | ||
Promise.prototype.props = function Promise$props() { | ||
return Promise$_Props( this, true, this.props ); | ||
}; | ||
Promise.is = isPromise; | ||
function Promise$_Settle( promises, useBound, caller ) { | ||
return Promise$_All( | ||
promises, | ||
SettledPromiseArray, | ||
caller, | ||
useBound === true ? promises._boundTo : void 0 | ||
).promise(); | ||
} | ||
Promise.settle = function Promise$Settle( promises ) { | ||
return Promise$_Settle( promises, false, Promise.settle ); | ||
}; | ||
function Promise$_all( promises, useBound, caller ) { | ||
@@ -409,29 +240,2 @@ return Promise$_All( | ||
function Promise$_Props( promises, useBound, caller ) { | ||
var ret; | ||
if( isPrimitive( promises ) ) { | ||
ret = Promise.fulfilled( promises, caller ); | ||
} | ||
else if( isPromise( promises ) ) { | ||
ret = promises._then( Promise.props, void 0, void 0, | ||
void 0, void 0, caller ); | ||
} | ||
else { | ||
ret = new PropertiesPromiseArray( | ||
promises, | ||
caller, | ||
useBound === true ? promises._boundTo : void 0 | ||
).promise(); | ||
useBound = false; | ||
} | ||
if( useBound === true ) { | ||
ret._boundTo = promises._boundTo; | ||
} | ||
return ret; | ||
} | ||
Promise.props = function Promise$Props( promises ) { | ||
return Promise$_Props( promises, false, Promise.props ); | ||
}; | ||
Promise.join = function Promise$Join() { | ||
@@ -444,282 +248,2 @@ var ret = new Array( arguments.length ); | ||
}; | ||
function Promise$_Any( promises, useBound, caller ) { | ||
return Promise$_All( | ||
promises, | ||
AnyPromiseArray, | ||
caller, | ||
useBound === true ? promises._boundTo : void 0 | ||
).promise(); | ||
} | ||
Promise.any = function Promise$Any( promises ) { | ||
return Promise$_Any( promises, false, Promise.any ); | ||
}; | ||
function Promise$_Some( promises, howMany, useBound, caller ) { | ||
if( ( howMany | 0 ) !== howMany ) { | ||
return apiRejection("howMany must be an integer"); | ||
} | ||
var ret = Promise$_All( | ||
promises, | ||
SomePromiseArray, | ||
caller, | ||
useBound === true ? promises._boundTo : void 0 | ||
); | ||
ret.setHowMany( howMany ); | ||
return ret.promise(); | ||
} | ||
Promise.some = function Promise$Some( promises, howMany ) { | ||
return Promise$_Some( promises, howMany, false, Promise.some ); | ||
}; | ||
function Promise$_mapper( fulfilleds ) { | ||
var fn = this; | ||
var receiver = void 0; | ||
if( typeof fn !== "function" ) { | ||
receiver = fn.receiver; | ||
fn = fn.fn; | ||
} | ||
var shouldDefer = false; | ||
if( receiver === void 0 ) { | ||
for( var i = 0, len = fulfilleds.length; i < len; ++i ) { | ||
if( fulfilleds[i] === void 0 && | ||
!(i in fulfilleds) ) { | ||
continue; | ||
} | ||
var fulfill = fn( fulfilleds[ i ], i, len ); | ||
if( !shouldDefer && isPromise( fulfill ) ) { | ||
if( fulfill.isFulfilled() ) { | ||
fulfilleds[i] = fulfill._resolvedValue; | ||
continue; | ||
} | ||
else { | ||
shouldDefer = true; | ||
} | ||
} | ||
fulfilleds[i] = fulfill; | ||
} | ||
} | ||
else { | ||
for( var i = 0, len = fulfilleds.length; i < len; ++i ) { | ||
if( fulfilleds[i] === void 0 && | ||
!(i in fulfilleds) ) { | ||
continue; | ||
} | ||
var fulfill = fn.call( receiver, fulfilleds[ i ], i, len ); | ||
if( !shouldDefer && isPromise( fulfill ) ) { | ||
if( fulfill.isFulfilled() ) { | ||
fulfilleds[i] = fulfill._resolvedValue; | ||
continue; | ||
} | ||
else { | ||
shouldDefer = true; | ||
} | ||
} | ||
fulfilleds[i] = fulfill; | ||
} | ||
} | ||
return shouldDefer | ||
? Promise$_All( fulfilleds, PromiseArray, | ||
Promise$_mapper, void 0 ).promise() | ||
: fulfilleds; | ||
} | ||
function Promise$_Map( promises, fn, useBound, caller ) { | ||
if( typeof fn !== "function" ) { | ||
return apiRejection( "fn is not a function" ); | ||
} | ||
if( useBound === true ) { | ||
fn = { | ||
fn: fn, | ||
receiver: promises._boundTo | ||
}; | ||
} | ||
return Promise$_All( | ||
promises, | ||
PromiseArray, | ||
caller, | ||
useBound === true ? promises._boundTo : void 0 | ||
).promise() | ||
._then( | ||
Promise$_mapper, | ||
void 0, | ||
void 0, | ||
fn, | ||
void 0, | ||
caller | ||
); | ||
} | ||
Promise.map = function Promise$Map( promises, fn ) { | ||
return Promise$_Map( promises, fn, false, Promise.map ); | ||
}; | ||
function Promise$_reducer( fulfilleds, initialValue ) { | ||
var fn = this; | ||
var receiver = void 0; | ||
if( typeof fn !== "function" ) { | ||
receiver = fn.receiver; | ||
fn = fn.fn; | ||
} | ||
var len = fulfilleds.length; | ||
var accum = void 0; | ||
var startIndex = 0; | ||
if( initialValue !== void 0 ) { | ||
accum = initialValue; | ||
startIndex = 0; | ||
} | ||
else { | ||
startIndex = 1; | ||
if( len > 0 ) { | ||
for( var i = 0; i < len; ++i ) { | ||
if( fulfilleds[i] === void 0 && | ||
!(i in fulfilleds) ) { | ||
continue; | ||
} | ||
accum = fulfilleds[i]; | ||
startIndex = i + 1; | ||
break; | ||
} | ||
} | ||
} | ||
if( receiver === void 0 ) { | ||
for( var i = startIndex; i < len; ++i ) { | ||
if( fulfilleds[i] === void 0 && | ||
!(i in fulfilleds) ) { | ||
continue; | ||
} | ||
accum = fn( accum, fulfilleds[i], i, len ); | ||
} | ||
} | ||
else { | ||
for( var i = startIndex; i < len; ++i ) { | ||
if( fulfilleds[i] === void 0 && | ||
!(i in fulfilleds) ) { | ||
continue; | ||
} | ||
accum = fn.call( receiver, accum, fulfilleds[i], i, len ); | ||
} | ||
} | ||
return accum; | ||
} | ||
function Promise$_unpackReducer( fulfilleds ) { | ||
var fn = this.fn; | ||
var initialValue = this.initialValue; | ||
return Promise$_reducer.call( fn, fulfilleds, initialValue ); | ||
} | ||
function Promise$_slowReduce( promises, fn, initialValue, useBound, caller ) { | ||
return initialValue._then( function callee( initialValue ) { | ||
return Promise$_Reduce( promises, fn, initialValue, useBound, callee ); | ||
}, void 0, void 0, void 0, void 0, caller); | ||
} | ||
function Promise$_Reduce( promises, fn, initialValue, useBound, caller ) { | ||
if( typeof fn !== "function" ) { | ||
return apiRejection( "fn is not a function" ); | ||
} | ||
if( useBound === true ) { | ||
fn = { | ||
fn: fn, | ||
receiver: promises._boundTo | ||
}; | ||
} | ||
if( initialValue !== void 0 ) { | ||
if( isPromise( initialValue ) ) { | ||
if( initialValue.isFulfilled() ) { | ||
initialValue = initialValue._resolvedValue; | ||
} | ||
else { | ||
return Promise$_slowReduce( promises, | ||
fn, initialValue, useBound, caller ); | ||
} | ||
} | ||
return Promise$_All( promises, PromiseArray, caller, | ||
useBound === true ? promises._boundTo : void 0 ) | ||
.promise() | ||
._then( Promise$_unpackReducer, void 0, void 0, { | ||
fn: fn, | ||
initialValue: initialValue | ||
}, void 0, Promise.reduce ); | ||
} | ||
return Promise$_All( promises, PromiseArray, caller, | ||
useBound === true ? promises._boundTo : void 0 ).promise() | ||
._then( Promise$_reducer, void 0, void 0, fn, void 0, caller ); | ||
} | ||
Promise.reduce = function Promise$Reduce( promises, fn, initialValue ) { | ||
return Promise$_Reduce( promises, fn, | ||
initialValue, false, Promise.reduce); | ||
}; | ||
function Promise$_filterer( fulfilleds ) { | ||
var fn = this; | ||
var receiver = void 0; | ||
if( typeof fn !== "function" ) { | ||
receiver = fn.receiver; | ||
fn = fn.fn; | ||
} | ||
var ret = new Array( fulfilleds.length ); | ||
var j = 0; | ||
if( receiver === void 0 ) { | ||
for( var i = 0, len = fulfilleds.length; i < len; ++i ) { | ||
var item = fulfilleds[i]; | ||
if( item === void 0 && | ||
!( i in fulfilleds ) ) { | ||
continue; | ||
} | ||
if( fn( item, i, len ) ) { | ||
ret[j++] = item; | ||
} | ||
} | ||
} | ||
else { | ||
for( var i = 0, len = fulfilleds.length; i < len; ++i ) { | ||
var item = fulfilleds[i]; | ||
if( item === void 0 && | ||
!( i in fulfilleds ) ) { | ||
continue; | ||
} | ||
if( fn.call( receiver, item, i, len ) ) { | ||
ret[j++] = item; | ||
} | ||
} | ||
} | ||
ret.length = j; | ||
return ret; | ||
} | ||
function Promise$_Filter( promises, fn, useBound, caller ) { | ||
if( typeof fn !== "function" ) { | ||
return apiRejection( "fn is not a function" ); | ||
} | ||
if( useBound === true ) { | ||
fn = { | ||
fn: fn, | ||
receiver: promises._boundTo | ||
}; | ||
} | ||
return Promise$_All( promises, PromiseArray, caller, | ||
useBound === true ? promises._boundTo : void 0 ) | ||
.promise() | ||
._then( Promise$_filterer, void 0, void 0, fn, void 0, caller ); | ||
} | ||
Promise.filter = function Promise$Filter( promises, fn ) { | ||
return Promise$_Filter( promises, fn, false, Promise.filter ); | ||
}; | ||
Promise.fulfilled = function Promise$Fulfilled( value, caller ) { | ||
@@ -787,6 +311,4 @@ var ret = new Promise(); | ||
Promise._cast = cast; | ||
Promise.cast = function Promise$Cast( obj, caller ) { | ||
var ret = cast( obj, caller ); | ||
var ret = Promise._cast( obj, caller ); | ||
if( !( ret instanceof Promise ) ) { | ||
@@ -808,27 +330,3 @@ return Promise.fulfilled( ret, caller ); | ||
Promise.coroutine = function Promise$Coroutine( generatorFunction ) { | ||
if( typeof generatorFunction !== "function" ) { | ||
throw new TypeError( "generatorFunction must be a function" ); | ||
} | ||
var PromiseSpawn$ = PromiseSpawn; | ||
return function anonymous() { | ||
var generator = generatorFunction.apply( this, arguments ); | ||
var spawn = new PromiseSpawn$( void 0, void 0, anonymous ); | ||
spawn._generator = generator; | ||
spawn._next( void 0 ); | ||
return spawn.promise(); | ||
}; | ||
}; | ||
Promise.spawn = function Promise$Spawn( generatorFunction ) { | ||
if( typeof generatorFunction !== "function" ) { | ||
return apiRejection( "generatorFunction must be a function" ); | ||
} | ||
var spawn = new PromiseSpawn( generatorFunction, this, Promise.spawn ); | ||
var ret = spawn.promise(); | ||
spawn._run( Promise.spawn ); | ||
return ret; | ||
}; | ||
var longStackTraces = false || !!( | ||
var longStackTraces = false || false || !!( | ||
typeof process !== "undefined" && | ||
@@ -854,68 +352,2 @@ typeof process.execPath === "string" && | ||
function f(){} | ||
function isPromisified( fn ) { | ||
return fn.__isPromisified__ === true; | ||
} | ||
var hasProp = {}.hasOwnProperty; | ||
var roriginal = new RegExp( "__beforePromisified__" + "$" ); | ||
function _promisify( callback, receiver, isAll ) { | ||
if( isAll ) { | ||
var changed = 0; | ||
var o = {}; | ||
for( var key in callback ) { | ||
if( !roriginal.test( key ) && | ||
!hasProp.call( callback, | ||
( key + "__beforePromisified__" ) ) && | ||
typeof callback[ key ] === "function" ) { | ||
var fn = callback[key]; | ||
if( !isPromisified( fn ) ) { | ||
changed++; | ||
var originalKey = key + "__beforePromisified__"; | ||
var promisifiedKey = key + "Async"; | ||
notEnumerableProp( callback, originalKey, fn ); | ||
o[ promisifiedKey ] = | ||
makeNodePromisified( originalKey, THIS, key ); | ||
} | ||
} | ||
} | ||
if( changed > 0 ) { | ||
for( var key in o ) { | ||
if( hasProp.call( o, key ) ) { | ||
callback[key] = o[key]; | ||
} | ||
} | ||
f.prototype = callback; | ||
} | ||
return callback; | ||
} | ||
else { | ||
return makeNodePromisified( callback, receiver, void 0 ); | ||
} | ||
} | ||
Promise.promisify = function Promise$Promisify( callback, receiver ) { | ||
if( typeof callback === "object" && callback !== null ) { | ||
deprecated( "Promise.promisify for promisifying entire objects " + | ||
"is deprecated. Use Promise.promisifyAll instead." ); | ||
return _promisify( callback, receiver, true ); | ||
} | ||
if( typeof callback !== "function" ) { | ||
throw new TypeError( "callback must be a function" ); | ||
} | ||
if( isPromisified( callback ) ) { | ||
return callback; | ||
} | ||
return _promisify( | ||
callback, | ||
arguments.length < 2 ? THIS : receiver, | ||
false ); | ||
}; | ||
Promise.promisifyAll = function Promise$PromisifyAll( target ) { | ||
if( typeof target !== "function" && typeof target !== "object" ) { | ||
throw new TypeError( "Cannot promisify " + typeof target ); | ||
} | ||
return _promisify( target, void 0, true ); | ||
}; | ||
Promise.prototype._then = | ||
@@ -1052,7 +484,2 @@ function Promise$_then( | ||
Promise.prototype._progressAt = function Promise$_progressAt( index ) { | ||
if( index === 0 ) return this._progress0; | ||
return this[ index + 2 - 5 ]; | ||
}; | ||
Promise.prototype._unsetAt = function Promise$_unsetAt( index ) { | ||
@@ -1145,165 +572,2 @@ if( index === 0 ) { | ||
function cast( obj, caller ) { | ||
if( isObject( obj ) ) { | ||
if( obj instanceof Promise ) { | ||
return obj; | ||
} | ||
var ref = { ref: null, promise: null }; | ||
if( thenable.is( obj, ref ) ) { | ||
if( ref.promise != null ) { | ||
return ref.promise; | ||
} | ||
var resolver = Promise.pending( caller ); | ||
var result = ref.ref; | ||
if( result === errorObj ) { | ||
resolver.reject( result.e ); | ||
return resolver.promise; | ||
} | ||
thenable.addCache( obj, resolver.promise ); | ||
var called = false; | ||
var ret = tryCatch2( result, obj, function t( a ) { | ||
if( called ) return; | ||
called = true; | ||
thenable.deleteCache(obj); | ||
var b = cast( a ); | ||
if( b === a ) { | ||
resolver.fulfill( a ); | ||
} | ||
else { | ||
if( a === obj ) { | ||
resolver.promise._resolveFulfill( a ); | ||
} | ||
else { | ||
b._then( | ||
resolver.fulfill, | ||
resolver.reject, | ||
void 0, | ||
resolver, | ||
void 0, | ||
t | ||
); | ||
} | ||
} | ||
}, function t( a ) { | ||
if( called ) return; | ||
called = true; | ||
thenable.deleteCache(obj); | ||
resolver.reject( a ); | ||
}); | ||
if( ret === errorObj && !called ) { | ||
resolver.reject( ret.e ); | ||
thenable.deleteCache(obj); | ||
} | ||
return resolver.promise; | ||
} | ||
} | ||
return obj; | ||
} | ||
Promise.prototype._resolveThenable = | ||
function Promise$_resolveThenable( x, ref ) { | ||
if( ref.promise != null ) { | ||
this._assumeStateOf( ref.promise, true ); | ||
return; | ||
} | ||
if( ref.ref === errorObj ) { | ||
this._attachExtraTrace( ref.ref.e ); | ||
this._reject(ref.ref.e); | ||
} | ||
else { | ||
thenable.addCache( x, this ); | ||
var then = ref.ref; | ||
var localX = x; | ||
var localP = this; | ||
var key = {}; | ||
var called = false; | ||
var t = function t( v ) { | ||
if( called && this !== key ) return; | ||
called = true; | ||
var fn = localP._fulfill; | ||
var b = cast( v ); | ||
if( b !== v || | ||
( b instanceof Promise && b.isPending() ) ) { | ||
if( v === x ) { | ||
fn.call(localP, v); | ||
thenable.deleteCache(localX); | ||
} | ||
else { | ||
b._then( t, r, void 0, key, void 0, t); | ||
} | ||
return; | ||
} | ||
if( b instanceof Promise ) { | ||
var fn = b.isFulfilled() | ||
? localP._fulfill : localP._reject; | ||
v = v._resolvedValue; | ||
b = cast( v ); | ||
if( b !== v || | ||
( b instanceof Promise && b !== v ) ) { | ||
b._then( t, r, void 0, key, void 0, t); | ||
return; | ||
} | ||
} | ||
fn.call(localP, v); | ||
thenable.deleteCache(localX); | ||
}; | ||
var r = function r( v ) { | ||
if( called && this !== key ) return; | ||
var fn = localP._reject; | ||
called = true; | ||
var b = cast( v ); | ||
if( b !== v || | ||
( b instanceof Promise && b.isPending() ) ) { | ||
if( v === x ) { | ||
fn.call(localP, v); | ||
thenable.deleteCache(localX); | ||
} | ||
else { | ||
b._then( t, r, void 0, key, void 0, t); | ||
} | ||
return; | ||
} | ||
if( b instanceof Promise ) { | ||
var fn = b.isFulfilled() | ||
? localP._fulfill : localP._reject; | ||
v = v._resolvedValue; | ||
b = cast( v ); | ||
if( b !== v || | ||
( b instanceof Promise && b.isPending() ) ) { | ||
b._then( t, r, void 0, key, void 0, t); | ||
return; | ||
} | ||
} | ||
fn.call(localP, v); | ||
thenable.deleteCache(localX); | ||
}; | ||
var threw = tryCatch2( then, x, t, r); | ||
if( threw === errorObj && | ||
!called ) { | ||
this._attachExtraTrace( threw.e ); | ||
this._reject(threw.e); | ||
thenable.deleteCache(x); | ||
} | ||
} | ||
}; | ||
Promise.prototype._tryThenable = function Promise$_tryThenable( x ) { | ||
var ref; | ||
if( !thenable.is( x, ref = {ref: null, promise: null} ) ) { | ||
return false; | ||
} | ||
this._resolveThenable( x, ref ); | ||
return true; | ||
}; | ||
var ignore = CatchFilter.prototype.doFilter; | ||
@@ -1380,3 +644,3 @@ Promise.prototype._resolvePromise = function Promise$_resolvePromise( | ||
} | ||
else if( thenable.couldBe( x ) ) { | ||
else if( Promise._couldBeThenable( x ) ) { | ||
@@ -1525,8 +789,2 @@ if( promise._length() === 0 ) { | ||
Promise.prototype._progress = function Promise$_progress( progressValue ) { | ||
if( this._isFollowingOrFulfilledOrRejected() ) return; | ||
this._resolveProgress( progressValue ); | ||
}; | ||
Promise.prototype._doResolveAt = function Promise$_doResolveAt( i ) { | ||
@@ -1641,41 +899,2 @@ var fn = this.isFulfilled() | ||
Promise.prototype._resolveProgress = | ||
function Promise$_resolveProgress( progressValue ) { | ||
var len = this._length(); | ||
for( var i = 0; i < len; i += 5 ) { | ||
var fn = this._progressAt( i ); | ||
var promise = this._promiseAt( i ); | ||
if( !isPromise( promise ) ) { | ||
fn.call( this._receiverAt( i ), progressValue, promise ); | ||
continue; | ||
} | ||
var ret = progressValue; | ||
if( fn !== void 0 ) { | ||
this._pushContext(); | ||
ret = tryCatch1( fn, this._receiverAt( i ), progressValue ); | ||
this._popContext(); | ||
if( ret === errorObj ) { | ||
if( ret.e != null && | ||
ret.e.name === "StopProgressPropagation" ) { | ||
ret.e["__promiseHandled__"] = 2; | ||
} | ||
else { | ||
promise._attachExtraTrace( ret.e ); | ||
promise._progress(ret.e); | ||
} | ||
} | ||
else if( isPromise( ret ) ) { | ||
ret._then( promise._progress, null, null, promise, void 0, | ||
this._progress ); | ||
} | ||
else { | ||
promise._progress(ret); | ||
} | ||
} | ||
else { | ||
promise._progress(ret); | ||
} | ||
} | ||
}; | ||
var contextStack = []; | ||
@@ -1738,3 +957,2 @@ Promise.prototype._peekContext = function Promise$_peekContext() { | ||
Promise.CancellationError = CancellationError; | ||
@@ -1744,2 +962,21 @@ Promise.TimeoutError = TimeoutError; | ||
module.exports = Promise; | ||
require('./synchronous_inspection.js')(Promise, Promise$_All); | ||
require('./any.js')(Promise, Promise$_All); | ||
require('./call_get.js')(Promise, Promise$_All); | ||
require('./filter.js')(Promise, Promise$_All); | ||
require('./generators.js')(Promise, Promise$_All); | ||
require('./map.js')(Promise, Promise$_All); | ||
require('./nodeify.js')(Promise, Promise$_All); | ||
require('./promisify.js')(Promise, Promise$_All); | ||
require('./props.js')(Promise, Promise$_All); | ||
require('./reduce.js')(Promise, Promise$_All); | ||
require('./settle.js')(Promise, Promise$_All); | ||
require('./some.js')(Promise, Promise$_All); | ||
require('./progress.js')(Promise, Promise$_All); | ||
require('./cancel.js')(Promise, Promise$_All); | ||
require('./complex_thenables.js')(Promise, Promise$_All); | ||
Promise.prototype = Promise.prototype; | ||
return Promise; | ||
}; |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -4,0 +4,0 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy |
/** | ||
* @preserve Copyright (c) 2013 Petka Antonov | ||
* Copyright (c) 2013 Petka Antonov | ||
* | ||
@@ -25,4 +25,2 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
var ASSERT = require("./assert.js"); | ||
var getPromise = require("./get_promise.js"); | ||
var haveGetters = (function(){ | ||
@@ -204,105 +202,5 @@ try { | ||
var THIS = {}; | ||
function makeNodePromisifiedEval( callback, receiver, originalName ) { | ||
var Promise = getPromise.get(); | ||
function getCall(count) { | ||
var args = new Array(count); | ||
for( var i = 0, len = args.length; i < len; ++i ) { | ||
args[i] = "a" + (i+1); | ||
} | ||
var comma = count > 0 ? "," : ""; | ||
if( typeof callback === "string" && | ||
receiver === THIS ) { | ||
return "this['" + callback + "']("+args.join(",")+ comma +" fn);"+ | ||
"break;"; | ||
} | ||
return ( receiver === void 0 | ||
? "callback("+args.join(",")+ comma +" fn);" | ||
: "callback.call("+( receiver === THIS | ||
? "this" | ||
: "receiver" )+", "+args.join(",") + comma + " fn);" ) + | ||
"break;"; | ||
} | ||
function getArgs() { | ||
return "var args = new Array( len + 1 );" + | ||
"var i = 0;" + | ||
"for( var i = 0; i < len; ++i ) { " + | ||
" args[i] = arguments[i];" + | ||
"}" + | ||
"args[i] = fn;"; | ||
} | ||
var callbackName = ( typeof originalName === "string" ? | ||
originalName + "Async" : | ||
"promisified" ); | ||
return new Function("Promise", "callback", "receiver", | ||
"withAppended", "maybeWrapAsError", "nodebackForResolver", | ||
"var ret = function " + callbackName + | ||
"( a1, a2, a3, a4, a5 ) {\"use strict\";" + | ||
"var len = arguments.length;" + | ||
"var resolver = Promise.pending( " + callbackName + " );" + | ||
"var fn = nodebackForResolver( resolver );"+ | ||
"try{" + | ||
"switch( len ) {" + | ||
"case 1:" + getCall(1) + | ||
"case 2:" + getCall(2) + | ||
"case 3:" + getCall(3) + | ||
"case 0:" + getCall(0) + | ||
"case 4:" + getCall(4) + | ||
"case 5:" + getCall(5) + | ||
"default: " + getArgs() + (typeof callback === "string" | ||
? "this['" + callback + "'].apply(" | ||
: "callback.apply(" | ||
) + | ||
( receiver === THIS ? "this" : "receiver" ) + | ||
", args ); break;" + | ||
"}" + | ||
"}" + | ||
"catch(e){ " + | ||
"" + | ||
"resolver.reject( maybeWrapAsError( e ) );" + | ||
"}" + | ||
"return resolver.promise;" + | ||
"" + | ||
"}; ret.__isPromisified__ = true; return ret;" | ||
)(Promise, callback, receiver, withAppended, | ||
maybeWrapAsError, nodebackForResolver); | ||
} | ||
function makeNodePromisifiedClosure( callback, receiver ) { | ||
var Promise = getPromise.get(); | ||
function promisified() { | ||
var _receiver = receiver; | ||
if( receiver === THIS ) _receiver = this; | ||
if( typeof callback === "string" ) { | ||
callback = _receiver[callback]; | ||
} | ||
var resolver = Promise.pending( promisified ); | ||
var fn = nodebackForResolver( resolver ); | ||
try { | ||
callback.apply( _receiver, withAppended( arguments, fn ) ); | ||
} | ||
catch(e) { | ||
resolver.reject( maybeWrapAsError( e ) ); | ||
} | ||
return resolver.promise; | ||
} | ||
promisified.__isPromisified__ = true; | ||
return promisified; | ||
} | ||
var makeNodePromisified = canEvaluate | ||
? makeNodePromisifiedEval | ||
: makeNodePromisifiedClosure; | ||
module.exports ={ | ||
isArray: isArray, | ||
makeNodePromisified: makeNodePromisified, | ||
haveGetters: haveGetters, | ||
THIS: THIS, | ||
notEnumerableProp: notEnumerableProp, | ||
@@ -309,0 +207,0 @@ isPrimitive: isPrimitive, |
{ | ||
"name": "bluebird", | ||
"description": "Full featured Promises/A+ implementation with exceptionally good performance", | ||
"version": "0.9.2-1", | ||
"version": "0.9.3-0", | ||
"keywords": [ | ||
@@ -53,3 +53,3 @@ "promise", | ||
"readmeFilename": "README.md", | ||
"main": "./js/main/promise.js" | ||
"main": "./js/main/bluebird.js" | ||
} |
@@ -1,1 +0,1 @@ | ||
module.exports = require('./js/zalgo/promise.js'); | ||
module.exports = require('./js/zalgo/bluebird.js'); |
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
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
397246
82
8685
17