1.0.0 • Published 7 years ago

is-absolute v1.0.0

Weekly downloads
4,055,849
License
MIT
Repository
github
Last release
7 years ago

is-absolute NPM version NPM monthly downloads NPM total downloads Linux Build Status

Returns true if a file path is absolute. Does not rely on the path module and can be used as a polyfill for node.js native path.isAbolute.

Install

Install with npm:

$ npm install --save is-absolute

Originally based on the isAbsolute utility method in express.

Usage

var isAbsolute = require('is-absolute');

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

Explicitly test windows paths

isAbsolute.posix('/foo/bar');
isAbsolute.posix('/user/docs/Letter.txt');
//=> true

isAbsolute.posix('foo/bar');
//=> false

Explicitly test windows paths

var isAbsolute = require('is-absolute');

isAbsolute.win32('c:\\');
isAbsolute.win32('//C://user\\docs\\Letter.txt');
isAbsolute.win32('\\\\unc\\share');
isAbsolute.win32('\\\\unc\\share\\foo');
isAbsolute.win32('\\\\unc\\share\\foo\\');
isAbsolute.win32('\\\\unc\\share\\foo\\bar');
isAbsolute.win32('\\\\unc\\share\\foo\\bar\\');
isAbsolute.win32('\\\\unc\\share\\foo\\bar\\baz');
//=> true

isAbsolute.win32('a:foo/a/b/c/d');
isAbsolute.win32(':\\');
isAbsolute.win32('foo\\bar\\baz');
isAbsolute.win32('foo\\bar\\baz\\');
//=> false

About

Related projects

Contributing

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

Contributors

CommitsContributor
35jonschlinkert
1es128
1shinnn
1Sobak

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.6.0, on July 13, 2017.

parse-filepathto-absolute-globeasy-select-rn@arisageha/react-lazyloadairscanairscan-examplereact-native-esc-pos-sahaab@borisovart/atol-kkt-moduledeneme323112@ntt_app/react-native-custom-notificationreact-native-covid-sdklualatex-pypanqibaoreact-native-printer-brothersmake-jsreact-native-shekhar-bridge-test@oiti/documentoscopy-react-nativequoc-testunblock-block-save-variables@infinitebrahmanuniverse/nolb-is-a@prodam/prodam-typesluminos-ui-core@everything-registry/sub-chunk-1932jawwy-sdkjawwy_gamification_releasereact-native-sphereuisphereuijawwy_libraryreact-native-credit-card-pkgreact-native-jawwy_sampledemo-test-scrndfeuk-frontenddfeuk-frontend-manual@dietechniker/gulp-sass-dependency-tracker@dsherret/to-absolute-globdd2othersexpress-engine-inferno-jsxfawaterak-online-paymentfawatrak-online-paymentfenglin-uploaderextract-base-iteratorfishzerofluent.adflow.reactnativesdkfluent.adflow.reactnativesdk-alphafmslfs-utilsdogandev-simple-toastesbox@headgum/tko-mapping@hv/publishis-pathis-git-repository@blusalt-sdk/react-native-blusalt-document-verificationgriffin-ui-librarygrouplink-dev-cli@enkeledi/react-native-week-month-date-pickergrunt-esnextgmp-helper@dword-design/plugin-name-to-package-name@faizanhaider/iconsaxh5-templetehendo-clihendo-cli-luozheao@extrieve_technologies/quickcapture_react_nativehileix-rcligamification-integration-newframework_test_library_sixdeeframework_test_library_sixdee_newframework_test_library_sixdee_new_newgatsby-dev-cligenially-cloudgenerator-utilgenz-native-elementsgitkraken-cligaurav-react-native-loopgit-needs-pullhcm-jshelper-assetsjrennsoh88-react-native-scroll-indicatorjordy-frijters-test-libjeuxui@idas1/ui-component-lib@igniswap/igni-swap-lib@isogand/react-native-sliding-counter@ko-developerhong/react-native-multiple-image-picker@jfilipe-sparta/react-native-module_2khaled-salem-custom-components3.0.0@brucearmstrong/sass-librarylayui-customjawwy_library_newjawy_library_v1gamification-jawwy-libraryframework_test_library_sixdee_new_jawwytest_lib_module_aar@amirdiafi/react-native-ios-hapticsbiometric-st@adembacaj/react-native-google-paybridgeline-kabinetbower-files
1.0.0

7 years ago

0.2.6

8 years ago

0.2.5

8 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.7

9 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago