Initial commit
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
6
.prettierrc
Normal file
6
.prettierrc
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"trailingComma": "es5",
|
||||||
|
"tabWidth": 2,
|
||||||
|
"semi": true,
|
||||||
|
"singleQuote": true
|
||||||
|
}
|
||||||
1
lib/index.d.ts
vendored
Normal file
1
lib/index.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export declare const getCLIArguments: () => void;
|
||||||
8
lib/index.js
Normal file
8
lib/index.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.getCLIArguments = void 0;
|
||||||
|
var getCLIArguments = function () {
|
||||||
|
console.log(process.argv);
|
||||||
|
};
|
||||||
|
exports.getCLIArguments = getCLIArguments;
|
||||||
|
(0, exports.getCLIArguments)();
|
||||||
20
package-lock.json
generated
Normal file
20
package-lock.json
generated
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "utils",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"lockfileVersion": 1,
|
||||||
|
"requires": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@types/node": {
|
||||||
|
"version": "17.0.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.18.tgz",
|
||||||
|
"integrity": "sha512-eKj4f/BsN/qcculZiRSujogjvp5O/k4lOW5m35NopjZM/QwLOR075a8pJW5hD+Rtdm2DaCVPENS6KtSQnUD6BA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"typescript": {
|
||||||
|
"version": "4.5.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz",
|
||||||
|
"integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
package.json
Normal file
30
package.json
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"name": "utils",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "Utility package for easier development",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc",
|
||||||
|
"start": "tsc && node lib/index.js",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/rdarius/utils.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"utils",
|
||||||
|
"utility",
|
||||||
|
"utilities"
|
||||||
|
],
|
||||||
|
"author": "Darius Rapalis",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/rdarius/utils/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/rdarius/utils#readme",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^17.0.18",
|
||||||
|
"typescript": "^4.5.5"
|
||||||
|
}
|
||||||
|
}
|
||||||
19
src/index.ts
Normal file
19
src/index.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
export const getCLIArguments = () => {
|
||||||
|
|
||||||
|
const args = {};
|
||||||
|
|
||||||
|
for(let arg of process.argv) {
|
||||||
|
if (arg.startsWith('-')) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const createParamIfDoesNotExist = (object: Object, param: string, expectedType: "array" | "object") => {
|
||||||
|
if (object.hasOwnProperty(param)) {
|
||||||
|
// object[param] = expectedType === 'array' ? [] : {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getCLIArguments();
|
||||||
11
tsconfig.json
Normal file
11
tsconfig.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es5",
|
||||||
|
"module": "commonjs",
|
||||||
|
"declaration": true,
|
||||||
|
"outDir": "./lib",
|
||||||
|
"strict": true
|
||||||
|
},
|
||||||
|
"include": ["src"],
|
||||||
|
"exclude": ["node_modules", "**/__tests__/*"]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user