Skip to content

Commit 4fa0a03

Browse files
Readme update
1 parent 26b16c3 commit 4fa0a03

File tree

4 files changed

+53
-5
lines changed

4 files changed

+53
-5
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2022
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# param-validator
2+
Missing parameter library for node.js
3+
4+
- [Installation](#installation)
5+
- [Documentation](#documentation)
6+
- [Changelog](#changelog)
7+
- [License](#license)
8+
9+
## Installation
10+
11+
```
12+
npm install param-validator
13+
```
14+
15+
Also make sure that you have Node.js 8 or newer in order to use it.
16+
17+
18+
19+
## License
20+
21+
MIT License

package.json

+10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
{
2+
"name": "param-validator",
3+
"description": "parameter validator module.",
4+
"author": "vinod khetade",
5+
"version": "1.0.0",
6+
"license": "MIT",
7+
"repository": {
8+
"type": "git",
9+
"url": "git://github.com/vinodnextcoder/param-validator.git"
10+
},
211
"scripts": {
312
"start": "ts-node ./src/index.ts",
413
"test": "jest --config jestconfig.json",
14+
"test:coverage": "jest --coverage --config jestconfig.json",
515
"build": "tsc",
616
"format": "prettier --write \"src/**/*.ts\" ",
717
"lint": "tslint -p tsconfig.json"

src/index.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,10 @@ const hasOwnProperty = Object.prototype.hasOwnProperty;
99
* @param obj {object} object
1010
* @param keyList {array} array of object key
1111
*/
12-
export function findMissingKeyInObject(obj: { [x: string]: string }, keyList: any) {
12+
export function findMissingKeyInObject(obj: any, keyList: any) {
1313
const missingKeys: any[] = [];
1414
if (keyList && keyList.length > 0) {
1515
keyList.forEach((key: any) => {
16-
if (typeof obj[key] === 'string') {
17-
obj[key] = obj[key].trim();
18-
}
19-
2016
if (!hasOwnProperty.call(obj, key) || obj[key] === null || obj[key] === '') missingKeys.push(key);
2117
});
2218
}

0 commit comments

Comments
 (0)