Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
Refactor has.luau to use get function
Browse files Browse the repository at this point in the history
  • Loading branch information
cxmeel committed Mar 15, 2024
1 parent 7934763 commit c6a0ce9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Dictionary/has.luau
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local get = require("./get")

--[=[
@within Dictionary
Expand All @@ -7,8 +9,8 @@
has({ a = 1, b = 2 }, "a") -- true
```
]=]
local function has<K, V>(dictionary: { [K]: V }, key: K): boolean
return dictionary[key] ~= nil
local function has<K, V>(dictionary: { [K]: V }, key: K, separated: string?): boolean
return get(dictionary, key, separated) ~= nil
end

return has

0 comments on commit c6a0ce9

Please sign in to comment.