{"id":"egomoose/explore-by-predicate","name":"explore-by-predicate","scope":"egomoose","platform":"roblox","description":"https://github.com/EgoMoose/explore-by-predicate","version":"0.1.0","latest":"0.1.0","versions":["0.1.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{"evaera/promise":{"version":"^4.0.0","alias":"Promise"}},"integrity":"9db828bc63ac32c6be21cbaadd2622b26632e463b674ba2e31e923584be20ad7","likes":0,"downloads":0,"install":"forest install egomoose/explore-by-predicate","url":"https://forest.dev/p/roblox/egomoose/explore-by-predicate","files":"https://api.forest.dev/ai/package/roblox/egomoose/explore-by-predicate/files","readme":"# explore-by-predicate\r\n \r\nA Roblox lua package for exploring the game hierarchy with predicates and promises\r\n\r\nGet it here:\r\n\r\n* [Wally](https://wally.run/package/egomoose/tween-promise)\r\n* [Releases](https://github.com/EgoMoose/explore-by-predicate/releases)\r\n\r\n## API\r\n\r\n```Lua\r\n--[=[\r\nCreates a new promise looking for a child/descendant that matches the conditions of the predicate provided. \r\nIf no child/descendant is found the promise will reject.\r\n\r\n@param parent Instance -- The instance to start the search from.\r\n@param recursive boolean? -- If true, this function searches all descendants rather than only the immediate children.\r\n@param predicate (Instance) -> boolean -- This function's is used to check all candidates for resolution eligibility.\r\n@return Promise<Instance>\r\n--]=]\r\nfunction module.findFirstChildWithPredicate(parent: Instance, recursive: boolean?, predicate: (Instance) -> boolean)\r\n\r\n--[=[\r\nCreates a new promise looking for a child/descendant that matches the name provided.\r\nIf no child/descendant is found the promise will reject.\r\n\r\n@param parent Instance -- The instance to start the search from.\r\n@param name string -- The name of the child / descendant that should be found.\r\n@param recursive boolean? -- If true, this function searches all descendants rather than only the immediate children.\r\n@return Promise<Instance>\r\n--]=]\r\nfunction module.findFirstChild(parent: Instance, name: string, recursive: boolean?)\r\n\r\n--[=[\r\nChains together a number of `findFirstChild` promises to search one after another for specific child names.\r\nIf no child/descendant is found at any point along the path the promise will reject.\r\n\r\nThis would be short hand for writing:\r\n\r\nmodule.findFirstChild(workspace, \"Model\"):andThen(function(child)\r\n\treturn module.findFirstChild(child, \"Configuration\")\r\nend):andThen(function(child)\r\n\treturn module.findFirstChild(child, \"PrimaryColor\")\r\nend)\r\n\r\nvs\r\n\r\nmodule.findFirstPath(workspace, { \"Model\", \"Configuration\", \"PrimaryColor\" })\r\n\r\n@param parent Instance -- The instance to start the search from.\r\n@param path { string } -- The names in order that should be resolved.\r\n@return Promise<Instance>\r\n--]=]\r\nfunction module.findFirstPath(parent: Instance, path: { string })\r\n\r\n--[=[\r\nCreates a new promise waiting for a child that matches the conditions of the predicate provided.\r\n\r\n@param parent Instance -- The instance to start the search from.\r\n@param timeout number? -- If the child is not found within this timeout then the promise will reject.\r\n\t\t\t\t\t\t  If no timeout is provided then a warning will be sent to the console after 5 seconds.\r\n@param predicate (Instance) -> boolean -- This function's is used to check all candidates for resolution eligibility.\r\n@return Promise<Instance>\r\n--]=]\r\nfunction module.waitForChildWithPredicate(parent: Instance, timeout: number?, predicate: (Instance) -> boolean)\r\n\r\n--[=[\r\nCreates a new promise waiting for a child that matches the name provided.\r\n\r\n@param parent Instance -- The instance to start the search from.\r\n@param name string -- The name of the child that should be found.\r\n@param timeout number? -- If the child is not found within this timeout then the promise will reject.\r\n\t\t\t\t\t\t  If no timeout is provided then a warning will be sent to the console after 5 seconds.\r\n@return Promise<Instance>\r\n--]=]\r\nfunction module.waitForChild(parent: Instance, name: string, timeout: number?)\r\n\r\n--[=[\r\nChains together a number of `waitForChild` promises to search one after another for specific child names.\r\nThe timeout for this function does not reset after a child along the path is found. The entire path needs\r\nto resolve within the timeout length or else the promise will be rejected.\r\n\r\nThis would be short hand for writing:\r\n\r\nmodule.waitForChild(workspace, \"Model\"):andThen(function(child)\r\n\treturn module.waitForChild(child, \"Configuration\")\r\nend):andThen(function(child)\r\n\treturn module.waitForChild(child, \"PrimaryColor\")\r\nend)\r\n\r\nvs\r\n\r\nmodule.waitForPath(workspace, { \"Model\", \"Configuration\", \"PrimaryColor\" })\r\n\r\n@param parent Instance -- The instance to start the search from.\r\n@param path { string } -- The names in order that should be resolved.\r\n@param timeout number? -- If the entire path is not found within this timeout then the promise will reject.\r\n\t\t\t\t\t\t  If no timeout is provided then a warning will be sent to the console after 5 seconds.\r\n@return Promise<Instance>\r\n--]=]\r\nfunction module.waitForPath(parent: Instance, path: { string }, timeout: number?)\r\n```","readmeTruncated":false}