Remove helpers.isAbsolutePath() in favor of fsPlus.isAbsolute()

This commit is contained in:
Juan Cruz Viotti 2014-12-08 11:09:01 -04:00
parent 5059bcb212
commit b4a49113fb
2 changed files with 2 additions and 33 deletions

View File

@ -1,20 +1,7 @@
_ = require('lodash')
fsPlus = require('fs-plus')
path = require('path')
# Check is path is absolute
#
# @private
#
# @param {String} path path
# @return {Boolean} is absolute
#
# @example Is path absolute?
# console.log isAbsolutePath('/usr') # True
# console.log isAbsolutePath('../Music') # False
#
exports.isAbsolutePath = (p) ->
return path.resolve(p) is p
# Prefix relative value paths with another path
#
# @private
@ -35,7 +22,7 @@ exports.prefixObjectValuesWithPath = (prefix, object) ->
return _.object _.map object, (value, key) ->
result = [ key ]
if exports.isAbsolutePath(value)
if fsPlus.isAbsolute(value)
result.push(value)
else
result.push(path.join(prefix, value))

View File

@ -5,24 +5,6 @@ helpers = require('./helpers')
describe 'Helpers:', ->
describe '#isAbsolutePath()', ->
it 'should return true for absolute paths', ->
for path in [
'/'
'/Users/me'
'/usr/share'
]
expect(helpers.isAbsolutePath(path)).to.be.true
it 'should return false for relative paths', ->
for path in [
'./hello'
'../../resin'
'directory/'
]
expect(helpers.isAbsolutePath(path)).to.be.false
describe '#prefixObjectWithPath()', ->
it 'should add the path to every value', ->