Skip to content
This repository was archived by the owner on Jul 7, 2021. It is now read-only.

Commit 331bdf4

Browse files
committed
feature: isVIP function
Also went ahead and enabled incremental compilation for the TypeScript compiler which should decrease compile times as the size of the package increases.
1 parent 9aaff48 commit 331bdf4

10 files changed

+215
-26
lines changed

lib/index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export declare function add(a: number, b: number): number;
1+
export declare function isVIP(username: string): Promise<boolean>;
22
//# sourceMappingURL=index.d.ts.map

lib/index.d.ts.map

+1-1
Original file line numberDiff line numberDiff line change

lib/index.js

+55-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
"npm": ">= 6.14.10",
3131
"yarn": ">= 1.22.10"
3232
},
33+
"dependencies": {
34+
"request": "^2.88.2",
35+
"axios": "^0.21.1",
36+
"cheerio": "^1.0.0-rc.5"
37+
},
3338
"devDependencies": {
3439
"@commitlint/cli": "^12.0.1",
3540
"@commitlint/config-conventional": "^12.0.1",

src/index.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
export function add(a: number, b: number) {
2-
return a + b;
1+
import axios from 'axios';
2+
3+
export async function isVIP(username: string): Promise<boolean> {
4+
return await axios
5+
.get(`http://www-dynamic.us.worlds.net/cgi-bin/vip.pl?Username=${username}`)
6+
.then((response) =>
7+
response.data.toString().includes("You're already a VIP!"))
38
}

test/index.js

-8
This file was deleted.

test/index.spec.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const assert = require('assert');
2+
const { isVIP } = require('../lib/index.js');
3+
4+
describe('functions', () => {
5+
it('should return false', async () => {
6+
assert.strictEqual(await isVIP("fuwn"), false);
7+
});
8+
});

tsconfig.json

+11-9
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
33
/* Visit https://aka.ms/tsconfig.json to read more about this file */
44

55
/* Basic Options */
6-
// "incremental": true, /* Enable incremental compilation */
6+
"incremental": true, /* Enable incremental compilation */
77
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
88
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
9-
// "lib": [], /* Specify library files to be included in the compilation. */
9+
"lib": [
10+
"ES2015"
11+
], /* Specify library files to be included in the compilation. */
1012
// "allowJs": true, /* Allow javascript files to be compiled. */
1113
// "checkJs": true, /* Report errors in .js files. */
1214
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
13-
"declaration": true, /* Generates corresponding '.d.ts' file. */
14-
"declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
15-
"sourceMap": true, /* Generates corresponding '.map' file. */
15+
"declaration": true, /* Generates corresponding '.d.ts' file. */
16+
"declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
17+
"sourceMap": true, /* Generates corresponding '.map' file. */
1618
// "outFile": "./", /* Concatenate and emit output to single file. */
17-
"outDir": "lib", /* Redirect output structure to the directory. */
19+
"outDir": "lib", /* Redirect output structure to the directory. */
1820
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
1921
// "composite": true, /* Enable project compilation */
2022
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
@@ -26,12 +28,12 @@
2628

2729
/* Strict Type-Checking Options */
2830
"strict": true, /* Enable all strict type-checking options. */
29-
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
31+
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
3032
// "strictNullChecks": true, /* Enable strict null checks. */
31-
"strictFunctionTypes": true, /* Enable strict checking of function types. */
33+
"strictFunctionTypes": true, /* Enable strict checking of function types. */
3234
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
3335
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
34-
"noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
36+
"noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
3537
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
3638

3739
/* Additional Checks */

yarn.lock

+126
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,13 @@ aws4@^1.8.0:
561561
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59"
562562
integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==
563563

564+
axios@^0.21.1:
565+
version "0.21.1"
566+
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
567+
integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
568+
dependencies:
569+
follow-redirects "^1.10.0"
570+
564571
balanced-match@^1.0.0:
565572
version "1.0.0"
566573
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
@@ -578,6 +585,11 @@ binary-extensions@^2.0.0:
578585
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d"
579586
integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==
580587

588+
boolbase@^1.0.0:
589+
version "1.0.0"
590+
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
591+
integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24=
592+
581593
brace-expansion@^1.1.7:
582594
version "1.1.11"
583595
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
@@ -696,6 +708,30 @@ chalk@^4.0.0, chalk@^4.1.0:
696708
ansi-styles "^4.1.0"
697709
supports-color "^7.1.0"
698710

711+
cheerio-select-tmp@^0.1.0:
712+
version "0.1.1"
713+
resolved "https://registry.yarnpkg.com/cheerio-select-tmp/-/cheerio-select-tmp-0.1.1.tgz#55bbef02a4771710195ad736d5e346763ca4e646"
714+
integrity sha512-YYs5JvbpU19VYJyj+F7oYrIE2BOll1/hRU7rEy/5+v9BzkSo3bK81iAeeQEMI92vRIxz677m72UmJUiVwwgjfQ==
715+
dependencies:
716+
css-select "^3.1.2"
717+
css-what "^4.0.0"
718+
domelementtype "^2.1.0"
719+
domhandler "^4.0.0"
720+
domutils "^2.4.4"
721+
722+
cheerio@^1.0.0-rc.5:
723+
version "1.0.0-rc.5"
724+
resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.5.tgz#88907e1828674e8f9fee375188b27dadd4f0fa2f"
725+
integrity sha512-yoqps/VCaZgN4pfXtenwHROTp8NG6/Hlt4Jpz2FEP0ZJQ+ZUkVDd0hAPDNKhj3nakpfPt/CNs57yEtxD1bXQiw==
726+
dependencies:
727+
cheerio-select-tmp "^0.1.0"
728+
dom-serializer "~1.2.0"
729+
domhandler "^4.0.0"
730+
entities "~2.1.0"
731+
htmlparser2 "^6.0.0"
732+
parse5 "^6.0.0"
733+
parse5-htmlparser2-tree-adapter "^6.0.0"
734+
699735
700736
version "3.5.1"
701737
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.1.tgz#ee9ce7bbebd2b79f49f304799d5468e31e14e68a"
@@ -1027,6 +1063,22 @@ cross-spawn@^7.0.0, cross-spawn@^7.0.2:
10271063
shebang-command "^2.0.0"
10281064
which "^2.0.1"
10291065

1066+
css-select@^3.1.2:
1067+
version "3.1.2"
1068+
resolved "https://registry.yarnpkg.com/css-select/-/css-select-3.1.2.tgz#d52cbdc6fee379fba97fb0d3925abbd18af2d9d8"
1069+
integrity sha512-qmss1EihSuBNWNNhHjxzxSfJoFBM/lERB/Q4EnsJQQC62R2evJDW481091oAdOr9uh46/0n4nrg0It5cAnj1RA==
1070+
dependencies:
1071+
boolbase "^1.0.0"
1072+
css-what "^4.0.0"
1073+
domhandler "^4.0.0"
1074+
domutils "^2.4.3"
1075+
nth-check "^2.0.0"
1076+
1077+
css-what@^4.0.0:
1078+
version "4.0.0"
1079+
resolved "https://registry.yarnpkg.com/css-what/-/css-what-4.0.0.tgz#35e73761cab2eeb3d3661126b23d7aa0e8432233"
1080+
integrity sha512-teijzG7kwYfNVsUh2H/YN62xW3KK9YhXEgSlbxMlcyjPNvdKJqFx5lrwlJgoFP1ZHlB89iGDlo/JyshKeRhv5A==
1081+
10301082
currently-unhandled@^0.4.1:
10311083
version "0.4.1"
10321084
resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea"
@@ -1120,6 +1172,36 @@ doctrine@^3.0.0:
11201172
dependencies:
11211173
esutils "^2.0.2"
11221174

1175+
dom-serializer@^1.0.1, dom-serializer@~1.2.0:
1176+
version "1.2.0"
1177+
resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-1.2.0.tgz#3433d9136aeb3c627981daa385fc7f32d27c48f1"
1178+
integrity sha512-n6kZFH/KlCrqs/1GHMOd5i2fd/beQHuehKdWvNNffbGHTr/almdhuVvTVFb3V7fglz+nC50fFusu3lY33h12pA==
1179+
dependencies:
1180+
domelementtype "^2.0.1"
1181+
domhandler "^4.0.0"
1182+
entities "^2.0.0"
1183+
1184+
domelementtype@^2.0.1, domelementtype@^2.1.0:
1185+
version "2.1.0"
1186+
resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.1.0.tgz#a851c080a6d1c3d94344aed151d99f669edf585e"
1187+
integrity sha512-LsTgx/L5VpD+Q8lmsXSHW2WpA+eBlZ9HPf3erD1IoPF00/3JKHZ3BknUVA2QGDNu69ZNmyFmCWBSO45XjYKC5w==
1188+
1189+
domhandler@^4.0.0:
1190+
version "4.0.0"
1191+
resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-4.0.0.tgz#01ea7821de996d85f69029e81fa873c21833098e"
1192+
integrity sha512-KPTbnGQ1JeEMQyO1iYXoagsI6so/C96HZiFyByU3T6iAzpXn8EGEvct6unm1ZGoed8ByO2oirxgwxBmqKF9haA==
1193+
dependencies:
1194+
domelementtype "^2.1.0"
1195+
1196+
domutils@^2.4.3, domutils@^2.4.4:
1197+
version "2.5.0"
1198+
resolved "https://registry.yarnpkg.com/domutils/-/domutils-2.5.0.tgz#42f49cffdabb92ad243278b331fd761c1c2d3039"
1199+
integrity sha512-Ho16rzNMOFk2fPwChGh3D2D9OEHAfG19HgmRR2l+WLSsIstNsAYBzePH412bL0y5T44ejABIVfTHQ8nqi/tBCg==
1200+
dependencies:
1201+
dom-serializer "^1.0.1"
1202+
domelementtype "^2.0.1"
1203+
domhandler "^4.0.0"
1204+
11231205
dot-prop@^5.1.0:
11241206
version "5.3.0"
11251207
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.3.0.tgz#90ccce708cd9cd82cc4dc8c3ddd9abdd55b20e88"
@@ -1167,6 +1249,16 @@ enquirer@^2.3.5, enquirer@^2.3.6:
11671249
dependencies:
11681250
ansi-colors "^4.1.1"
11691251

1252+
entities@^2.0.0:
1253+
version "2.2.0"
1254+
resolved "https://registry.yarnpkg.com/entities/-/entities-2.2.0.tgz#098dc90ebb83d8dffa089d55256b351d34c4da55"
1255+
integrity sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==
1256+
1257+
entities@~2.1.0:
1258+
version "2.1.0"
1259+
resolved "https://registry.yarnpkg.com/entities/-/entities-2.1.0.tgz#992d3129cf7df6870b96c57858c249a120f8b8b5"
1260+
integrity sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==
1261+
11701262
error-ex@^1.2.0, error-ex@^1.3.1:
11711263
version "1.3.2"
11721264
resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf"
@@ -1448,6 +1540,11 @@ flatted@^3.1.0:
14481540
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.1.1.tgz#c4b489e80096d9df1dfc97c79871aea7c617c469"
14491541
integrity sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==
14501542

1543+
follow-redirects@^1.10.0:
1544+
version "1.13.3"
1545+
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.3.tgz#e5598ad50174c1bc4e872301e82ac2cd97f90267"
1546+
integrity sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA==
1547+
14511548
foreground-child@^2.0.0:
14521549
version "2.0.0"
14531550
resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-2.0.0.tgz#71b32800c9f15aa8f2f83f4a6bd9bff35d861a53"
@@ -1747,6 +1844,16 @@ html-escaper@^2.0.0:
17471844
resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453"
17481845
integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==
17491846

1847+
htmlparser2@^6.0.0:
1848+
version "6.0.1"
1849+
resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-6.0.1.tgz#422521231ef6d42e56bd411da8ba40aa36e91446"
1850+
integrity sha512-GDKPd+vk4jvSuvCbyuzx/unmXkk090Azec7LovXP8as1Hn8q9p3hbjmDGbUqqhknw0ajwit6LiiWqfiTUPMK7w==
1851+
dependencies:
1852+
domelementtype "^2.0.1"
1853+
domhandler "^4.0.0"
1854+
domutils "^2.4.4"
1855+
entities "^2.0.0"
1856+
17501857
http-signature@~1.2.0:
17511858
version "1.2.0"
17521859
resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1"
@@ -2512,6 +2619,13 @@ npm-run-path@^4.0.0:
25122619
dependencies:
25132620
path-key "^3.0.0"
25142621

2622+
nth-check@^2.0.0:
2623+
version "2.0.0"
2624+
resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-2.0.0.tgz#1bb4f6dac70072fc313e8c9cd1417b5074c0a125"
2625+
integrity sha512-i4sc/Kj8htBrAiH1viZ0TgU8Y5XqCaV/FziYK6TBczxmeKm3AEFWqqF3195yKudrarqy7Zu80Ra5dobFjn9X/Q==
2626+
dependencies:
2627+
boolbase "^1.0.0"
2628+
25152629
null-check@^1.0.0:
25162630
version "1.0.0"
25172631
resolved "https://registry.yarnpkg.com/null-check/-/null-check-1.0.0.tgz#977dffd7176012b9ec30d2a39db5cf72a0439edd"
@@ -2706,6 +2820,18 @@ parse-json@^5.0.0:
27062820
json-parse-even-better-errors "^2.3.0"
27072821
lines-and-columns "^1.1.6"
27082822

2823+
parse5-htmlparser2-tree-adapter@^6.0.0:
2824+
version "6.0.1"
2825+
resolved "https://registry.yarnpkg.com/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz#2cdf9ad823321140370d4dbf5d3e92c7c8ddc6e6"
2826+
integrity sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==
2827+
dependencies:
2828+
parse5 "^6.0.1"
2829+
2830+
parse5@^6.0.0, parse5@^6.0.1:
2831+
version "6.0.1"
2832+
resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b"
2833+
integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==
2834+
27092835
path-exists@^2.0.0:
27102836
version "2.1.0"
27112837
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b"

0 commit comments

Comments
 (0)