zerde 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,27 +3,31 @@
3
3
  Typescript library for parsing and stringifying combined with schema validationg
4
4
 
5
5
  When stringifying or parsing an object, you want to verify that what you are stringifying or parsing matches a schema.
6
+
6
7
  This is the overall workflow:
8
+
7
9
  Parsing: stringifiedContent -> parse -> SomeObject
10
+
8
11
  Stringifying: SomeObject -> stringify -> stringifiedContent
9
12
 
10
13
  However, all type safety is lost during these steps (especially during the parse step)
11
14
 
12
15
  The desired workflow:
13
16
 
14
- Parsing: stringifiedContent<SomeType> -> parse -> Unknown -> validateIsSomeType -> SomeType
15
- Stringifying: SomeType -> validateIsSomeType -> stringify -> stringifiedContent<SomeType>
17
+ Parsing: stringifiedContent\<SomeType\> -> parse -> Unknown -> validateIsSomeType -> SomeType
18
+
19
+ Stringifying: SomeType -> validateIsSomeType -> stringify -> stringifiedContent\<SomeType\>
16
20
 
17
21
  This way, you are able to parse some unknown string into a strongly typed result, and ensure that the object you are about to stringify matches the intended schema
18
22
 
19
- The next step is each `parse`/`stringify` function is specific to one format. `JSON.parse`/`JSON.stringify` only handles `JSON`. What if you need to parse/stringify some other format? Import another library.
23
+ However, each `parse`/`stringify` function is specific to one format. `JSON.parse`/`JSON.stringify` only handles `JSON`. What if you need to parse/stringify some other format? Import another library.
20
24
 
21
25
  This library provides a unified way to parse, stringify and validate:
22
26
 
23
- [x] JSON
24
- [] YAML (coming soon)
25
- [] TOML (coming soon)
26
- [] CSV (coming soon)
27
+ - [x] JSON
28
+ - [] YAML (coming soon)
29
+ - [] TOML (coming soon)
30
+ - [] CSV (coming soon)
27
31
 
28
32
  Makes use of [Standard Schema](https://github.com/standard-schema/standard-schema) to support all the popular schema libraries (Zod, Valibot, etc).
29
33
 
@@ -97,7 +101,7 @@ Handles a wide variety of string cases:
97
101
  | media type with charset | "application/customFormat+json; charset=utf-8" |
98
102
 
99
103
 
100
- When calling `zparse`, if the unknownContent was not a string, or if no format is specified, or if the specified format is not supported, `zparse` will not modify the passed in content before validating it. So if you know you are parsing a `JSON.stringify`-ed string, pass `JSON` as the 3rd arg to `zparse`
104
+ When calling `zparse`, if the unknownContent was not a string, or if no format is specified, or if the specified format is not supported, `zparse` will not modify the passed in content before validating it. So if you know you are parsing a `JSON.stringify`-ed string, pass `JSON` as the 3rd arg to `zparse`.
101
105
 
102
106
  When calling `zstringify`, if no format is specified, or if the specified format is not supported, `zparse` fall back to assuming the format was `JSON`.
103
107
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as neverthrow0$1 from "neverthrow";
1
+ import * as neverthrow3 from "neverthrow";
2
2
  import * as neverthrow4 from "neverthrow";
3
3
  import * as neverthrow0 from "neverthrow";
4
4
  import { ResultAsync } from "neverthrow";
@@ -31,7 +31,7 @@ declare const defaultParseOptions: {
31
31
  };
32
32
  declare const parseIt: (stringifiedContent: string, formatAndParseOptions: Partial<ParseOptions & {
33
33
  format: string;
34
- }>) => neverthrow0$1.Result<unknown, ParseError>;
34
+ }>) => neverthrow3.Result<unknown, ParseError>;
35
35
  //#endregion
36
36
  //#region src/stringify.d.ts
37
37
  declare class StringifyError extends EnhancedError {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zerde",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "parsing, and stringifying combined with schema validation",
5
5
  "keywords": [
6
6
  "parse",
@@ -9,7 +9,10 @@
9
9
  "validation",
10
10
  "schema"
11
11
  ],
12
- "repository": "github:dannywexler/zerde",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/dannywexler/zerde.git"
15
+ },
13
16
  "author": "Danny Wexler",
14
17
  "license": "MIT",
15
18
  "type": "module",