repo
stringclasses
350 values
file_path
stringlengths
29
200
language
stringclasses
2 values
file_type
stringclasses
4 values
code
stringlengths
2
1.01M
tokens
int64
2
598k
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Contexts/Utf8.luau
luau
.luau
--!optimize 2 --!strict local LunePolyfill = require("@packages/LunePolyfill") local Utf8 = setmetatable({ graphemes = LunePolyfill.Utf8.Graphemes; }, {__index = utf8}) return Utf8
56
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Contexts/Vector3.luau
luau
.luau
--!optimize 2 --!strict local Enum = require("@packages/Enum") export type PolyfillVector3 = typeof(setmetatable( {} :: { X: number, Y: number, Z: number, Magnitude: number, Unit: PolyfillVector3, Dot: (self: PolyfillVector3, other: PolyfillVector3) -> number, Cross: (self: PolyfillVector3, other: Po...
2,369
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Functions/GetArguments.luau
luau
.luau
--!optimize 2 --!strict local process = require("@lune/process") local function GetArguments(): {string} local arguments = process.args local fixedArguments = table.create(#arguments - 1) local length = 0 for index, value in arguments do if index == 0 then continue end length += 1 fixedArguments[len...
100
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Functions/GetAuthenticationCookie.luau
luau
.luau
--!optimize 2 --!strict local DotEnv = require("@packages/DotEnv") local ExecuteUtilities = require("@utilities/ExecuteUtilities") local process = require("@lune/process") local roblox = require("@lune/roblox") DotEnv.Load() local function GetAuthenticationCookie(raw: boolean?): string? if raw then local fromApi =...
248
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Functions/GreenTeaAssert.luau
luau
.luau
--!optimize 2 --!strict local Error = require("@packages/Error") local GreenTea = require("@packages/GreenTea") export type Type = GreenTea.Type export type ErrorLike = { name: string, message: string, stack: string?, [any]: any, } export type ErrorClassLike = typeof(setmetatable( {} :: { new: (message: string...
227
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Functions/RefreshVsCodeTasks.luau
luau
.luau
--!optimize 2 --!strict local Error = require("@packages/Error") local ExecuteUtilities = require("@utilities/ExecuteUtilities") local GreenTea = require("@packages/GreenTea") local GreenTeaAssert = require("@functions/GreenTeaAssert") local GreenTeaUtilities = require("@packages/GreenTeaUtilities") local LuauPolyfill...
1,820
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/Debug.luau
luau
.luau
--!optimize 2 --!strict local TypeOf = require("@packages/TypeOf") local Debug = {} local TAB = "\t" type GenericDictionary = {[string]: any} type GenericTable = {[any]: any} local Inspect: (...unknown) -> string local REPLACERS = { ["Index ?"] = "__index"; ["Newindex ?"] = "__newindex"; } local function GetErr...
2,331
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/DotEnv.luau
luau
.luau
--!optimize 2 --!strict local LuauPolyfill = require("@packages/LuauPolyfill") local PathFileSystem = require("@packages/PathFileSystem") local RegEx = require("@lune/regex") local process = require("@lune/process") local Array = LuauPolyfill.Array local Boolean = LuauPolyfill.Boolean.toJSBoolean local String = LuauP...
673
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/ES7Types.luau
luau
.luau
--!optimize 2 --!strict export type Object = {[string]: any} export type Array<T> = {[number]: T} export type Function = (...any) -> ...any export type Table<T, V> = {[T]: V} export type Tuple<T, V> = Array<T | V> export type mapCallbackFn<K, V> = (element: V, key: K, map: Map<K, V>) -> () export type mapCallbackFnWit...
833
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/Enum/CreateInRoblox.luau
luau
.luau
--!native --!optimize 2 --!strict local ScriptEditorService = game:GetService("ScriptEditorService") local Workspace = game:GetService("Workspace") local function CreateItemType(enumName: string, enumNames: {string}): string local stringBuilder = table.create(#enumNames) for index, enumValue in enumNames do strin...
1,458
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/Enum/Enum.luau
luau
.luau
--!nonstrict --!optimize 2 local Debug = require("@packages/Debug") local GreenTea = require("@packages/GreenTea") local SortedArray = require("@packages/SortedArray") local ErrorIndex = {} function ErrorIndex:__index(index) Debug.Error(`{index} is not a valid EnumItem`) end local ErrorIndex2 = {} function ErrorInd...
1,001
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/Enumeration/Enumeration.luau
luau
.luau
--!nonstrict --!optimize 2 local Debug = require("@packages/Debug") local GreenTea = require("@packages/GreenTea") local SortedArray = require("@packages/SortedArray") local ErrorIndex = {} function ErrorIndex:__index(index) Debug.Error(`{index} is not a valid EnumerationItem`) end local ErrorIndex2 = {} function E...
1,028
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/Enumeration/init.luau
luau
.luau
--!nonstrict --!optimize 2 local Enumeration = require("@self/Enumeration") type SimpleResult<T, E> = { Success: true, Value: T, } | { Success: false, Error: E, } type EnumerationItem<Value, Type, Name = string> = { EnumerationType: Type, Name: Name, Value: Value, } type EnumerationObject<Values, ArrayValues>...
333
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/Error.luau
luau
.luau
--!optimize 2 --!strict type Function = (...any) -> ...any --[=[ A JavaScript-style error object. ```lua local function UsingConstructor() -- You can use `Error.new`. error(Error.new("Something went wrong!")) end local function UsingCall() -- It supports `__call`. error(Error("Something went wrong!")) ...
1,224
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/Fmt/CreateFormatter.luau
luau
.luau
--!optimize 2 --!strict local Types = require("./Types") local WriteFmt = require("./WriteFmt") local INDENTATION = " " local repeatCache: {[string]: {[number]: string}} = {} local function StringRep(value: string, count: number) local cache = repeatCache[value] if not cache then cache = {} repeatCache[value...
745
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/Fmt/Types.luau
luau
.luau
--!optimize 2 --!strict export type Formatter = & ((method: "AsString") -> string) & ((method: "AsTuple") -> ...unknown) & ((method: "AddTable", object: unknown) -> ()) & ((method: "Lock") -> ()) & ((method: "Unlock") -> ()) & ((method: "AddToBuffer", value: unknown) -> ()) & ((method: "Indent") -> ()) & ((met...
194
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/Fmt/WriteFmt.luau
luau
.luau
--!optimize 2 --!strict local LuauPolyfill = require("@packages/LuauPolyfill") local Types = require("./Types") local Error = LuauPolyfill.Error type Formatter = Types.Formatter local repeatCache: {[string]: {[number]: string}} = {} local function StringRep(value: string, count: number) local cache = repeatCache[v...
2,442
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/Fmt/__tests__/Fmt.spek.luau
luau
.luau
--!optimize 2 --!strict local Fmt = require("@packages/Fmt") local Spek = require("@packages/Spek") return function(t: Spek.T) local describe = t.describe local expect = t.expect local expectError = t.expectError local it = t.it local measure = t.measure local operation = t.operation describe("Fmt")(function(...
2,255
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/Fmt/init.luau
luau
.luau
--!optimize 2 --!strict local CreateFormatter = require("@self/CreateFormatter") type Static = typeof(setmetatable( {} :: { CreateFormatter: typeof(CreateFormatter), Debugify: <T>(object: T, fmtFunction: (object: T, ...unknown) -> unknown) -> {[any]: any}, Fmt: (templateString: string, ...unknown) -> string, ...
800
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/GreenTea/init.luau
luau
.luau
--!optimize 2 --!strict local GreenTea = require("@self/GreenTea") local tCompat = require("@self/tCompat") export type Cause = GreenTea.Cause export type Type = GreenTea.Type export type TuplePacked<T...> = GreenTea.TuplePacked<T...> local export = {} export.t = tCompat export.isGreenTeaType = GreenTea.isGreenTea...
789
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/GreenTea/tCompat.luau
luau
.luau
--!optimize 2 --!strict local GreenTea = require("./GreenTea") local t = {} type Typechecker = (...any) -> (boolean, any?) type TypecheckerConstr<T... = ()> = (T...) -> Typechecker local function asPlainFn(fn: (...any) -> ...any): Typechecker return function() return fn() end end local function asGreenTeaType...
1,879
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/GreenTeaUtilities.luau
luau
.luau
--!optimize 2 --!strict local DateTime = require("@lune/DateTime") local Debug = require("@packages/Debug") local Error = require("@packages/Error") local GreenTea = require("@packages/GreenTea") local LuauPolyfill = require("@packages/LuauPolyfill") local TypeError = require("@errors/TypeError") local instanceof = L...
4,398
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/InstanceOf.luau
luau
.luau
--!optimize 2 --!strict -- polyfill for https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof local __DEV__ = _G.__DEV__ -- FIXME Luau: typing class as Object gives: Type '{ @metatable {| __call: <a>(a, ...any) -> Error, __tostring: <b, c>({+ message: b, name: c +}) -> string |}, Erro...
360
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/Int64.luau
luau
.luau
--!optimize 2 --!strict -- stylua: ignore local HEX_TO_BINARY = { ["0"] = "0000", ["1"] = "0001", ["2"] = "0010", ["3"] = "0011", ["4"] = "0100", ["5"] = "0101", ["6"] = "0110", ["7"] = "0111", ["8"] = "1000", ["9"] = "1001", ["a"] = "1010", ["b"] = "1011", ["c"] = "1100", ["d"] = "1101", ["e"] = "1110...
7,084
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/None.luau
luau
.luau
local None = table.freeze(setmetatable({}, { __index = function() error("attempt to index on None symbol") end; __tostring = function() return "<None>" end; })) return None
45
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/WeakMap.luau
luau
.luau
local WEAK_KEYS_METATABLE = {__mode = "k"} local function WeakMap<K, V>(default: {[K]: V}?): {[K]: V} local value = default or {} return setmetatable(value :: any, WEAK_KEYS_METATABLE) :: any end return WeakMap
65
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/all.luau
luau
.luau
local function all<T>(array: {T}, predicate: (element: T, index: number) -> boolean): boolean for index, element in array do if not predicate(element, index) then return false end end return true end return all
61
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/alternate.luau
luau
.luau
local reduce = require("./reduce") local function alternate<T, U>(array: {T}, ...: {U}): {any} local alternateWith = {...} if #alternateWith == 0 then return array end local minimumLength = reduce(alternateWith, function(minimum: number, value) return math.min(minimum, #value) end, #array) if minimumLengt...
247
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/any.luau
luau
.luau
local function any<T>(array: {T}, predicate: (element: T, index: number) -> boolean): boolean for index, element in array do if predicate(element, index) then return true end end return false end return any
60
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/average.luau
luau
.luau
local function average(array: {number}): number? local length = #array if length == 0 then return nil end local result = 0 for _, element in array do result += element end return result / length end return average
59
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/averageBy.luau
luau
.luau
local function averageBy<T>(array: {T}, map: (T) -> number): number? local length = #array if length == 0 then return nil end local result = 0 for _, element in array do result += map(element) end return result / length end return averageBy
72
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/concat.luau
luau
.luau
local function concat<T>(array: {T}, ...: {T}?): {T} local result = nil for i = 1, select("#", ...) do local concatWith = select(i, ...) if concatWith ~= nil and #concatWith > 0 then result = result or table.clone(array) for _, element in concatWith do table.insert(result, element) end end end ...
104
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/contains.luau
luau
.luau
local function contains<T>(array: {T}, element: T): boolean for _, value in array do if value == element then return true end end return false end return contains
47
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/copy.luau
luau
.luau
return table.clone
4
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/deduplicate.luau
luau
.luau
local function deduplicate<T>(array: {T}): {T} if #array == 0 then return array end local removeIndexes = {} local seenSet = {} for index, element in array do if seenSet[element] == nil then seenSet[element] = true else table.insert(removeIndexes, index) end end local totalIndexes = #removeInde...
149
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/deduplicateByKey.luau
luau
.luau
local function deduplicateByKey<T, Comparable>(array: {T}, key: (T) -> Comparable): {T} local removeIndexes = {} local seenSet = {} for index, element in array do local elementKey = key(element) if seenSet[elementKey] == nil then seenSet[elementKey] = true else table.insert(removeIndexes, index) end ...
157
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/filter.luau
luau
.luau
local function filter<T>(array: {T}, predicate: (T, number) -> boolean): {T} local new = {} for i, element in array do if predicate(element, i) then table.insert(new, element) end end return new end return filter
64
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/find.luau
luau
.luau
local function find<T>(array: {T}, predicate: (element: T, index: number) -> boolean, start: number?): T? if start == nil or start == 1 then for index, element in array do if predicate(element, index) then return element end end else local length = #array for i = start, length do local element = ...
123
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/findIndex.luau
luau
.luau
local function findIndex<T>(array: {T}, predicate: (element: T, index: number) -> boolean, start: number?): number? if start == nil or start == 1 then for index, element in array do if predicate(element, index) then return index end end else local length = #array for i = start, length do local el...
125
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/findIndexByValue.luau
luau
.luau
local function findIndexByValue<T>(array: {T}, element: T, start: number?): number? return table.find(array, element, start) end return findIndexByValue
40
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/findMap.luau
luau
.luau
local function findMap<T, U>(array: {T}, mapFn: (element: T, index: number) -> U?, start: number?): U? if start == nil or start == 1 then for index, element in array do local result = mapFn(element, index) if result ~= nil then return result end end else local length = #array for i = start, lengt...
144
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/flatMap.luau
luau
.luau
local isArray = require("./isArray") local function flatMap<T, U>(array: {T}, mapFn: (T, number) -> nil | U | {U}): {U} local new = {} for i, element in array do local value = mapFn(element, i) if value ~= nil then if isArray(value) then for _, innerElement in value :: {U} do table.insert(new, innerE...
128
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/flatten.luau
luau
.luau
local isArray = require("./isArray") local function flatten<T>(array: {T | {T}}, depth: number?): {T} local actualDepth = if depth == nil then math.huge else depth if actualDepth == 0 then return array :: {T} end local new = {} for _, element in array do if isArray(element) then local iter: {T} = if actu...
149
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/fromFn.luau
luau
.luau
local function fromFn<T>(generator: (number) -> T?): {T} local array = {} local i = 1 while true do local element = generator(i) if element == nil then break else i += 1 table.insert(array, element) end end return array end return fromFn
78
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/fromTryFn.luau
luau
.luau
local function fromTryFn<T>(generator: (number) -> T?): {T} local array = {} local i = 1 while true do local success, element = pcall(generator, i) if success == false or element == nil then break else i += 1 table.insert(array, element) end end return array end return fromTryFn
89
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/isArray.luau
luau
.luau
local function isArray(value: unknown): boolean if type(value) ~= "table" then return false end local tableValue: {[any]: any} = value :: any if next(tableValue) == nil then -- an empty table is an empty array return true end local length = #tableValue if length == 0 then return false end local ex...
142
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/isEmpty.luau
luau
.luau
local function isEmpty(value: {[any]: any}): boolean return next(value) == nil end return isEmpty
24
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/map.luau
luau
.luau
local function map<T, U>(array: {T}, mapFn: (T, number) -> U?): {U} local new = {} for i, element in array do local value = mapFn(element, i) if value ~= nil then table.insert(new, value) end end return new end return map
75
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/maximum.luau
luau
.luau
local function maximum(array: {number}, initialValue: number?): number if initialValue == nil then if #array == 0 then error("initial value must be provided to Array.maximum when the array is empty") end initialValue = array[1] end local accumulator = initialValue :: number for _, element in array do ac...
94
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/maximumBy.luau
luau
.luau
local function maximumBy<T>(array: {T}, map: (T) -> number, initialValue: number?): number if initialValue == nil then if #array == 0 then error("initial value must be provided to Array.maximumBy when the array is empty") end initialValue = map(array[1]) end local accumulator: number = initialValue :: numb...
111
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/minimum.luau
luau
.luau
local function minimum(array: {number}, initialValue: number?): number if initialValue == nil then if #array == 0 then error("initial value must be provided to Array.minimum when the array is empty") end initialValue = array[1] end local accumulator = initialValue :: number for _, element in array do ac...
94
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/minimumBy.luau
luau
.luau
local function minimumBy<T>(array: {T}, map: (T) -> number, initialValue: number?): number if initialValue == nil then if #array == 0 then error("initial value must be provided to Array.minimumBy when the array is empty") end initialValue = map(array[1]) end local accumulator: number = initialValue :: numb...
111
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/partition.luau
luau
.luau
local function partition<T>(array: {T}, predicate: (T, number) -> boolean): ({T}, {T}) local trueValues = {} local falseValues = {} for i, element in array do if predicate(element, i) then table.insert(trueValues, element) else table.insert(falseValues, element) end end return trueValues, falseValues e...
89
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/pop.luau
luau
.luau
local function pop<T>(array: {T}, count: number?): {T} local actualCount = count or 1 if actualCount == 1 then local new = table.clone(array) table.remove(new) return new elseif actualCount == 0 then return array else local length = #array local remaining = length - actualCount if remaining <= 0 th...
174
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/popFirst.luau
luau
.luau
local function popFirst<T>(array: {T}, count: number?): {T} local actualCount = count or 1 if actualCount == 1 then local new = table.clone(array) table.remove(new, 1) return new elseif actualCount == 0 then return array else local length = #array local remaining = length - actualCount if remaining...
185
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/product.luau
luau
.luau
local function product(array: {number}, initialValue: number?): number local result = if initialValue == nil then 1 else initialValue for _, element in array do result *= element end return result end return product
49
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/productBy.luau
luau
.luau
local function productBy<T>(array: {T}, map: (T) -> number, initialValue: number?): number local result = if initialValue == nil then 1 else initialValue for _, element in array do result *= map(element) end return result end return productBy
62
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/push.luau
luau
.luau
local function push<T>(array: {T}, ...: T?): {T} local newArray = table.clone(array) for i = 1, select("#", ...) do local element = select(i, ...) if element ~= nil then table.insert(newArray, element) end end return newArray end return push
72
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/range.luau
luau
.luau
local function range<T>(array: {T}, from: number, to: number?): {T} local length = #array if length == 0 then return array end local actualTo = if to == nil then length else to local normalizedFrom = if from < 0 then 1 + (from + length) else from local normalizedTo = if actualTo < 0 then 1 + (actualTo + length...
192
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/reduce.luau
luau
.luau
local function reduce<T, A>(array: {T}, reducer: (accumulator: A, value: T, index: number) -> A, accumulator: A?): A if accumulator == nil then for index, value in array do if index == 1 then accumulator = value :: any else accumulator = reducer(accumulator :: A, value, index) end end else for ...
223
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/removeIndexes.luau
luau
.luau
local removeSortedIndexes = require("./removeSortedIndexes") local sort = require("./sort") local function removeIndexes<T>(array: {T}, indexes: {number}): {T} local removeLength = #indexes local arrayLenth = #array if removeLength == 0 or arrayLenth == 0 then return array end local sortedIndexes = sort(index...
96
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/removeSortedIndexes.luau
luau
.luau
local function removeSortedIndexes<T>(array: {T}, indexes: {number}): {T} local removeLength = #indexes local arrayLenth = #array if removeLength == 0 or arrayLenth == 0 then return array end local startFrom = nil for i = removeLength, 1, -1 do local index = indexes[i] if index <= arrayLenth then start...
211
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/removeValues.luau
luau
.luau
local function removeValues<T>(array: {T}, ...: T?): {T} local removeLength = select("#", ...) local arrayLenth = #array if removeLength == 0 or arrayLenth == 0 then return array end local removeIndexes = {} for index, element in array do for i = 1, removeLength do local value: T? = select(i, ...) if...
203
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/reverse.luau
luau
.luau
local function reverse<T>(array: {T}): {T} local length = #array if length < 2 then return array end local newArray = table.clone(array) for i = 1, math.floor(length / 2) do local swapRight = length - i + 1 newArray[i], newArray[swapRight] = newArray[swapRight], newArray[i] end return newArray end re...
95
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/sort.luau
luau
.luau
local function sort<T>(array: {T}, comparator: ((T, T) -> boolean)?): {T} if #array <= 1 then return array end local result = table.clone(array) table.sort(result, comparator) return result end return sort
59
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/sortByKey.luau
luau
.luau
local map = require("./map") type KeyElement<K, V> = {key: K, element: V} local function sortByKey<T, Comparable>(array: {T}, key: (T) -> Comparable): {T} if #array <= 1 then return array end local result: {KeyElement<Comparable, T>} = map(array, function(element) return { key = key(element); element = e...
153
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/stepBy.luau
luau
.luau
local function stepBy<T>(array: {T}, step: number): {T} local length = #array if step == 1 then return array elseif step == -1 then local newArray = table.clone(array) for i = 1, math.floor(length / 2) do local swapRight = length - i + 1 newArray[i], newArray[swapRight] = newArray[swapRight], newArray...
207
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/sum.luau
luau
.luau
local function sum(array: {number}, initialValue: number?): number local result = if initialValue == nil then 0 else initialValue for _, element in array do result += element end return result end return sum
49
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/sumBy.luau
luau
.luau
local function sumBy<T>(array: {T}, map: (T) -> number, initialValue: number?): number local result = if initialValue == nil then 0 else initialValue for _, element in array do result += map(element) end return result end return sumBy
62
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/takeWhile.luau
luau
.luau
local function takeWhile<T>(array: {T}, predicate: (element: T, index: number) -> boolean, start: number?): {T} local arrayLength = #array if arrayLength == 0 then return array end local bound = arrayLength + 1 local actualStart = if start == nil then 1 else start if actualStart == 1 then for index, element...
302
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/array/zip.luau
luau
.luau
local reduce = require("./reduce") local function zip<T>(array: {T}, ...: {T}): {{T}} local alternateWith = {...} local minimumLength = reduce(alternateWith, function(minimum: number, value) return math.min(minimum, #value) end, #array) if minimumLength == 0 then return {} end local result = {} for i = ...
235
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/init.luau
luau
.luau
local setType = require("@self/set/type") export type Set<T> = setType.Set<T> local Disk = { Array = { all = require("@self/array/all"); alternate = require("@self/array/alternate"); any = require("@self/array/any"); average = require("@self/array/average"); averageBy = require("@self/array/averageBy"); ...
701
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/map/count.luau
luau
.luau
local function count<K, V>(map: {[K]: V}): number local length = 0 for _ in map do length += 1 end return length end return count
44
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/map/entries.luau
luau
.luau
local function entries<K, V>(map: {[K]: V}, keyIndex: any?, valueIndex: any?): {{[any]: K | V}} local useKeyIndex = if keyIndex == nil then 1 else keyIndex local useValueIndex = if valueIndex == nil then useKeyIndex + 1 else valueIndex local array = {} for key, value in map do table.insert(array, { [useKeyIn...
191
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/map/invert.luau
luau
.luau
local function invert<K, V>(map: {[K]: V}): {[V]: K} if next(map) == nil then return map :: any end local result = {} for key, value in map do result[value] = key end return result end return invert
64
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/map/keys.luau
luau
.luau
local function keys<K, V>(map: {[K]: V}): {K} local result = {} for key in map do table.insert(result, key) end return result end return keys
44
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/map/mapEntries.luau
luau
.luau
local function mapEntries<K, V, K2, V2>(map: {[K]: V}, mapFn: (key: K, value: V) -> (K2?, V2?)): {[K2]: V2} local result = {} for key, value in map do local newKey, newValue = mapFn(key, value) if newKey ~= nil and newValue ~= nil then result[newKey] = newValue end end return result end return mapEntrie...
108
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/map/mapValues.luau
luau
.luau
local None = require("../None") local function mapValues<K, V, W>(map: {[K]: V}, mapFn: (value: V, key: K) -> W?): {[K]: W} local result = {} for key, value in map do local newValue = mapFn(value, key) if newValue ~= nil and newValue ~= (None :: any) then result[key] = newValue end end return result end...
102
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/map/merge.luau
luau
.luau
local None = require("../None") local function merge<T, U...>(...: U...): any local first = nil local firstIndex = nil local length = select("#", ...) for i = 1, length do local mergeMap = select(i, ...) if mergeMap ~= nil then firstIndex = i first = mergeMap break end end if first == nil then ...
474
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/map/remove.luau
luau
.luau
local isEmpty = require("./isEmpty") local function remove<K, V>(map: {[K]: V}, ...: K?) local removeLength = select("#", ...) if removeLength == 0 or isEmpty(map) then return map else local result = nil for i = 1, removeLength do local key: K = select(i, ...) if key ~= nil and map[key] ~= nil then ...
128
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/map/values.luau
luau
.luau
local function values<K, V>(map: {[K]: V}): {V} local result = {} for _, value in map do table.insert(result, value) end return result end return values
45
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/set/fromArray.luau
luau
.luau
local type = require("./type") type Set<T> = type.Set<T> local function fromArray<T>(array: {T}): Set<T> local set: Set<T> = {} for _, element in array do set[element] = true end return set end return fromArray
63
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauDisk/set/type.luau
luau
.luau
export type Set<T> = {[T]: true} return nil
14
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauPath/Component.luau
luau
.luau
--!optimize 2 local Prefix = require("./Prefix") local sysPath = require("./sys/path") local MAIN_SEPARATOR_STR = sysPath.MAIN_SEPARATOR_STR type Prefix = Prefix.Prefix export type PrefixComponent = { type: "prefix", raw: string, parsed: Prefix, } type NormalComponent = {type: "normal", value: string} type Comp...
658
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauPath/Prefix.luau
luau
.luau
--!nolint LocalShadow --!optimize 2 --# selene:allow(shadowing) export type PrefixEnum = | {type: "Verbatim", value: string} | {type: "VerbatimUNC", hostName: string, shareName: string} | {type: "VerbatimDisk", value: string} | {type: "DeviceNS", value: string} | {type: "UNC", hostName: string, shareName: string}...
1,137
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauPath/Rev.luau
luau
.luau
--!nolint LocalShadow --!optimize 2 --# selene:allow(shadowing) local function FromFunction<T>(generator: (index: number) -> T?): {T} local array = {} local length = 0 while true do local value = generator(length + 1) if value == nil then break end length += 1 array[length] = value end return arra...
595
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauPath/init.luau
luau
.luau
--!optimize 2 local Path = require("@self/Path") type PrefixEnum = | {type: "Verbatim", value: string} | {type: "VerbatimUNC", hostName: string, shareName: string} | {type: "VerbatimDisk", value: string} | {type: "DeviceNS", value: string} | {type: "UNC", hostName: string, shareName: string} | {type: "Disk", va...
1,141
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauPath/iterAfter.luau
luau
.luau
--!optimize 2 local Component = require("./Component") type Component = Component.Component type ComponentIterator = {next: (self: ComponentIterator) -> Component?} type Clone<T> = {clone: (T) -> T} local function iterAfter<T>( iter: T & ComponentIterator & Clone<ComponentIterator>, prefix: T & ComponentIterator ...
217
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauPath/sys/path/PrefixParser.luau
luau
.luau
--!nolint LocalShadow --!optimize 2 --# selene:allow(shadowing) local PrefixParserSlice = require("./PrefixParserSlice") type PrefixParserSlice = PrefixParserSlice.PrefixParserSlice export type PrefixParser = { asSlice: (self: PrefixParser) -> PrefixParserSlice, } type Private = { _path: string, _prefix: string,...
323
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauPath/sys/path/PrefixParserSlice.luau
luau
.luau
--!nolint LocalShadow --!optimize 2 --# selene:allow(shadowing) export type PrefixParserSlice = { stripPrefix: (self: PrefixParserSlice, prefix: string) -> PrefixParserSlice?, prefixBytes: (self: PrefixParserSlice) -> string, finish: (self: PrefixParserSlice) -> string, } type Private = { _path: string, _prefix:...
427
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauPath/sys/path/init.luau
luau
.luau
--!nolint LocalShadow --!optimize 2 local Prefix = require("../../Prefix") local parsePrefixWindows = require("@self/parsePrefix") type Prefix = Prefix.Prefix local MAIN_SEPARATOR_STR = if _G.SYS_PATH_SEPARATOR == "\\" or _G.SYS_PATH_SEPARATOR == "/" then _G.SYS_PATH_SEPARATOR elseif (_G.LUA_ENV == "lune" or strin...
352
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauPolyfill/AssertionError/init.luau
luau
.luau
--!optimize 2 --!strict local AssertionErrorModule = require("@self/AssertionErrorGlobal") export type AssertionError = AssertionErrorModule.AssertionError return AssertionErrorModule.AssertionError
39
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauPolyfill/Boolean/init.luau
luau
.luau
--!optimize 2 --!strict return table.freeze({ toJSBoolean = require("@self/toJSBoolean"); })
26
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauPolyfill/Boolean/toJSBoolean.luau
luau
.luau
--!optimize 2 --!strict local Number = require("../Number") -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean return function(value: any): boolean return not not value and value ~= 0 and value ~= "" and not Number.isNaN(value) end
68
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauPolyfill/Collections/Array/concat.luau
luau
.luau
--!optimize 2 --!strict local isArray = require("./isArray") local types = require("@packages/ES7Types") local __DEV__ = _G.__DEV__ type Array<T> = types.Array<T> local RECEIVED_OBJECT_ERROR = "Array.concat(...) only works with array-like tables but " .. "it received an object-like table.\nYou can avoid this error b...
445
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauPolyfill/Collections/Array/every.luau
luau
.luau
--!optimize 2 --!strict local types = require("@packages/ES7Types") local __DEV__ = _G.__DEV__ type Array<T> = types.Array<T> type Object = types.Object type callbackFn<T> = (element: T, index: number, array: Array<T>) -> boolean type callbackFnWithThisArg<T, U> = (self: U, element: T, index: number, array: Array<T>)...
360
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauPolyfill/Collections/Array/filter.luau
luau
.luau
--!optimize 2 --!strict local types = require("@packages/ES7Types") local __DEV__ = _G.__DEV__ type Array<T> = types.Array<T> type Object = types.Object type callbackFn<T> = (element: T, index: number, array: Array<T>) -> boolean type callbackFnWithThisArg<T, U> = (thisArg: U, element: T, index: number, array: Array<T...
408
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauPolyfill/Collections/Array/find.luau
luau
.luau
--!optimize 2 --!strict local types = require("@packages/ES7Types") type Array<T> = types.Array<T> type PredicateFunction<T> = (value: T, index: number, array: Array<T>) -> boolean return function<T>(array: Array<T>, predicate: PredicateFunction<T>): T? -- for i = 1, #array do -- local element = array[i] -- if p...
152
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauPolyfill/Collections/Array/findIndex.luau
luau
.luau
--!optimize 2 --!strict local types = require("@packages/ES7Types") type Array<T> = types.Array<T> type PredicateFunction<T> = (T, number, Array<T>) -> boolean return function<T>(array: Array<T>, predicate: PredicateFunction<T>): number -- for i = 1, #array do -- local element = array[i] -- if predicate(element,...
147
howmanysmall/modern-roblox-ts-template
howmanysmall-modern-roblox-ts-template-8515fd5/.lune/Packages/LuauPolyfill/Collections/Array/flat.luau
luau
.luau
--!optimize 2 --!strict local isArray = require("./isArray") local types = require("@packages/ES7Types") local __DEV__ = _G.__DEV__ type Array<T> = types.Array<T> local function flat<T>(array: Array<T>, depth_: number?): Array<T> if __DEV__ then if type(array) ~= "table" then error(string.format("Array.flat ca...
248