Skip to main content

Dictionary

Handles dictionary-like operations.

Dictionaries are unordered tables with key-value pairs.

Functions

count

Dictionary.count(
dictionary{[Key]Value},
predicate((
Value,
Key
) → boolean)?
) → number

Returns the number of pairs that match the predicate. If the predicate is not given, all pairs will be considered a match.

Dictionary.count({ a = 1, b = 2, c = 3 }).count()
-- 3

Dictionary.count({ a = 1, b = 2, c = 3 }, function(value, key)
	return value % 2 == 0
end)
-- 1

equals

Dictionary.equals(
dictionaryA{[Key]Value},
dictionaryBany
) → boolean

Returns true if both Dictionaries have value equality.

info

If you only require reference equal, use the == operator.

local dictionary1 = { a = 1, b = 2, c = 3 }
local dictionary2 = { a = 1, b = 2, c = 3 }

Dictionary.equals(dictionary1, dictionary2)
-- true

every

Dictionary.every(
list{[Key]Value},
predicate(
Value,
Key
) → boolean
) → boolean

Returns true if predicate returns true for all entries in the Dictionary.

Dictionary.every({ a = 1, b = 2, c = 3 }, function(value, key)
	return value < 10
end)
-- true

filter

Dictionary.filter(
dictionary{[Key]Value},
predicate((
Value,
Key
) → boolean)
) → {[Key]Value}

Returns a Dictionary of only entries for which the predicate function returns true.

Dictionary.filter({ a = 1, b = 2, c = 3, d = 4 }, function(value, key)
	return value % 2 == 0
end)
-- { b = 2, d = 4 }

filterNot

Dictionary.filterNot(
dictionary{[Key]Value},
predicate(
Value,
Key
) → boolean
) → {[Key]Value}

Returns a Dictionary of only entries for which the predicate function returns false.

Dictionary.filterNot({ a = 1, b = 2, c = 3, d = 4 }, function(value, key)
	return value % 2 == 0
end)
-- { a = 1, c = 3 }

find

Dictionary.find(
dictionary{[Key]Value},
predicate(
Value,
Key
) → boolean,
notSetValueValue?
) → Value?

Returns the first value for which the predicate returns true.

Dictionary.find({ a = 1, b = 2, c = 3 }, function(value, key)
	return value % 2 == 0
end)
-- 2

findKey

Dictionary.findKey(
dictionary{[Key]Value},
predicate(
Value,
Key
) → boolean,
notSetValueKey?
) → Key?

Returns the first key for which the predicate returns true.

Dictionary.findKey({ a = 1, b = 2, c = 3 }, function(value, key)
	return value % 2 == 0
end)
-- "b"

findPair

Dictionary.findPair(
list{[Key]Value},
predicate((
Value,
Key
) → boolean)
) → (
Key?,
Value?
)

Returns the first (key, value) pair for which the predicate returns true.

Dictionary.findPair({ a = 1, b = 2 c = 3, d = 4 }, function(value, key)
	return value % 2 == 0
end)
-- ( "b", 2 )

flatten

Dictionary.flatten(
dictionary{[any]any},
depthnumber?
) → {[any]any}

Returns a flattened dictionary by combining keys of the lowest depth.

If provided depth, the flattening will early-out.

Dictionary.flatten({
	foo = 1,
	foobar = {
		bar = 2,
		baz = {
			etc = 3,
		},
	},
})
-- { foo = 1, bar = 2, etc = 3 }

flip

Dictionary.flip(dictionary{[Key]Value}) → {[Value]Key}

Returns a new map where keys and values are flipped.

Dictionary.flip({ a = "x", b = "y", c = "z" )
-- { x = "a", y = "b", z = "c" }

forEach

Dictionary.forEach(
dictionary{[Key]Value},
sideEffect(
Value,
Key
) → boolean
) → number

While the Dictionary is iterated, the sideEffect is executed for every entry. If any call of the sideEffect returns false, the iteration will stop.

Returns the number of entries iterated (including the last iteration which returned false).

Dictionary.forEach({ a = 10, b = 20, c = -10, d = 30 }, function(value, key)
	return value > 0
end)
-- 3

get

Dictionary.get(
dictionary{[Key]Value},
keyKey,
notSetValueValue?
) → Value?

Returns the value at the given key, otherwise returns notSetValue if the given value is not found.

Dictionary.get({ a = 1, b = 2, c = 3 }, "a")
-- 1

Dictionary.get({ a = 1, b = 2, c = 3 }, "foobar", "default")
-- "default"

getIn

Dictionary.getIn(
dictionary{[any]any},
keyPath{any},
notSetValueValue?
) → Value?

Returns the value if found by following a path of keys, otherwise returns notSetValue if the given value is nil.

local dictionary = { a = { b = "c" } }
Dictionary.getIn(dictionary), { "a", "b" })
-- "c"

has

Dictionary.has(
dictionary{[Key]Value},
keyKey
) → boolean

Returns true if the key exists within the Dictionary.

Dictionary.has({ a = 1, b = 2, c = 3 }, "b")
-- true

hasIn

Dictionary.hasIn(
dictionary{[Key]Value},
keyPath{any}
) → boolean

Returns true if the value is found by following a path of keys.

local dictionary = { a = { b = "c" } }
Dictionary.hasIn(dictionary, { "a", "b" })
-- true

includes

Dictionary.includes(
dictionary{[Key]Value},
valueValue
) → boolean

Returns true if the value is found within the Dictionary.

Dictionary.includes({ a = 1, b = 2, c = 3 }, 2)
-- true

joinAsString

Dictionary.joinAsString(
dictionary{[Key]Value},
separatorstring?
) → string

Joins values together as a string, inserting a separator between each.

The default separator is ",".

Dictionary.joinAsString({ a = 1, b = 2, c = 3 }, ", ")
-- "a=1, b=2, c=3"

keys

Dictionary.keys(dictionary{[Key]Value}) → {Key}

Returns a list of keys. Order is undefined.

Dictionary.keys({ a = 1, b = 2, c = 3 })
-- { "a", "b", "c" }

map

Dictionary.map(
dictionary{[Key]Value},
mapper(
Value,
Key
) → (
NewValue,
NewKey
)
) → {[NewKey]NewValue?}

Returns a new Dictionary with keys and values passed through a mapper function.

Returning a second value in the mapper function will reassign the key.

Dictionary.map({ a = 1, b = 2, c = 3 }, function(value, key)
	return value * 10, key
end)
-- { a = 10, b = 20, c = 30 }

max

Dictionary.max(
dictionary{[Key]Value},
comparator((
Value,
Value
) → boolean)?
) → (
Value,
Key?
)

Returns the maximum value and key in this dictionary. If any values are comparatively equivalent, the first one found will be returned. (Order is undefined.)

The comparator is used in the same way as table.sort. If it is not provided, the default comparator is >.

Dictionary.max({ a = 10, b = 200, c = 30 })
-- ( 200, "c" )

Dictionary.max({ alice = child, bertram = teen, charlie = adult }, function(personA, personB)
	return personA.age > personB.age
end)
-- ( adult, "charlie" )

merge

Dictionary.merge(...{[Key]Value}) → {[any]any}

Returns a merged result of all given dictionaries.

If Freeze.None is a value assigned to a key, it will delete that key from the resulting dictionary.

Dictionary.merge({ a = 10, b = 20 }, { c = 30 })
-- { a = 10, b = 20, c = 30 }

Dictionary.merge({ a = 10, b = 20 }, { c = 30, d = 40 }, { b = Freeze.None })
-- { a = 10, c = 30, d = 40 }

mergeIn

Dictionary.mergeIn(
dictionary{[any]any},
keyPath{any},
...any
) → {[any]any}

A combination of updateIn and merge, returning a new dictionary, but performing a merge at the point arrived by following the key path.

local dictionary = {
	persons = {
		alice = {
			age = 10,
		},
	},
}

Dictionary.mergeIn(dictionary, { "persons", "alice" }, { age = 11 })
-- { persons = { alice = { age = 11 } } }

min

Dictionary.min(
dictionary{[Key]Value},
comparator((
Value,
Value
) → boolean)?
) → (
Value,
Key?
)

Returns the minium value and key in this dictionary. If any values are comparatively equivalent, the first one found will be returned. (Order is undefined.)

The comparator is used in the same way as table.sort. If it is not provided, the default comparator is >.

Dictionary.min({ a = 10, b = 200, c = 30 })
-- ( 10, "a" )

Dictionary.min({ alice = child, bertram = teen, charlie = adult }, function(personA, personB)
	return personA.age > personB.age
end)
-- ( child, "alice" )

remove

Dictionary.remove(
dictionary{[Key]Value},
...Key
) → {[Key]Value}

Returns a Dictionary which excludes the given keys.

Dictionary.remove({ a = 10, b = 20, c = 30 }).remove("c")
-- { a = 10, b = 20 }

Dictionary.remove({ a = 10, b = 20, c = 30 }).remove("b", "c")
-- { a = 10 }

removeIn

Dictionary.removeIn(
dictionary{[any]any},
keyPath{any}
) → {[any]any}

Returns a new map having removed the value at this keyPath. Will create a new path if it does not exist.

Dictionary.removeIn({ a = { b = { "c" } } }, { "a", "b" })
-- { a = {} }

removeValue

Dictionary.removeValue(
dictionary{[Key]Value},
valueValue
) → {[Key]Value}

Returns a new map having removed the all pairs with the given value.

Dictionary.removeValue({ a = 10, b = 20, c = 30 }, 10)
-- { b = 20, c = 30 }

set

Dictionary.set(
dictionary{[Key]Value},
keyKey,
valueValue
) → {[Key]Value}

Returns a Dictionary which includes value at key. If key already exists, it will be replaced.

Dictionary.set({ a = 10, b = 20, c = 30 }, "a", 100)
-- { a = 100, b = 20, c = 30 }

setIn

Dictionary.setIn(
dictionary{[any]any},
keyPath{any},
valueany
) → {[any]any}

Returns a dictionary having set value at this keyPath. If any keys in keyPath do not exist, a new dictionary will be created at that key.

local dictionary = {
	persons = {
		alice = {
			age = 10,
		}
	},
}

Dictionary.setIn(dictionary, { "persons", "alice", "age" }, 11)
-- { persons = { alice = { age = 11 } } }

some

Dictionary.some(
dictionary{[Key]Value},
predicate(
Value,
Key
) → boolean
) → boolean

Returns true if predicate returns true for any entry in the dictionary.

Dictionary.some({ a = 1, b = 2, c = 3 }), function(value, key)
	return value % 2 == 0
end)
-- true

update

Dictionary.update(
dictionary{[Key]Value},
keyKey,
updater(Value?) → Value,
notSetValueValue?
) → {[Key]Value}

Returns a dictionary with the entry at key updated to the result of updater.

If the entry does not exist, updater will be given notSetValue or nil.

Dictionary.update({ a = 10, b = 20, c = 30 }, "a", function(value)
	return value * 100
end)
-- { a = 1000, b = 20, c = 30 }

Dictionary.update({ a = 10, b = 20, c = 30 }, "d", function(value)
	return value * 100
end, 1)
-- { a = 10, b = 20, c = 30, d = 100 }

updateIn

Dictionary.updateIn(
dictionary{[any]any},
keyPath{any},
updater(any) → any,
notSetValueany?
) → {[any]any}

Returns a Dictionary with the entry at keyPath updated to the result of updater.

If any entry does not exist along keyPath, an empty Dictionary will be created in its place.

If the final entry does not exist, updater will be given notSetValue or nil.

local dictionary = {
	persons = {
		alice = {
			age = 10,
		},
	},
}

Dictionary.updateIn({ "persons", "alice", "age" }, function(value: number)
	assert(value, "will exist")
	return value + 1
end)
-- { persons = { alice = { age = 11 } } }

values

Dictionary.values(dictionary{[Key]Value}) → {Value}

Returns a list of values. Order is undefined.

Dictionary.values({ a = 1, b = 2, c = 3 })
-- { 1, 2, 3 }

join

deprecated in v0.0.4
</>
This was deprecated in v0.0.4

Use [Dictionary.merge] instead.

Dictionary.join(...{[Key]Value}) → {[any]any}

removeKey

deprecated in v0.0.4
</>
This was deprecated in v0.0.4

Use [Dictionary.remove] instead.

Dictionary.removeKey(
dictionary{[Key]Value},
keyKey
) → {[Key]Value}

removeKeys

deprecated in v0.0.4
</>
This was deprecated in v0.0.4

Use [Dictionary.remove] instead.

Dictionary.removeKeys(
dictionary{[Key]Value},
...Key
) → {[Key]Value}

removeValues

deprecated in v0.0.4
</>
This was deprecated in v0.0.4

Use [Dictionary.removeValue] instead.

Dictionary.removeValues(
dictionary{[Key]Value},
...Value
) → {[Key]Value}

toArray

deprecated in v0.0.4
</>
This was deprecated in v0.0.4

Use [Dictionary.values] instead.

Dictionary.toArray(dictionary{[Key]Value}) → {Value}
Show raw api
{
    "functions": [
        {
            "name": "join",
            "desc": "",
            "params": [
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [any]: any }\n"
                }
            ],
            "function_type": "static",
            "deprecated": {
                "version": "v0.0.4",
                "desc": "Use [Dictionary.merge] instead."
            },
            "source": {
                "line": 9,
                "path": "source/Dictionary/compat/join.lua"
            }
        },
        {
            "name": "removeKey",
            "desc": "",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "Key"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [Key]: Value }\n"
                }
            ],
            "function_type": "static",
            "deprecated": {
                "version": "v0.0.4",
                "desc": "Use [Dictionary.remove] instead."
            },
            "source": {
                "line": 9,
                "path": "source/Dictionary/compat/removeKey.lua"
            }
        },
        {
            "name": "removeKeys",
            "desc": "",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "Key"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [Key]: Value }\n"
                }
            ],
            "function_type": "static",
            "deprecated": {
                "version": "v0.0.4",
                "desc": "Use [Dictionary.remove] instead."
            },
            "source": {
                "line": 9,
                "path": "source/Dictionary/compat/removeKeys.lua"
            }
        },
        {
            "name": "removeValues",
            "desc": "",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "Value"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [Key]: Value }\n"
                }
            ],
            "function_type": "static",
            "deprecated": {
                "version": "v0.0.4",
                "desc": "Use [Dictionary.removeValue] instead."
            },
            "source": {
                "line": 9,
                "path": "source/Dictionary/compat/removeValues.lua"
            }
        },
        {
            "name": "toArray",
            "desc": "",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ Value }\n"
                }
            ],
            "function_type": "static",
            "deprecated": {
                "version": "v0.0.4",
                "desc": "Use [Dictionary.values] instead."
            },
            "source": {
                "line": 9,
                "path": "source/Dictionary/compat/toArray.lua"
            }
        },
        {
            "name": "count",
            "desc": "Returns the number of pairs that match the `predicate`.\nIf the `predicate` is not given, all pairs will be considered a match.\n\n```lua\nDictionary.count({ a = 1, b = 2, c = 3 }).count()\n-- 3\n\nDictionary.count({ a = 1, b = 2, c = 3 }, function(value, key)\n\treturn value % 2 == 0\nend)\n-- 1\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "predicate",
                    "desc": "",
                    "lua_type": "((Value, Key) -> boolean)?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 20,
                "path": "source/Dictionary/count.lua"
            }
        },
        {
            "name": "equals",
            "desc": "Returns true if both Dictionaries have _value_ equality.\n\n:::info\n\nIf you only require reference equal, use the `==` operator.\n\n:::\n\n```lua\nlocal dictionary1 = { a = 1, b = 2, c = 3 }\nlocal dictionary2 = { a = 1, b = 2, c = 3 }\n\nDictionary.equals(dictionary1, dictionary2)\n-- true\n```",
            "params": [
                {
                    "name": "dictionaryA",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "dictionaryB",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 23,
                "path": "source/Dictionary/equals.lua"
            }
        },
        {
            "name": "every",
            "desc": "Returns true if `predicate` returns true for all entries in the Dictionary.\n\n```lua\nDictionary.every({ a = 1, b = 2, c = 3 }, function(value, key)\n\treturn value < 10\nend)\n-- true\n```",
            "params": [
                {
                    "name": "list",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "predicate",
                    "desc": "",
                    "lua_type": "(Value, Key) -> boolean"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 15,
                "path": "source/Dictionary/every.lua"
            }
        },
        {
            "name": "filter",
            "desc": "Returns a Dictionary of only entries for which the `predicate` function returns true.\n\n```lua\nDictionary.filter({ a = 1, b = 2, c = 3, d = 4 }, function(value, key)\n\treturn value % 2 == 0\nend)\n-- { b = 2, d = 4 }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "predicate",
                    "desc": "",
                    "lua_type": "((Value, Key) -> boolean)"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [Key]: Value }\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 15,
                "path": "source/Dictionary/filter.lua"
            }
        },
        {
            "name": "filterNot",
            "desc": "Returns a Dictionary of only entries for which the `predicate` function returns false.\n\n```lua\nDictionary.filterNot({ a = 1, b = 2, c = 3, d = 4 }, function(value, key)\n\treturn value % 2 == 0\nend)\n-- { a = 1, c = 3 }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "predicate",
                    "desc": "",
                    "lua_type": "(Value, Key) -> boolean"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [Key]: Value }\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 16,
                "path": "source/Dictionary/filterNot.lua"
            }
        },
        {
            "name": "find",
            "desc": "Returns the first value for which the `predicate` returns true.\n\n```lua\nDictionary.find({ a = 1, b = 2, c = 3 }, function(value, key)\n\treturn value % 2 == 0\nend)\n-- 2\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "predicate",
                    "desc": "",
                    "lua_type": "(Value, Key) -> boolean"
                },
                {
                    "name": "notSetValue",
                    "desc": "",
                    "lua_type": "Value?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Value?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 15,
                "path": "source/Dictionary/find.lua"
            }
        },
        {
            "name": "findKey",
            "desc": "Returns the first key for which the `predicate` returns true.\n\n```lua\nDictionary.findKey({ a = 1, b = 2, c = 3 }, function(value, key)\n\treturn value % 2 == 0\nend)\n-- \"b\"\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "predicate",
                    "desc": "",
                    "lua_type": "(Value, Key) -> boolean"
                },
                {
                    "name": "notSetValue",
                    "desc": "",
                    "lua_type": "Key?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Key?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 16,
                "path": "source/Dictionary/findKey.lua"
            }
        },
        {
            "name": "findPair",
            "desc": "Returns the first (key, value) pair for which the `predicate` returns true.\n\n```lua\nDictionary.findPair({ a = 1, b = 2 c = 3, d = 4 }, function(value, key)\n\treturn value % 2 == 0\nend)\n-- ( \"b\", 2 )\n```",
            "params": [
                {
                    "name": "list",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "predicate",
                    "desc": "",
                    "lua_type": "((Value, Key) -> boolean)"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Key?"
                },
                {
                    "desc": "",
                    "lua_type": "Value?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 16,
                "path": "source/Dictionary/findPair.lua"
            }
        },
        {
            "name": "flatten",
            "desc": "Returns a flattened dictionary by combining keys of the lowest depth.\n\nIf provided `depth`, the flattening will early-out.\n\n```lua\nDictionary.flatten({\n\tfoo = 1,\n\tfoobar = {\n\t\tbar = 2,\n\t\tbaz = {\n\t\t\tetc = 3,\n\t\t},\n\t},\n})\n-- { foo = 1, bar = 2, etc = 3 }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [any]: any }"
                },
                {
                    "name": "depth",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [any]: any }\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 44,
                "path": "source/Dictionary/flatten.lua"
            }
        },
        {
            "name": "flip",
            "desc": "Returns a new map where keys and values are flipped.\n\n```lua\nDictionary.flip({ a = \"x\", b = \"y\", c = \"z\" )\n-- { x = \"a\", y = \"b\", z = \"c\" }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [Value]: Key }\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 13,
                "path": "source/Dictionary/flip.lua"
            }
        },
        {
            "name": "forEach",
            "desc": "While the Dictionary is iterated, the `sideEffect` is executed for every entry.\nIf any call of the `sideEffect` returns `false`, the iteration will stop.\n\nReturns the number of entries iterated (including the last iteration which returned false).\n\n```lua\nDictionary.forEach({ a = 10, b = 20, c = -10, d = 30 }, function(value, key)\n\treturn value > 0\nend)\n-- 3\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "sideEffect",
                    "desc": "",
                    "lua_type": "(Value, Key) -> boolean"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 18,
                "path": "source/Dictionary/forEach.lua"
            }
        },
        {
            "name": "get",
            "desc": "Returns the value at the given key, otherwise returns `notSetValue` if the given value is not found.\n```lua\nDictionary.get({ a = 1, b = 2, c = 3 }, \"a\")\n-- 1\n\nDictionary.get({ a = 1, b = 2, c = 3 }, \"foobar\", \"default\")\n-- \"default\"\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "Key"
                },
                {
                    "name": "notSetValue",
                    "desc": "",
                    "lua_type": "Value?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Value?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 14,
                "path": "source/Dictionary/get.lua"
            }
        },
        {
            "name": "getIn",
            "desc": "Returns the value if found by following a path of keys, otherwise returns `notSetValue` if the given value is nil.\n\n```lua\nlocal dictionary = { a = { b = \"c\" } }\nDictionary.getIn(dictionary), { \"a\", \"b\" })\n-- \"c\"\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [any]: any }"
                },
                {
                    "name": "keyPath",
                    "desc": "",
                    "lua_type": "{ any }"
                },
                {
                    "name": "notSetValue",
                    "desc": "",
                    "lua_type": "Value?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Value?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 14,
                "path": "source/Dictionary/getIn.lua"
            }
        },
        {
            "name": "has",
            "desc": "Returns true if the key exists within the Dictionary.\n\n```lua\nDictionary.has({ a = 1, b = 2, c = 3 }, \"b\")\n-- true\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "Key"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 12,
                "path": "source/Dictionary/has.lua"
            }
        },
        {
            "name": "hasIn",
            "desc": "Returns true if the value is found by following a path of keys.\n\n```lua\nlocal dictionary = { a = { b = \"c\" } }\nDictionary.hasIn(dictionary, { \"a\", \"b\" })\n-- true\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "keyPath",
                    "desc": "",
                    "lua_type": "{ any }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 15,
                "path": "source/Dictionary/hasIn.lua"
            }
        },
        {
            "name": "includes",
            "desc": "Returns true if the value is found within the Dictionary.\n\n```lua\nDictionary.includes({ a = 1, b = 2, c = 3 }, 2)\n-- true\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "Value"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 13,
                "path": "source/Dictionary/includes.lua"
            }
        },
        {
            "name": "joinAsString",
            "desc": "Joins values together as a string, inserting a separator between each.\n\nThe default separator is `\",\"`.\n\n```lua\nDictionary.joinAsString({ a = 1, b = 2, c = 3 }, \", \")\n-- \"a=1, b=2, c=3\"\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "separator",
                    "desc": "",
                    "lua_type": "string?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 14,
                "path": "source/Dictionary/joinAsString.lua"
            }
        },
        {
            "name": "keys",
            "desc": "Returns a list of keys. Order is undefined.\n\n```lua\nDictionary.keys({ a = 1, b = 2, c = 3 })\n-- { \"a\", \"b\", \"c\" }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ Key }\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 13,
                "path": "source/Dictionary/keys.lua"
            }
        },
        {
            "name": "map",
            "desc": "Returns a new Dictionary with keys and values passed through a `mapper` function.\n\nReturning a second value in the mapper function will reassign the key.\n\n```lua\nDictionary.map({ a = 1, b = 2, c = 3 }, function(value, key)\n\treturn value * 10, key\nend)\n-- { a = 10, b = 20, c = 30 }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "mapper",
                    "desc": "",
                    "lua_type": "(Value, Key) -> (NewValue, NewKey)"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [NewKey]: NewValue? }\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 18,
                "path": "source/Dictionary/map.lua"
            }
        },
        {
            "name": "max",
            "desc": "Returns the maximum value and key in this dictionary.\nIf any values are comparatively equivalent, the first one found will be returned. (Order is undefined.)\n\nThe `comparator` is used in the same way as `table.sort`. If it is not provided, the default comparator is `>`.\n\n```lua\nDictionary.max({ a = 10, b = 200, c = 30 })\n-- ( 200, \"c\" )\n\nDictionary.max({ alice = child, bertram = teen, charlie = adult }, function(personA, personB)\n\treturn personA.age > personB.age\nend)\n-- ( adult, \"charlie\" )\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "comparator",
                    "desc": "",
                    "lua_type": "((Value, Value) -> boolean)?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Value"
                },
                {
                    "desc": "",
                    "lua_type": "Key?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 22,
                "path": "source/Dictionary/max.lua"
            }
        },
        {
            "name": "merge",
            "desc": "Returns a merged result of all given dictionaries.\n\nIf `Freeze.None` is a value assigned to a key, it will delete that key from the resulting dictionary.\n\n```lua\nDictionary.merge({ a = 10, b = 20 }, { c = 30 })\n-- { a = 10, b = 20, c = 30 }\n\nDictionary.merge({ a = 10, b = 20 }, { c = 30, d = 40 }, { b = Freeze.None })\n-- { a = 10, c = 30, d = 40 }\n```",
            "params": [
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [any]: any }\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 19,
                "path": "source/Dictionary/merge.lua"
            }
        },
        {
            "name": "mergeIn",
            "desc": "A combination of `updateIn` and `merge`, returning a new dictionary,\nbut performing a merge at the point arrived by following the key path.\n\n```lua\nlocal dictionary = {\n\tpersons = {\n\t\talice = {\n\t\t\tage = 10,\n\t\t},\n\t},\n}\n\nDictionary.mergeIn(dictionary, { \"persons\", \"alice\" }, { age = 11 })\n-- { persons = { alice = { age = 11 } } }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [any]: any }"
                },
                {
                    "name": "keyPath",
                    "desc": "",
                    "lua_type": "{ any }"
                },
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [any]: any }\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 24,
                "path": "source/Dictionary/mergeIn.lua"
            }
        },
        {
            "name": "min",
            "desc": "Returns the minium value and key in this dictionary.\nIf any values are comparatively equivalent, the first one found will be returned. (Order is undefined.)\n\nThe `comparator` is used in the same way as `table.sort`. If it is not provided, the default comparator is `>`.\n\n```lua\nDictionary.min({ a = 10, b = 200, c = 30 })\n-- ( 10, \"a\" )\n\nDictionary.min({ alice = child, bertram = teen, charlie = adult }, function(personA, personB)\n\treturn personA.age > personB.age\nend)\n-- ( child, \"alice\" )\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "comparator",
                    "desc": "",
                    "lua_type": "((Value, Value) -> boolean)?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Value"
                },
                {
                    "desc": "",
                    "lua_type": "Key?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 21,
                "path": "source/Dictionary/min.lua"
            }
        },
        {
            "name": "remove",
            "desc": "Returns a Dictionary which excludes the given `keys`.\n\n```lua\nDictionary.remove({ a = 10, b = 20, c = 30 }).remove(\"c\")\n-- { a = 10, b = 20 }\n\nDictionary.remove({ a = 10, b = 20, c = 30 }).remove(\"b\", \"c\")\n-- { a = 10 }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "Key"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [Key]: Value }\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 17,
                "path": "source/Dictionary/remove.lua"
            }
        },
        {
            "name": "removeIn",
            "desc": "Returns a new map having removed the value at this `keyPath`.\nWill create a new path if it does not exist.\n\n```lua\nDictionary.removeIn({ a = { b = { \"c\" } } }, { \"a\", \"b\" })\n-- { a = {} }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [any]: any }"
                },
                {
                    "name": "keyPath",
                    "desc": "",
                    "lua_type": "{ any }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [any]: any }\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 15,
                "path": "source/Dictionary/removeIn.lua"
            }
        },
        {
            "name": "removeValue",
            "desc": "Returns a new map having removed the all pairs with the given `value`.\n\n```lua\nDictionary.removeValue({ a = 10, b = 20, c = 30 }, 10)\n-- { b = 20, c = 30 }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "Value"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [Key]: Value }\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 13,
                "path": "source/Dictionary/removeValue.lua"
            }
        },
        {
            "name": "set",
            "desc": "Returns a Dictionary which includes `value` at `key`.\nIf `key` already exists, it will be replaced.\n\n```lua\nDictionary.set({ a = 10, b = 20, c = 30 }, \"a\", 100)\n-- { a = 100, b = 20, c = 30 }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "Key"
                },
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "Value"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [Key]: Value }\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 15,
                "path": "source/Dictionary/set.lua"
            }
        },
        {
            "name": "setIn",
            "desc": "Returns a dictionary having set `value` at this `keyPath`.\nIf any keys in `keyPath` do not exist, a new dictionary will be created at that key.\n\n```lua\nlocal dictionary = {\n\tpersons = {\n\t\talice = {\n\t\t\tage = 10,\n\t\t}\n\t},\n}\n\nDictionary.setIn(dictionary, { \"persons\", \"alice\", \"age\" }, 11)\n-- { persons = { alice = { age = 11 } } }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [any]: any }"
                },
                {
                    "name": "keyPath",
                    "desc": "",
                    "lua_type": "{ any }"
                },
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [any]: any }\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 23,
                "path": "source/Dictionary/setIn.lua"
            }
        },
        {
            "name": "some",
            "desc": "Returns true if `predicate` returns true for any entry in the dictionary.\n\n```lua\nDictionary.some({ a = 1, b = 2, c = 3 }), function(value, key)\n\treturn value % 2 == 0\nend)\n-- true\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "predicate",
                    "desc": "",
                    "lua_type": "(Value, Key) -> boolean"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 15,
                "path": "source/Dictionary/some.lua"
            }
        },
        {
            "name": "update",
            "desc": "Returns a dictionary with the entry at `key` updated to the result of `updater`.\n\nIf the entry does not exist, `updater` will be given `notSetValue` or nil.\n\n```lua\nDictionary.update({ a = 10, b = 20, c = 30 }, \"a\", function(value)\n\treturn value * 100\nend)\n-- { a = 1000, b = 20, c = 30 }\n\nDictionary.update({ a = 10, b = 20, c = 30 }, \"d\", function(value)\n\treturn value * 100\nend, 1)\n-- { a = 10, b = 20, c = 30, d = 100 }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "Key"
                },
                {
                    "name": "updater",
                    "desc": "",
                    "lua_type": "(Value?) -> Value"
                },
                {
                    "name": "notSetValue",
                    "desc": "",
                    "lua_type": "Value?\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [Key]: Value }\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 23,
                "path": "source/Dictionary/update.lua"
            }
        },
        {
            "name": "updateIn",
            "desc": "Returns a Dictionary with the entry at `keyPath` updated to the result of `updater`.\n\nIf any entry does not exist along `keyPath`, an empty Dictionary will be created in its place.\n\nIf the final entry does not exist, `updater` will be given `notSetValue` or nil.\n\n```lua\nlocal dictionary = {\n\tpersons = {\n\t\talice = {\n\t\t\tage = 10,\n\t\t},\n\t},\n}\n\nDictionary.updateIn({ \"persons\", \"alice\", \"age\" }, function(value: number)\n\tassert(value, \"will exist\")\n\treturn value + 1\nend)\n-- { persons = { alice = { age = 11 } } }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [any]: any }"
                },
                {
                    "name": "keyPath",
                    "desc": "",
                    "lua_type": "{ any }"
                },
                {
                    "name": "updater",
                    "desc": "",
                    "lua_type": "(any) -> any"
                },
                {
                    "name": "notSetValue",
                    "desc": "",
                    "lua_type": "any?\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [any]: any }\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 30,
                "path": "source/Dictionary/updateIn.lua"
            }
        },
        {
            "name": "values",
            "desc": "Returns a list of values. Order is undefined.\n\n```lua\nDictionary.values({ a = 1, b = 2, c = 3 })\n-- { 1, 2, 3 }\n```",
            "params": [
                {
                    "name": "dictionary",
                    "desc": "",
                    "lua_type": "{ [Key]: Value }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ Value }\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 13,
                "path": "source/Dictionary/values.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Dictionary",
    "desc": "Handles dictionary-like operations.\n\n[`Dictionaries`](../api/Dictionary) are unordered tables with key-value pairs.",
    "source": {
        "line": 9,
        "path": "source/Dictionary/init.lua"
    }
}