Formatting and comment wrapping

This commit is contained in:
Lucien Greathouse 2018-09-14 13:47:10 -07:00
parent d8c3bb9264
commit 639f0e8419
2 changed files with 10 additions and 8 deletions

View file

@ -19,7 +19,7 @@ end
wpcallPacked is a version of xpcall that:
* Returns the length of the result first
* Returns the result packed into a table
* Passes extra arguments through to the passed function, which xpcall does not
* Passes extra arguments through to the passed function; xpcall doesn't
* Issues a warning if PROMISE_DEBUG is enabled
]]
local function wpcallPacked(f, ...)
@ -188,8 +188,8 @@ function Promise.all(promises)
return Promise.resolve({})
end
-- We need to check that each value is a promise here so that we can produce a
-- proper error rather than a rejected promise with our error.
-- We need to check that each value is a promise here so that we can produce
-- a proper error rather than a rejected promise with our error.
for i = 1, #promises do
if not Promise.is(promises[i]) then
error(("Non-promise value passed into Promise.all at index #%d"):format(i), 2)
@ -199,8 +199,9 @@ function Promise.all(promises)
return Promise.new(function(resolve, reject)
-- An array to contain our resolved values from the given promises.
local resolvedValues = {}
-- Keep a count of resolved promises because just checking the resolved values length
-- wouldn't account for promises that resolve with nil.
-- Keep a count of resolved promises because just checking the resolved
-- values length wouldn't account for promises that resolve with nil.
local resolvedCount = 0
local rejected = false
@ -219,7 +220,8 @@ function Promise.all(promises)
end
end
-- We can assume the values inside `promises` are all promises since we checked above.
-- We can assume the values inside `promises` are all promises since we
-- checked above.
for i = 1, #promises do
promises[i]:andThen(
function(...)
@ -424,4 +426,4 @@ function Promise.prototype:_reject(...)
end
end
return Promise
return Promise

View file

@ -389,4 +389,4 @@ return function()
expect(second).to.equal("qux")
end)
end)
end
end