MCPcopy
hub / github.com/Unitech/pm2 / isAbsolute

Method isAbsolute

modules/pm2-io-agent/src/Utility.js:123–135  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

121 }
122
123 isAbsolute (path) {
124 if (process.platform === 'win32') {
125 // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56
126 let splitDeviceRe = /^([a-zA-Z]:|[\\/]{2}[^\\/]+[\\/]+[^\\/]+)?([\\/])?([\s\S]*?)$/
127 let result = splitDeviceRe.exec(path)
128 let device = result[1] || ''
129 let isUnc = Boolean(device && device.charAt(1) !== ':')
130 // UNC paths are always absolute
131 return Boolean(result[2] || isUnc)
132 } else {
133 return path.charAt(0) === '/'
134 }
135 }
136
137 parse (stack) {
138 if (!stack || stack.length === 0) return false

Callers 4

parseMethod · 0.95
_startJsonMethod · 0.45
serveFileFunction · 0.45
API.jsFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected