[go: up one dir, main page]

rudy-match-path

0.3.0 • Public • Published

rudy-match-path

This is the matchPath function borrowed from React Router for general purpose use. It's used by Rudy and its <Link /> package.

Installation

yarn add rudy-match-path

Usage

import matchPath from 'rudy-match-path'
 
const { pathname } = window.location // '/foo/bar'
const isMatch = matchPath(pathname, { path: '/foo/:page', exact: true, strict: false })
 
<a className={isMatch && 'active'}>Foo</a>

Contributing

We use commitizen, so run npm run cm to make commits. A command-line form will appear, requiring you answer a few questions to automatically produce a nicely formatted commit. Releases, semantic version numbers, tags, changelogs and publishing to NPM will automatically be handled based on these commits thanks to semantic-release. Be good.

Tests

Reviewing a package's tests are a great way to get familiar with it. It's direct insight into the capabilities of the given package (if the tests are thorough). What's even better is a screenshot of the tests neatly organized and grouped (you know the whole "a picture says a thousand words" thing).

Below is a screenshot of this module's tests running in Wallaby ("An Integrated Continuous Testing Tool for JavaScript") which everyone in the React community should be using. It's fantastic and has taken my entire workflow to the next level. It re-runs your tests on every change along with comprehensive logging, bi-directional linking to your IDE, in-line code coverage indicators, and even snapshot comparisons + updates for Jest! I requestsed that feature by the way :). It's basically a substitute for live-coding that inspires you to test along your journey.

rudy-match-path screenshot

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.3.016,681latest

Version History

VersionDownloads (Last 7 Days)Published
0.3.016,681
0.2.01
0.1.03
0.0.21
0.0.12

Package Sidebar

Install

npm i rudy-match-path

Weekly Downloads

16,688

Version

0.3.0

License

MIT

Last publish

Collaborators

  • faceyspacey