JSPM

@stdlib/assert-is-relative-uri

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q39029F
  • License Apache-2.0

Test whether a value is a relative URI.

Package Exports

  • @stdlib/assert-is-relative-uri
  • @stdlib/assert-is-relative-uri/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@stdlib/assert-is-relative-uri) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

isRelativeURI

NPM version Build Status Coverage Status

Test whether a value is a relative URI.

Installation

npm install @stdlib/assert-is-relative-uri

Usage

var isRelativeURI = require( '@stdlib/assert-is-relative-uri' );

isRelativeURI( value )

Tests whether a value is a relative URI.

var bool = isRelativeURI( 'foo/bar' );
// returns true

bool = isRelativeURI( 'https://example.com/' );
// returns false

Notes

Examples

var isRelativeURI = require( '@stdlib/assert-is-relative-uri' );

var bool = isRelativeURI( './foo.js' );
// returns true

bool = isRelativeURI( '/dashboard/admin' );
// returns true

bool = isRelativeURI( 'image.png' );
// returns true

bool = isRelativeURI( 'http://www.example.com/' );
// returns false

bool = isRelativeURI( 'https://www.example.com/' );
// returns false

bool = isRelativeURI( 'ftp://ftp.is.co.za/rfc/rfc1808.txt' );
// returns false

bool = isRelativeURI( 'data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D' );
// returns false

bool = isRelativeURI( 'mailto:beep@boop.com' );
// returns false

bool = isRelativeURI( null );
// returns false

CLI

Installation

To use the module as a general utility, install the module globally

npm install -g @stdlib/assert-is-relative-uri

Usage

Usage: is-relative-uri [options] [<uri>]

Options:

  -h,    --help                Print this message.
  -V,    --version             Print the package version.
         --split sep           Delimiter for stdin data. Default: '/\\r?\\n/'.

Examples

$ is-relative-uri google.com
true

To use as a standard stream,

$ echo -n 'https://google.com' | is-relative-uri
false

By default, when used as a standard stream, the implementation assumes newline-delimited data. To specify an alternative delimiter, set the split option.

$ echo -n 'https://google.com\tbeep' | is-absolute-uri --split '\t'
false
true

Notice

This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.

For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.

Community

Chat


License

See LICENSE.

Copyright © 2016-2022. The Stdlib Authors.