Comparing version 0.2.0 to 0.2.1
@@ -6,3 +6,3 @@ "use strict"; | ||
.reduce(function (acc, k) { | ||
return obj[k] != null ? acc.concat([k + "=" + obj[k]]) : acc; | ||
return obj[k] != null ? acc.concat([k + "=" + encodeURIComponent(obj[k])]) : acc; | ||
}, []) | ||
@@ -9,0 +9,0 @@ .join("&"); |
{ | ||
"name": "nomics", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -24,1 +24,9 @@ import { objToUrlParams } from "./url"; | ||
}); | ||
test("encodes url values", () => { | ||
expect( | ||
objToUrlParams({ | ||
test: "tS+o&" | ||
}) | ||
).toBe("test=tS%2Bo%26"); | ||
}); |
@@ -5,5 +5,5 @@ export const objToUrlParams = (obj: any): string => | ||
(acc: string[], k: string): string[] => | ||
obj[k] != null ? [...acc, `${k}=${obj[k]}`] : acc, | ||
obj[k] != null ? [...acc, `${k}=${encodeURIComponent(obj[k])}`] : acc, | ||
[] | ||
) | ||
.join("&"); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
172396
489