# patrun > Match JavaScript objects and Go maps against patterns, most specific first. The documentation of patrun 9.0.0 for JavaScript and 0.4.0 for Go is in four kinds of page: tutorials, how-to guides, reference, and explanation. Every page has a Markdown version at its address, with `.md` in place of `.html`. ## Tutorials - [Build your first router](https://rjrodger.github.io/patrun/tutorials/first-router.md): Install patrun, add patterns to a router, and find the data of the pattern that best matches each query, in JavaScript. - [Build your first router in Go](https://rjrodger.github.io/patrun/tutorials/first-router-go.md): Add patterns to a Go router, and find the data of the pattern that best matches each query. ## How-to guides - [Pick the most specific match](https://rjrodger.github.io/patrun/how-to/pick-most-specific.md): Add a general pattern and its special cases, and let find answer with the most specific one that matches. - [Choose which keys come first](https://rjrodger.github.io/patrun/how-to/choose-key-order.md): Name the keys that decide first between patterns that match as many properties, with the order option. - [Require every key of the query](https://rjrodger.github.io/patrun/how-to/require-all-keys.md): Find only a pattern that has every property of the query, with findExact. - [Collect every match](https://rjrodger.github.io/patrun/how-to/collect-matches.md): Get the data of every pattern that matches a query, in the router's key order, with collect and collectExact. - [Match any value of a key](https://rjrodger.github.io/patrun/how-to/require-a-key.md): Give a pattern the value '*' to match a query that has the key, whatever its value. - [Match values with glob expressions](https://rjrodger.github.io/patrun/how-to/match-globs.md): Turn on the gex option to let a pattern value use * and ? to match many values. - [Match numbers by interval](https://rjrodger.github.io/patrun/how-to/match-intervals.md): Turn on the interval option to let a pattern value match a range of numbers, such as >10 or [10,20]. - [Get the data of one pattern](https://rjrodger.github.io/patrun/how-to/get-one-pattern.md): Read back the data stored at exactly one pattern with get, not the data of the pattern that best matches. - [List the patterns a router holds](https://rjrodger.github.io/patrun/how-to/list-patterns.md): List every pattern and its data with list, or only those that have the properties of a partial pattern. - [Remove a pattern](https://rjrodger.github.io/patrun/how-to/remove-a-pattern.md): Clear the data of exactly one pattern with remove, leaving every other pattern as it was. - [Inspect a router](https://rjrodger.github.io/patrun/how-to/inspect-the-tree.md): Print a router's patterns and data with toString, or its tree as JSON with toJSON, to debug it or compare two routers. - [Install patrun](https://rjrodger.github.io/patrun/how-to/install.md): Add patrun to a JavaScript, TypeScript, or Go project, and check which version you have. - [Build a table of business rules](https://rjrodger.github.io/patrun/how-to/business-rules.md): Replace a ladder of if statements with a router of rules, general and special, each added on its own. - [Customise stored data](https://rjrodger.github.io/patrun/how-to/customise-data.md): Give patrun a function that changes each pattern as it is added, and that changes what find gives back. - [Use patrun from TypeScript](https://rjrodger.github.io/patrun/how-to/typescript.md): Type a router's data, so that add takes only data of that type and find answers with it. - [Share a Go router between goroutines](https://rjrodger.github.io/patrun/how-to/goroutines.md): Read a Go router from many goroutines at once, and guard it with a lock when its patterns change while it is in use. ## Reference - [How a match is chosen](https://rjrodger.github.io/patrun/reference/matching.md): Which patterns match a query, the order that decides between them, the forms of globs and intervals, and the order of a list. - [What patterns and queries hold](https://rjrodger.github.io/patrun/reference/values.md): The keys and values a pattern and a query may have in each port, and what each function does with anything else. - [JavaScript API](https://rjrodger.github.io/patrun/reference/javascript.md): The patrun function, its options, and every method of a router, in JavaScript. - [TypeScript types](https://rjrodger.github.io/patrun/reference/typescript.md): The types the package exports, and what each one describes. - [Go API](https://rjrodger.github.io/patrun/reference/go.md): The Go package's constructor, options, methods, and types, and where it differs from the JavaScript package. ## Explanation - [Why the most specific pattern wins](https://rjrodger.github.io/patrun/explanation/two-rules.md): The two rules that decide every match, why they give one answer for every query, and what the alphabetical order costs. - [How the tree finds a match](https://rjrodger.github.io/patrun/explanation/the-tree.md): How a router stores its patterns as a tree of keys and values, why a lookup follows only the branches a query matches, and what the skip paths are for. - [Why every value is a string](https://rjrodger.github.io/patrun/explanation/strings-and-maps.md): Why patrun stores and matches values as text, takes only maps, and holds a Go pattern's data as a pointer to a string. - [The definition](https://rjrodger.github.io/patrun/explanation/definition.md): The Lean 4 definition of what a router answers, the proofs that the answers are unique, and how it keeps the two ports in step. ## Optional - [Repository](https://github.com/rjrodger/patrun): The code of both ports, the definition, and their releases.