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

assert-path

v0.1.0

Published

Extends node's assert module with methods for testing filepaths.

Readme

assert-path NPM version

Extends node's assert module with methods for testing filepaths.

Install

Install with npm

$ npm i assert-path --save

Usage

var assert = require('assert');
require('assert-path')(assert);

API

assert.dirname

Returns true if path.dirname of filepath a equals filepath b.

assert.dirname(a, b);

Example

assert.dirname('a/b/c.js', 'a/b/c');
//=> true

assert.basename

Returns true if path.basename of filepath a equals filepath b.

assert.basename(a, b);

Example

assert.basename('a/b/ccc.js', 'ccc.js');
//=> true

assert.filename

Returns true if path.filename of filepath a equals filepath b.

assert.filename(a, b);

Example

assert.filename('a/b/ccc.js', 'ccc');
//=> true

assert.extname

Returns true if path.extname of filepath a equals filepath b.

assert.extname(a, b);

Example

assert.extname('a/b/c.js', '.js');
//=> true

assert.path

Returns true if filepath a equals filepath b.

assert.path(a, b);

Example

assert.path('a/b/c.js', 'a/b/c.js');
//=> true

assert.absolute

Returns true if path.resolve(a) equals path.resolve(b).

assert.absolute(a, b);

Example

assert.absolute('a/b/c.js', 'a/b/c.js');
//=> true

assert.segments

Returns true if the last nth segments of a equals the last nth segments of b. For example, the last 2 segments of foo/bar/baz/qux.md would be baz/qux.md.

assert.segments(a, b, 2);

Example

// b/c.js === 'b/c.js'
assert.segments('a/b/c.js', 'a/b/c.js');
//=> true

assert.lastSegments

Returns true if the last nth segments of a equals b.

assert.lastSegments(a, b, 2);

Example

assert.lastSegments('a/b/c/d/e.js', 'd/e.js', 2);
//=> true

assert.isAbsolute

Returns true if a filepath is absolute.

assert.isAbsolute(filepath);

Example

assert.isAbsolute('a/b/c.js');
//=> false

assert.isAbsolute(path.resolve('a/b/c.js'));
//=> false

assert.isRelative

Returns true if path.resolve(a) equals path.resolve(b).

assert.isRelative(filepath);

Example

assert.isRelative('a/b/c.js');
//=> true
assert.isRelative(path.resolve('a/b/c.js'));
//=> false

Related projects

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on November 08, 2015.