Skip to content

Commit

Permalink
Change is_promise impl to use with vendored promise
Browse files Browse the repository at this point in the history
  • Loading branch information
notomo committed Jun 6, 2024
1 parent 4df0d8a commit 596f7a5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lua/promise/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ function PackedValue.first(self)
end

--- @class Promise
local Promise = {}
local Promise = {
_is_promise = true,
}
Promise.__index = Promise

local PromiseStatus = { Pending = "pending", Fulfilled = "fulfilled", Rejected = "rejected" }

local is_promise = function(v)
return getmetatable(v) == Promise
local tbl = getmetatable(v)
return tbl ~= nil and tbl._is_promise == true
end

local new_empty_userdata = function()
Expand Down

0 comments on commit 596f7a5

Please sign in to comment.