parse-strings-in-object
Advanced tools
Comparing version 1.3.3 to 1.3.4
@@ -59,4 +59,4 @@ "use strict"; | ||
}; | ||
const arrayLikeStringToArray = (s, token = ",") => s.split(token); | ||
const arrayLikeStringToArray = (s, token = ",") => s.split(token).map(element => element.trim()); | ||
module.exports = parseKeys; | ||
//# sourceMappingURL=index.js.map |
@@ -176,3 +176,17 @@ "use strict"; | ||
}); | ||
test("array of paths", () => { | ||
const before = { somePaths: "index.ts, ./some-relative-path/some_File.txt, ../../hello.world.txt,one.json,./two.json" }; | ||
const result = _1.default(before); | ||
expect(Array.isArray(result.somePaths)).toBeTruthy(); | ||
expect(typeof result.somePaths).toBe("object"); | ||
expect(result.somePaths.length).toEqual(5); | ||
expect(result).toEqual({ somePaths: [ | ||
"index.ts", | ||
"./some-relative-path/some_File.txt", | ||
"../../hello.world.txt", | ||
"one.json", | ||
"./two.json" | ||
] }); | ||
}); | ||
}); | ||
//# sourceMappingURL=index.test.js.map |
{ | ||
"name": "parse-strings-in-object", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"description": "Convert string values in object to boolean and numbers", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -187,3 +187,19 @@ import parser from "./"; | ||
}); | ||
test("array of paths", () => { | ||
const before = { somePaths: "index.ts, ./some-relative-path/some_File.txt, ../../hello.world.txt,one.json,./two.json" }; | ||
const result = parser(before) as { somePaths: string[] }; | ||
expect(Array.isArray(result.somePaths)).toBeTruthy(); | ||
expect(typeof result.somePaths).toBe("object"); | ||
expect(result.somePaths.length).toEqual(5); | ||
expect(result).toEqual({ somePaths: [ | ||
"index.ts", | ||
"./some-relative-path/some_File.txt", | ||
"../../hello.world.txt", | ||
"one.json", | ||
"./two.json" | ||
]}) | ||
}) | ||
}) |
@@ -68,4 +68,4 @@ const parseKeys = <T>(obj: object): T => | ||
const arrayLikeStringToArray = (s: string, token: string = ",") => | ||
s.split(token); | ||
s.split(token).map(element => element.trim()); | ||
export = parseKeys; |
Sorry, the diff of this file is not supported yet
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
31240
561