Skip to content

Commit 27c3eaa

Browse files
committed
Update UPI QR code generation logic and bump version to 1.3.20
1 parent 29fcc81 commit 27c3eaa

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "upiqr",
3-
"version": "1.3.19",
3+
"version": "1.3.20",
44
"description": "Generate NPCI's UPI QR code along with UPI intent link, By using it any payment is possible from UPI enabled apps.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ export default function upiqr ({
3535

3636
// IIFE: builds and returns the UPI intent URL by given params.
3737
const intent = ((params: object): string => {
38-
const urlParams = new URLSearchParams()
39-
for (const [key, value] of Object.entries(params)) {
40-
if (value)
41-
urlParams.append(key, value as string)
42-
}
38+
const urlParams = new URLSearchParams(Object.entries(params).filter(([_, value]) => value))
4339
return `upi://pay?${urlParams.toString()}`
4440
})(params);
4541

0 commit comments

Comments
 (0)