From 9c920e5f584e4d912aabc6e412693f7142242a89 Mon Sep 17 00:00:00 2001 From: Ruy Adorno Date: Wed, 30 Sep 2020 14:44:30 -0400 Subject: [PATCH] chore: remove unused umask dep --- lib/utils/umask.js | 17 --- node_modules/umask/.npmignore | 28 ----- node_modules/umask/ChangeLog | 9 -- node_modules/umask/LICENSE | 22 ---- node_modules/umask/README.md | 78 -------------- node_modules/umask/index.js | 77 -------------- node_modules/umask/package.json | 28 ----- node_modules/umask/test/simple.js | 166 ------------------------------ package-lock.json | 13 --- package.json | 2 - 10 files changed, 440 deletions(-) delete mode 100644 lib/utils/umask.js delete mode 100644 node_modules/umask/.npmignore delete mode 100644 node_modules/umask/ChangeLog delete mode 100644 node_modules/umask/LICENSE delete mode 100644 node_modules/umask/README.md delete mode 100644 node_modules/umask/index.js delete mode 100644 node_modules/umask/package.json delete mode 100644 node_modules/umask/test/simple.js diff --git a/lib/utils/umask.js b/lib/utils/umask.js deleted file mode 100644 index 2dde1befa69dc..0000000000000 --- a/lib/utils/umask.js +++ /dev/null @@ -1,17 +0,0 @@ -var umask = require('umask') -var npmlog = require('npmlog') -var _fromString = umask.fromString - -module.exports = umask - -// fromString with logging callback -umask.fromString = function (val) { - _fromString(val, function (err, result) { - if (err) { - npmlog.warn('invalid umask', err.message) - } - val = result - }) - - return val -} diff --git a/node_modules/umask/.npmignore b/node_modules/umask/.npmignore deleted file mode 100644 index 59d842baa84c8..0000000000000 --- a/node_modules/umask/.npmignore +++ /dev/null @@ -1,28 +0,0 @@ -# Logs -logs -*.log - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directory -# Commenting this out is preferred by some people, see -# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- -node_modules - -# Users Environment Variables -.lock-wscript diff --git a/node_modules/umask/ChangeLog b/node_modules/umask/ChangeLog deleted file mode 100644 index 1254674513b6f..0000000000000 --- a/node_modules/umask/ChangeLog +++ /dev/null @@ -1,9 +0,0 @@ -2015-01-15 Sam Mikes - - * index.js: (convert_fromString) accept decimal strings provided they - don't begin with '0' - -2015-01-14 Sam Mikes - - * index.js: initial rev - diff --git a/node_modules/umask/LICENSE b/node_modules/umask/LICENSE deleted file mode 100644 index e637724b3bc59..0000000000000 --- a/node_modules/umask/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Sam Mikes - -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. - diff --git a/node_modules/umask/README.md b/node_modules/umask/README.md deleted file mode 100644 index 80009ae709b2c..0000000000000 --- a/node_modules/umask/README.md +++ /dev/null @@ -1,78 +0,0 @@ -# umask - -Convert umask from string <-> number. - -## Installation & Use - -``` -$ npm install -S umask - -var umask = require('umask'); - -console.log(umask.toString(18)); // 0022 - -console.log(umask.fromString('0777')) // 511 -``` - -## API - -### `toString( val )` - -Converts `val` to a 0-padded octal string. `val` is assumed to be a -Number in the correct range (0..511) - -### `fromString( val, [cb] )` - -Converts `val` to a Number that can be used as a umask. `val` can -be of the following forms: - - * String containing octal number (leading 0) - * String containing decimal number - * Number - -In all cases above, the value obtained is then converted to an integer and -checked against the legal `umask` range 0..511 - -`fromString` can be used as a simple converter, with no error feedback, by -omitting the optional callback argument `cb`: - -``` - var mask = umask.fromString(val); - - // mask is now the umask descibed by val or - // the default, 0022 (18 dec) -``` - -The callback arguments are `(err, val)` where `err` is either `null` or an -Error object and `val` is either the converted umask or the default umask, `0022`. - -``` - umask.fromString(val, function (err, val) { - if (err) { - console.error("invalid umask: " + err.message) - } - - /* do something with val */ - }); -``` - -The callback, if provided, is always called **synchronously**. - -### `validate( data, k, val )` - -This is a validation function of the form expected by `nopt`. If -`val` is a valid umask, the function returns true and sets `data[k]`. -If `val` is not a valid umask, the function returns false. - -The `validate` function is stricter than `fromString`: it only accepts -Number or octal String values, and the String value must begin with `0`. -The `validate` function does **not** accept Strings containing decimal -numbers. - -# Maintainer - -Sam Mikes - -# License - -MIT \ No newline at end of file diff --git a/node_modules/umask/index.js b/node_modules/umask/index.js deleted file mode 100644 index 501c0e0c05cb5..0000000000000 --- a/node_modules/umask/index.js +++ /dev/null @@ -1,77 +0,0 @@ -'use strict'; - -var util = require("util"); - -function toString(val) { - val = val.toString(8); - while (val.length < 4) { - val = "0" + val; - } - return val; -} - -var defaultUmask = 18; // 0022; -var defaultUmaskString = toString(defaultUmask); - -function validate(data, k, val) { - // must be either an integer or an octal string. - if (typeof val === "number" && !isNaN(val)) { - data[k] = val; - return true; - } - - if (typeof val === "string") { - if (val.charAt(0) !== "0") { - return false; - } - data[k] = parseInt(val, 8); - return true; - } - - return false; -} - -function convert_fromString(val, cb) { - if (typeof val === "string") { - // check for octal string first - if (val.charAt(0) === '0' && /^[0-7]+$/.test(val)) { - val = parseInt(val, 8); - } else if (val.charAt(0) !== '0' && /^[0-9]+$/.test(val)) { - // legacy support for decimal strings - val = parseInt(val, 10); - } else { - return cb(new Error(util.format("Expected octal string, got %j, defaulting to %j", - val, defaultUmaskString)), - defaultUmask); - } - } else if (typeof val !== "number") { - return cb(new Error(util.format("Expected number or octal string, got %j, defaulting to %j", - val, defaultUmaskString)), - defaultUmask); - } - - val = Math.floor(val); - - if ((val < 0) || (val > 511)) { - return cb(new Error(util.format("Must be in range 0..511 (0000..0777), got %j", val)), - defaultUmask); - } - - cb(null, val); -} - -function fromString(val, cb) { - - // synchronous callback, no zalgo - convert_fromString(val, cb || function (err, result) { - /*jslint unparam:true*/ - val = result; - }); - - return val; -} - -exports.toString = toString; -exports.fromString = fromString; -exports.validate = validate; - diff --git a/node_modules/umask/package.json b/node_modules/umask/package.json deleted file mode 100644 index a59835a0b5d02..0000000000000 --- a/node_modules/umask/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "umask", - "version": "1.1.0", - "description": "convert umask from string <-> number", - "main": "index.js", - "scripts": { - "test": "lab -ct 100", - "lint": "jslint --terse --latest *.js test/*.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/smikes/umask.git" - }, - "keywords": [ - "umask" - ], - "author": "Sam Mikes ", - "license": "MIT", - "bugs": { - "url": "https://github.com/smikes/umask/issues" - }, - "homepage": "https://github.com/smikes/umask", - "devDependencies": { - "code": "^1.2.1", - "jslint": "^0.7.2", - "lab": "^5.2.0" - } -} diff --git a/node_modules/umask/test/simple.js b/node_modules/umask/test/simple.js deleted file mode 100644 index 8f29ae745a47f..0000000000000 --- a/node_modules/umask/test/simple.js +++ /dev/null @@ -1,166 +0,0 @@ -'use strict'; - -var umask = require('..'); - -var Code = require('code'); -var Lab = require('lab'); -var lab = Lab.script(); -exports.lab = lab; - -var describe = lab.describe; -var it = lab.it; -var expect = Code.expect; - -describe('validates umask', function () { - // signature of validator: validate(obj, key, val) - // store valid value in obj[key] - // return false if invalid - - it('accepts numbers', function (done) { - var o = {}, - result = false; - - result = umask.validate(o, 'umask', 0); - expect(result).to.equal(true); - expect(o.umask).to.equal(0); - - result = umask.validate(o, 'umask', 511); - expect(result).to.equal(true); - expect(o.umask).to.equal(511); - done(); - }); - - it('accepts strings', function (done) { - var o = {}, - result; - - result = umask.validate(o, 'umask', "0"); - expect(result).to.equal(true); - expect(o.umask).to.equal(0); - - result = umask.validate(o, 'umask', "0777"); - expect(result).to.equal(true); - expect(o.umask).to.equal(511); - - done(); - }); - - it('rejects other types', function (done) { - expect(umask.validate(undefined, undefined, false)).to.equal(false); - expect(umask.validate(undefined, undefined, {})).to.equal(false); - - done(); - }); - - it('rejects non-octalish strings', function (done) { - expect(umask.validate(undefined, undefined, "1")).to.equal(false); - - done(); - }); - - it('rejects NaN strings', function (done) { - expect(umask.validate(undefined, undefined, NaN)).to.equal(false); - - done(); - }); -}); - -describe('umask to string', function () { - it("converts umask to string", function (done) { - expect(umask.toString(0)).to.equal("0000"); - expect(umask.toString(1)).to.equal("0001"); - expect(umask.toString(7)).to.equal("0007"); - expect(umask.toString(8)).to.equal("0010"); - expect(umask.toString(511)).to.equal("0777"); - expect(umask.toString(18)).to.equal("0022"); - expect(umask.toString(16)).to.equal("0020"); - done(); - }); -}); - -describe('umask from string', function () { - it('converts valid values', function (done) { - expect(umask.fromString("0000")).to.equal(0); - expect(umask.fromString("0")).to.equal(0); - expect(umask.fromString("0777")).to.equal(511); - expect(umask.fromString("0024")).to.equal(20); - - expect(umask.fromString(0)).to.equal(0); - expect(umask.fromString(20)).to.equal(20); - expect(umask.fromString(21)).to.equal(21); - expect(umask.fromString(511)).to.equal(511); - - done(); - }); - - it('converts valid values', function (done) { - expect(umask.fromString("0000")).to.equal(0); - expect(umask.fromString("0")).to.equal(0); - expect(umask.fromString("010")).to.equal(8); - expect(umask.fromString("0777")).to.equal(511); - expect(umask.fromString("0024")).to.equal(20); - - expect(umask.fromString("8")).to.equal(8); - expect(umask.fromString("9")).to.equal(9); - expect(umask.fromString("18")).to.equal(18); - expect(umask.fromString("16")).to.equal(16); - - expect(umask.fromString(0)).to.equal(0); - expect(umask.fromString(20)).to.equal(20); - expect(umask.fromString(21)).to.equal(21); - expect(umask.fromString(511)).to.equal(511); - - expect(umask.fromString(0.1)).to.equal(0); - expect(umask.fromString(511.1)).to.equal(511); - - done(); - }); - - it('errors on empty string', function (done) { - umask.fromString("", function (err, val) { - expect(err.message).to.equal('Expected octal string, got "", defaulting to "0022"'); - expect(val).to.equal(18); - done(); - }); - }); - - it('errors on invalid octal string', function (done) { - umask.fromString("099", function (err, val) { - expect(err.message).to.equal('Expected octal string, got "099", defaulting to "0022"'); - expect(val).to.equal(18); - done(); - }); - }); - - it('errors when non-string, non-number (boolean)', function (done) { - umask.fromString(false, function (err, val) { - expect(err.message).to.equal('Expected number or octal string, got false, defaulting to "0022"'); - expect(val).to.equal(18); - done(); - }); - }); - - it('errors when non-string, non-number (object)', function (done) { - umask.fromString({}, function (err, val) { - expect(err.message).to.equal('Expected number or octal string, got {}, defaulting to "0022"'); - expect(val).to.equal(18); - done(); - }); - }); - - it('errors when out of range (<0)', function (done) { - umask.fromString(-1, function (err, val) { - expect(err.message).to.equal('Must be in range 0..511 (0000..0777), got -1'); - expect(val).to.equal(18); - done(); - }); - }); - - it('errors when out of range (>511)', function (done) { - umask.fromString(512, function (err, val) { - expect(err.message).to.equal('Must be in range 0..511 (0000..0777), got 512'); - expect(val).to.equal(18); - done(); - }); - }); -}); diff --git a/package-lock.json b/package-lock.json index 8b42fe9d0fdf7..ef61f907bdb5b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -78,7 +78,6 @@ "tar", "text-table", "tiny-relative-date", - "umask", "uuid", "validate-npm-package-name", "which", @@ -156,7 +155,6 @@ "tar": "^6.0.5", "text-table": "~0.2.0", "tiny-relative-date": "^1.3.0", - "umask": "~1.1.0", "uuid": "^8.3.0", "validate-npm-package-name": "~3.0.0", "which": "^2.0.2", @@ -7920,12 +7918,6 @@ "node": ">=4.2.0" } }, - "node_modules/umask": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/umask/-/umask-1.1.0.tgz", - "integrity": "sha1-8pzr8B31F5ErtY/5xOUP3o4zMg0=", - "inBundle": true - }, "node_modules/unicode-length": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/unicode-length/-/unicode-length-2.0.2.tgz", @@ -14266,11 +14258,6 @@ "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==", "dev": true }, - "umask": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/umask/-/umask-1.1.0.tgz", - "integrity": "sha1-8pzr8B31F5ErtY/5xOUP3o4zMg0=" - }, "unicode-length": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/unicode-length/-/unicode-length-2.0.2.tgz", diff --git a/package.json b/package.json index 9e01314557199..75ce52d467abc 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,6 @@ "tar": "^6.0.5", "text-table": "~0.2.0", "tiny-relative-date": "^1.3.0", - "umask": "~1.1.0", "uuid": "^8.3.0", "validate-npm-package-name": "~3.0.0", "which": "^2.0.2", @@ -189,7 +188,6 @@ "tar", "text-table", "tiny-relative-date", - "umask", "uuid", "validate-npm-package-name", "which",