pax_global_header00006660000000000000000000000064124705302130014507gustar00rootroot0000000000000052 comment=7a76a0c9f2263192beedbe0a820e4d0baee5b7a1 path-is-absolute-1.0.0/000077500000000000000000000000001247053021300146665ustar00rootroot00000000000000path-is-absolute-1.0.0/.editorconfig000066400000000000000000000003371247053021300173460ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [package.json] indent_style = space indent_size = 2 [*.md] trim_trailing_whitespace = false path-is-absolute-1.0.0/.gitattributes000066400000000000000000000000141247053021300175540ustar00rootroot00000000000000* text=auto path-is-absolute-1.0.0/.gitignore000066400000000000000000000000151247053021300166520ustar00rootroot00000000000000node_modules path-is-absolute-1.0.0/.jshintrc000066400000000000000000000002761247053021300165200ustar00rootroot00000000000000{ "node": true, "esnext": true, "bitwise": true, "camelcase": true, "curly": true, "immed": true, "newcap": true, "noarg": true, "undef": true, "unused": "vars", "strict": true } path-is-absolute-1.0.0/.travis.yml000066400000000000000000000001101247053021300167670ustar00rootroot00000000000000sudo: false language: node_js node_js: - 'iojs' - '0.12' - '0.10' path-is-absolute-1.0.0/index.js000066400000000000000000000011271247053021300163340ustar00rootroot00000000000000'use strict'; function posix(path) { return path.charAt(0) === '/'; }; function win32(path) { // https://github.com/joyent/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; var result = splitDeviceRe.exec(path); var device = result[1] || ''; var isUnc = !!device && device.charAt(1) !== ':'; // UNC paths are always absolute return !!result[2] || isUnc; }; module.exports = process.platform === 'win32' ? win32 : posix; module.exports.posix = posix; module.exports.win32 = win32; path-is-absolute-1.0.0/license000066400000000000000000000021371247053021300162360ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) Sindre Sorhus (sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. path-is-absolute-1.0.0/package.json000066400000000000000000000012471247053021300171600ustar00rootroot00000000000000{ "name": "path-is-absolute", "version": "1.0.0", "description": "Node.js 0.12 path.isAbsolute() ponyfill", "license": "MIT", "repository": "sindresorhus/path-is-absolute", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "engines": { "node": ">=0.10.0" }, "scripts": { "test": "node test.js" }, "files": [ "index.js" ], "keywords": [ "path", "paths", "file", "dir", "absolute", "isabsolute", "is-absolute", "built-in", "util", "utils", "core", "ponyfill", "polyfill", "shim", "is", "detect", "check" ] } path-is-absolute-1.0.0/readme.md000066400000000000000000000016511247053021300164500ustar00rootroot00000000000000# path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute) > Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) ponyfill > Ponyfill: A polyfill that doesn't overwrite the native method ## Install ``` $ npm install --save path-is-absolute ``` ## Usage ```js var pathIsAbsolute = require('path-is-absolute'); // Linux pathIsAbsolute('/home/foo'); //=> true // Windows pathIsAbsolute('C:/Users/'); //=> true // Any OS pathIsAbsolute.posix('/home/foo'); //=> true ``` ## API See the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isabsolute_path). ### pathIsAbsolute(path) ### pathIsAbsolute.posix(path) The Posix specific version. ### pathIsAbsolute.win32(path) The Windows specific version. ## License MIT © [Sindre Sorhus](http://sindresorhus.com) path-is-absolute-1.0.0/test.js000066400000000000000000000020151247053021300162010ustar00rootroot00000000000000var assert = require('assert'); var util = require('util'); var pathIsAbsolute = require('./'); var path = { posix: { isAbsolute: pathIsAbsolute.posix }, win32: { isAbsolute: pathIsAbsolute.win32 } }; // https://github.com/joyent/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/test/simple/test-path.js#L344 assert.equal(path.win32.isAbsolute('//server/file'), true); assert.equal(path.win32.isAbsolute('\\\\server\\file'), true); assert.equal(path.win32.isAbsolute('C:/Users/'), true); assert.equal(path.win32.isAbsolute('C:\\Users\\'), true); assert.equal(path.win32.isAbsolute('C:cwd/another'), false); assert.equal(path.win32.isAbsolute('C:cwd\\another'), false); assert.equal(path.win32.isAbsolute('directory/directory'), false); assert.equal(path.win32.isAbsolute('directory\\directory'), false); assert.equal(path.posix.isAbsolute('/home/foo'), true); assert.equal(path.posix.isAbsolute('/home/foo/..'), true); assert.equal(path.posix.isAbsolute('bar/'), false); assert.equal(path.posix.isAbsolute('./baz'), false);