Package Exports
- @igor.dvlpr/unc-path
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@igor.dvlpr/unc-path) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
UNC Path
🥽 Provides ways of parsing UNC paths and checking whether they are valid. 🎱
Usage
Install it first by doing
npm i @igor.dvlpr/unc-path
and call require
in your code, i.e.:
const unc = require('@igor.dvlpr/unc-path')
// or destructure the object and import only needed function(s)
// e.g.
const { isValid } = require('@igor.dvlpr/unc-path')
// do something cool with it
API
isValid()
=>
returns whether the given path is a UNC one.
Signature
isValid(path): boolean
Parameters
path: string // a string that represents the path to process
Example
const { isValid } = require('@igor.dvlpr/unc-path')
console.log(isValid('//ComputerName/SharedFolder/')) // returns true
console.log(isValid('//ComputerName/SharedFolder/file.mp4')) // returns true
console.log(isValid('/ComputerName/SharedFolder/')) // returns false
parse()
=>
parses the provided UNC path and returns UNC path's components as
{
'server': string,
'resource': string
}
Signature
parse(path): Object
Parameters
path: string // a string that represents the path to process
Example
const { parse } = require('@igor.dvlpr/unc-path')
console.log(parse('//Server/Dev/file.js'))
/*
returns {
server: 'Server',
resource: '/Dev/file.js',
}
*/
console.log(parse('/Server/Dev/file.js'))
/*
returns {
server: '',
resource: '',
}
*/