npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rbxts/flamework-instance-parser

v0.1.1

Published

This is a small library that allows you to convert instances into a specified structure.

Downloads

8

Readme

flamework-instance-parser

This is a small library that allows you to convert instances into a specified structure.

Capabilities

This is an interface showing all the features of flamework-instance-parser, see the Demo section for a functional example.

interface Description {
	// Fetches a string attribute called "attribute", inferred from the field name.
	attribute: Attribute<string>;

	// Same as above, except with an explicit attribute name.
	attributeButRenamed: Attribute<string, "attribute">;

	// Retrieves a property from the instance, in this case the name.
	name: Property<string>;

	// Same as above, except with an explicit property name.
	nameButRenamed: Property<string, "Name">;

	// You can access children using the `Child` modifier
	child: Child<{ name: Property<string> }>;

	// Same as above, except with an explicit child name.
	childButRenamed: Child<{ name: Property<string> }, "child">;

	// Children can also be implicit, but does not support renaming.
	childButImplicit: { name: Property<string> };

	// Specifying an Instance type will give you access to the instance being parsed, with a type guard.
	childButInstance: BasePart;

	// Arrays parse each child under `parts` as the array's element type.
	parts: Array<{ name: Property<string> }>;

	// Maps parse each child under `partsButMap` using both the key and value.
	partsButMap: Map<Instance, { name: Property<string> }>;

	// This creates a map of the child's Name to its instance, duplicate keys get overwritten.
	partsButMapByName: Map<Property<string, "Name">, Instance>;

	// This modifier allows you to parse a type as the current instance instead of a child.
	selfInstance: Self<Instance>;

	// This can be used in conjunction with arrays to parse children, but any valid parseable type will work.
	selfChildren: Self<BasePart[]>;

	// This allows you to reference this instance's parent, and supports any valid parseable type.
	parentInstance: Parent<Instance>;
}

Demo

This is a minimal demo showing functional code, see the Capabilities section for explanation of features.

interface Description {
	// Refers to the current instance being parsed
	self: Self<Instance>;

	// Collects all of the children on the current instance as an array
	selfChildren: Self<Instance[]>;

	// Fetches the name on the current instance
	myName: Property<string, "Name">;

	// Collects the names of all the children on the current instance
	myChildrenNames: Self<Array<Property<string, "Name">>>;

	// Fetches the name on the current instance's parent
	parentName: Parent<Property<string, "Name">>;

	// Fetches an attribute on the current instance
	attribute: Attribute<number>;
}

Workspace.SetAttribute("attribute", 42);

// Uncomment to trigger an error
// Workspace.SetAttribute("attribute", "invalid attribute type!");

for (let i = 0; i < 10; i++) {
	const part = new Instance("Part");
	part.Name = `Part ${i}`;
	part.Parent = Workspace;
}

const result = parseInstanceTree<Description>(Workspace);
if (result.success) {
	print("Successfully parsed Workspace!", result.value);
} else {
	warn("Failed to parse Workspace!", result.errors);

	// flamework-instance-parser comes with a function to emit nicely formatted errors, as well
	// This function emits warnings so that the instance names can be clicked on for debugging.
	emitParseErrors(result.errors);

	// You can access the (incomplete) parsed object as well, but it is typed as `unknown` as it may not have been parsed correctly or fully.
	warn("Incomplete parsed object", result.incompleteValue);
}