Clean up the oopsie. Rebuild the blank exercises.

This commit is contained in:
Michael Frank
2021-05-09 00:39:21 +12:00
parent b984cb4c6f
commit d28d80c46f
1565 changed files with 27186 additions and 199003 deletions
+5 -7
View File
@@ -1,10 +1,8 @@
'use strict';
module.exports = function (flag, argv) {
argv = argv || process.argv;
var terminatorPos = argv.indexOf('--');
var prefix = /^-{1,2}/.test(flag) ? '' : '--';
var pos = argv.indexOf(prefix + flag);
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
module.exports = (flag, argv = process.argv) => {
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
const position = argv.indexOf(prefix + flag);
const terminatorPosition = argv.indexOf('--');
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
};
+4 -16
View File
@@ -1,21 +1,9 @@
The MIT License (MIT)
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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:
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 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.
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.
+20 -34
View File
@@ -1,27 +1,28 @@
{
"_from": "has-flag@^2.0.0",
"_id": "has-flag@2.0.0",
"_from": "has-flag@^4.0.0",
"_id": "has-flag@4.0.0",
"_inBundle": false,
"_integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
"_integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"_location": "/has-flag",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "has-flag@^2.0.0",
"raw": "has-flag@^4.0.0",
"name": "has-flag",
"escapedName": "has-flag",
"rawSpec": "^2.0.0",
"rawSpec": "^4.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
"fetchSpec": "^4.0.0"
},
"_requiredBy": [
"/chalk/supports-color"
"/supports-color",
"/supports-hyperlinks"
],
"_resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
"_shasum": "e8207af1cc7b30d446cc70b734b5e8be18f88d51",
"_spec": "has-flag@^2.0.0",
"_where": "/Users/cloyd/coderrr/odin/javascript-exercises/node_modules/chalk/node_modules/supports-color",
"_resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"_shasum": "944771fd9c81c81265c4d6941860da06bb59479b",
"_spec": "has-flag@^4.0.0",
"_where": "/home/michael/projects/javascript-exercises/node_modules/supports-color",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
@@ -34,14 +35,16 @@
"deprecated": false,
"description": "Check if argv has a specific flag",
"devDependencies": {
"ava": "*",
"xo": "*"
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
},
"engines": {
"node": ">=0.10.0"
"node": ">=8"
},
"files": [
"index.js"
"index.js",
"index.d.ts"
],
"homepage": "https://github.com/sindresorhus/has-flag#readme",
"keywords": [
@@ -64,30 +67,13 @@
"optimist"
],
"license": "MIT",
"maintainers": [
{
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
{
"name": "Joshua Appelman",
"email": "jappelman@xebia.com",
"url": "jbnicolai.com"
},
{
"name": "JD Ballard",
"email": "i.am.qix@gmail.com",
"url": "github.com/qix-"
}
],
"name": "has-flag",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/has-flag.git"
},
"scripts": {
"test": "xo && ava"
"test": "xo && ava && tsd"
},
"version": "2.0.0"
"version": "4.0.0"
}
+25 -3
View File
@@ -4,11 +4,25 @@
Correctly stops looking after an `--` argument terminator.
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-has-flag?utm_source=npm-has-flag&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>
---
## Install
```
$ npm install --save has-flag
$ npm install has-flag
```
@@ -24,6 +38,9 @@ hasFlag('unicorn');
hasFlag('--unicorn');
//=> true
hasFlag('f');
//=> true
hasFlag('-f');
//=> true
@@ -46,7 +63,7 @@ $ node foo.js -f --unicorn --foo=bar -- --rainbow
### hasFlag(flag, [argv])
Returns a boolean whether the flag exists.
Returns a boolean for whether the flag exists.
#### flag
@@ -56,12 +73,17 @@ CLI flag to look for. The `--` prefix is optional.
#### argv
Type: `array`<br>
Type: `string[]`<br>
Default: `process.argv`
CLI arguments.
## Security
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)