UNPKG

@fav/path.isabsolute

Version:

Provides same behaviors of `path.isabsolute` module for all versions of node.js

19 lines (14 loc) 339 B
'use strict'; var path = require('path'); var inspect = require('util').inspect; if (path.isAbsolute) { module.exports = path.isAbsolute; return; } module.exports = function(pth) { if (typeof pth !== 'string') { throw new TypeError( 'Path must be a string, Received ' + inspect(pth)); } return (pth[0] === '/'); };