mirror of
https://github.com/musix-org/musix-oss
synced 2025-07-06 22:10:49 +00:00
fix
This commit is contained in:
20
node_modules/strip-dirs/LICENSE
generated
vendored
Normal file
20
node_modules/strip-dirs/LICENSE
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 - 2016 Shinnosuke Watanabe
|
||||
|
||||
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.
|
75
node_modules/strip-dirs/README.md
generated
vendored
Normal file
75
node_modules/strip-dirs/README.md
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
# strip-dirs
|
||||
|
||||
[](https://www.npmjs.com/package/strip-dirs)
|
||||
[](https://travis-ci.org/shinnn/node-strip-dirs)
|
||||
[](https://ci.appveyor.com/project/ShinnosukeWatanabe/node-strip-dirs)
|
||||
[](https://coveralls.io/r/shinnn/node-strip-dirs)
|
||||
[](https://david-dm.org/shinnn/node-strip-dirs)
|
||||
[](https://david-dm.org/shinnn/node-strip-dirs#info=devDependencies)
|
||||
|
||||
Remove leading directory components from a path, like [tar(1)](http://linuxcommand.org/man_pages/tar1.html)'s `--strip-components` option
|
||||
|
||||
```javascript
|
||||
const stripDirs = require('strip-dirs');
|
||||
|
||||
stripDirs('foo/bar/baz', 1); //=> 'bar/baz'
|
||||
stripDirs('foo/bar/baz', 2); //=> 'baz'
|
||||
stripDirs('foo/bar/baz', 999); //=> 'baz'
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
[Use npm](https://docs.npmjs.com/cli/install).
|
||||
|
||||
```
|
||||
npm install --save strip-dirs
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```javascript
|
||||
const stripDirs = require('strip-dirs');
|
||||
```
|
||||
|
||||
### stripDirs(*path*, *count* [, *option*])
|
||||
|
||||
*path*: `String` (A relative path)
|
||||
*count*: `Number` (0, 1, 2, ...)
|
||||
*option*: `Object`
|
||||
Return: `String`
|
||||
|
||||
It removes directory components from the beginning of the *path* by *count*.
|
||||
|
||||
```javascript
|
||||
const stripDirs = require('strip-dirs');
|
||||
|
||||
stripDirs('foo/bar', 1); //=> 'bar'
|
||||
stripDirs('foo/bar/baz', 2); //=> 'bar'
|
||||
stripDirs('foo/././/bar/./', 1); //=> 'bar'
|
||||
stripDirs('foo/bar', 0); //=> 'foo/bar'
|
||||
|
||||
stripDirs('/foo/bar', 1) // throw an error because the path is an absolute path
|
||||
```
|
||||
|
||||
If you want to remove all directory components certainly, use [`path.basename`](https://nodejs.org/api/path.html#path_path_basename_path_ext) instead of this module.
|
||||
|
||||
#### option.disallowOverflow
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
By default, it keeps the last path component when path components are fewer than the *count*.
|
||||
|
||||
If this option is enabled, it throws an error in this situation.
|
||||
|
||||
```javascript
|
||||
stripDirs('foo/bar/baz', 9999); //=> 'baz'
|
||||
|
||||
stripDirs('foo/bar/baz', 9999, {disallowOverflow: true}); // throws an range error
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2014 - 2016 [Shinnosuke Watanabe](https://github.com/shinnn)
|
||||
|
||||
Licensed under [the MIT License](./LICENSE).
|
72
node_modules/strip-dirs/index.js
generated
vendored
Normal file
72
node_modules/strip-dirs/index.js
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
/*!
|
||||
* strip-dirs | MIT (c) Shinnosuke Watanabe
|
||||
* https://github.com/shinnn/node-strip-dirs
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const util = require('util');
|
||||
|
||||
const isNaturalNumber = require('is-natural-number');
|
||||
|
||||
module.exports = function stripDirs(pathStr, count, option) {
|
||||
if (typeof pathStr !== 'string') {
|
||||
throw new TypeError(
|
||||
util.inspect(pathStr) +
|
||||
' is not a string. First argument to strip-dirs must be a path string.'
|
||||
);
|
||||
}
|
||||
|
||||
if (path.posix.isAbsolute(pathStr) || path.win32.isAbsolute(pathStr)) {
|
||||
throw new Error(`${pathStr} is an absolute path. strip-dirs requires a relative path.`);
|
||||
}
|
||||
|
||||
if (!isNaturalNumber(count, {includeZero: true})) {
|
||||
throw new Error(
|
||||
'The Second argument of strip-dirs must be a natural number or 0, but received ' +
|
||||
util.inspect(count) +
|
||||
'.'
|
||||
);
|
||||
}
|
||||
|
||||
if (option) {
|
||||
if (typeof option !== 'object') {
|
||||
throw new TypeError(
|
||||
util.inspect(option) +
|
||||
' is not an object. Expected an object with a boolean `disallowOverflow` property.'
|
||||
);
|
||||
}
|
||||
|
||||
if (Array.isArray(option)) {
|
||||
throw new TypeError(
|
||||
util.inspect(option) +
|
||||
' is an array. Expected an object with a boolean `disallowOverflow` property.'
|
||||
);
|
||||
}
|
||||
|
||||
if ('disallowOverflow' in option && typeof option.disallowOverflow !== 'boolean') {
|
||||
throw new TypeError(
|
||||
util.inspect(option.disallowOverflow) +
|
||||
' is neither true nor false. `disallowOverflow` option must be a Boolean value.'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
option = {disallowOverflow: false};
|
||||
}
|
||||
|
||||
const pathComponents = path.normalize(pathStr).split(path.sep);
|
||||
|
||||
if (pathComponents.length > 1 && pathComponents[0] === '.') {
|
||||
pathComponents.shift();
|
||||
}
|
||||
|
||||
if (count > pathComponents.length - 1) {
|
||||
if (option.disallowOverflow) {
|
||||
throw new RangeError('Cannot strip more directories than there are.');
|
||||
}
|
||||
|
||||
count = pathComponents.length - 1;
|
||||
}
|
||||
|
||||
return path.join.apply(null, pathComponents.slice(count));
|
||||
};
|
74
node_modules/strip-dirs/package.json
generated
vendored
Normal file
74
node_modules/strip-dirs/package.json
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
{
|
||||
"_from": "strip-dirs@^2.0.0",
|
||||
"_id": "strip-dirs@2.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==",
|
||||
"_location": "/strip-dirs",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "strip-dirs@^2.0.0",
|
||||
"name": "strip-dirs",
|
||||
"escapedName": "strip-dirs",
|
||||
"rawSpec": "^2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/decompress"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz",
|
||||
"_shasum": "4987736264fc344cf20f6c34aca9d13d1d4ed6c5",
|
||||
"_spec": "strip-dirs@^2.0.0",
|
||||
"_where": "C:\\Users\\matia\\Musix\\node_modules\\decompress",
|
||||
"author": {
|
||||
"name": "Shinnosuke Watanabe",
|
||||
"url": "https://github.com/shinnn"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/shinnn/node-strip-dirs/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"is-natural-number": "^4.0.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Remove leading directory components from a path, like tar's --strip-components option",
|
||||
"devDependencies": {
|
||||
"@shinnn/eslint-config-node": "^3.0.0",
|
||||
"eslint": "^3.10.0",
|
||||
"istanbul": "^0.4.5",
|
||||
"istanbul-coveralls": "^1.0.3",
|
||||
"tap-spec": "^4.1.1",
|
||||
"tape": "^4.6.2"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "@shinnn/node"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/shinnn/node-strip-dirs#readme",
|
||||
"keywords": [
|
||||
"filepath",
|
||||
"file-path",
|
||||
"path",
|
||||
"dir",
|
||||
"directory",
|
||||
"strip",
|
||||
"strip-components"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "strip-dirs",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/shinnn/node-strip-dirs.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "istanbul cover test.js",
|
||||
"pretest": "eslint --fix --format=codeframe index.js test.js",
|
||||
"test": "node --throw-deprecation --track-heap-objects test.js | tap-spec"
|
||||
},
|
||||
"version": "2.1.0"
|
||||
}
|
Reference in New Issue
Block a user