# trocha

> Route/Path listing for JS

Latest version **0.2.3** (published 2019-05-09) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install trocha
pnpm add trocha
yarn add trocha
bun add trocha
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.3 |
| Published | 2019-05-09 |
| First published | 2019-03-18 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 336.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Daniel Reinaldo Zorro Forero |
| Maintainers | dfoxpro |
| Keywords | path, router, route, routing, engine, vanilla, XHR, ajax |

## Links

- npm: https://www.npmjs.com/package/trocha
- Repository: https://github.com/DFOXpro/trocha
- Homepage: https://dfoxpro.github.io/trochaJS
- Issues: https://github.com/DFOXpro/trocha/issues
- npm.io page: https://npm.io/package/trocha

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 0.2.3 (latest) — 2019-05-09
- 0.2.2 — 2019-05-09
- 0.2.1 — 2019-04-12
- 0.2.0 — 2019-03-18

## README

# TrochaJS

**TLDR** It replace long, ugly, repetitibe url strings with clean objects

[![MPL license](https://img.shields.io/npm/l/trocha.svg?style=plastic&logo=Mozilla)](https://www.mozilla.org/en-US/MPL/2.0/FAQ)
[![npm version](https://img.shields.io/npm/v/trocha.svg?style=plastic&logo=npm)](https://www.npmjs.com/package/trocha)

[![Commits since release](https://img.shields.io/github/commits-since/DFOXpro/trocha/0.2.1.svg?style=plastic&logo=Github)]()
[![Commits since previous release](https://img.shields.io/github/commits-since/DFOXpro/trocha/0.1.3.svg?style=plastic&logo=Github)]()
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=plastic&logo=Github)](http://makeapullrequest.com)

<!-- @TODO
[![Code Climate](https://img.shields.io/codeclimate/github/DFOXpro/trocha.svg?style=plastic)](https://codeclimate.com/github/DFOXpro/trocha)
-->

[![npm downloads](https://img.shields.io/npm/dm/trocha.svg?style=plastic)](https://npmcharts.com/compare/trocha?minimal=true)
[![Build Status](https://img.shields.io/travis/DFOXpro/trocha.svg?logo=Travis%20CI&logoColor=FFFFFF&style=plastic)](https://travis-ci.org/DFOXpro/trocha)
[![Dependency Status](https://img.shields.io/david/DFOXpro/trocha.svg?style=plastic)](https://david-dm.org/DFOXpro/trocha)
[![devDependency Status](https://img.shields.io/david/dev/DFOXpro/trocha.svg?style=plastic)](https://david-dm.org/DFOXpro/trocha#info=devDependencies)

[![Test FX](https://img.shields.io/badge/asserts-182/182-brightgreen.svg?style=plastic&logo=Mozilla%20Firefox)](https://github.com/DFOXpro/trocha/tree/master/src/test)
[![Test Chromium](https://img.shields.io/badge/asserts-182/182-brightgreen.svg?style=plastic&logo=Google%20Chrome)](https://github.com/DFOXpro/trocha/tree/master/src/test)
[![Test Edge](https://img.shields.io/badge/asserts-182/182-brightgreen.svg?style=plastic&logo=Microsoft%20Edge)](https://github.com/DFOXpro/trocha/tree/master/src/test)
[![Test IE](https://img.shields.io/badge/11%20asserts-179/182-brightgreen.svg?style=plastic&logo=Internet%20explorer&color=important)](https://github.com/DFOXpro/trocha/tree/master/src/test)
[![Test Node](https://img.shields.io/badge/asserts-182/182-brightgreen.svg?style=plastic&logo=Node.js)](https://github.com/DFOXpro/trocha/tree/master/src/test)

[![Contact info](https://img.shields.io/badge/contact-@DFOXpro-informational.svg?style=plastic&logo=Twitter)](https://twitter.com/dfoxpro)
[![Share info](https://img.shields.io/badge/share-%23TrochaJS-informational.svg?style=plastic&logo=Twitter)](https://twitter.com/hashtag/TrochaJS)

An standalone/agnostic library to print valid URLs, ideal for RESTful & SPA frontEnd big projects.

## Why this library exist

This library take inspiration from Ruby routing system, where you describe the routes via a simple name tree and call those routes via dinamic function naming, preventing use of string in views and controllers.

> Ugly code example

```javascript
theRoute =
	'https://my.domain.com.co/product/' +
	myProduct.id +
	'/buy' +
	'?quantity=' +
	sell.quantity
```

> With Trocha

```javascript
theRoute = myRoutes.product.buy.path({
	product_id: myProduct.id,
	query: { quantity: sell.quantity }
})
```

> This will print

```bash
https://my.domain.com.co/product/<product_id>/buy?quantity=<sell.quantity>
```

Please see the full docs at [here: https://dfoxpro.github.io/trochaJS](https://dfoxpro.github.io/trochaJS)

---
_Source: https://npm.io/package/trocha · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
