schema-markdown 1.0.2 → 1.0.6

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
@@ -85,7 +85,7 @@ try {
85
85
 
86
86
  ## Development
87
87
 
88
- This project is developed using [JavaScript Build](https://github.com/craigahobbs/javascript-build#readme). It was started
88
+ This project is developed using [javascript-build](https://github.com/craigahobbs/javascript-build#readme). It was started
89
89
  using [javascript-template](https://github.com/craigahobbs/javascript-template#readme) as follows:
90
90
 
91
91
  ```
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "schema-markdown",
4
- "version": "1.0.2",
4
+ "version": "1.0.6",
5
5
  "description": "Human-friendly schema definition language and schema validator",
6
- "keywords": "schema validation json",
6
+ "keywords": [
7
+ "schema",
8
+ "definition",
9
+ "validation",
10
+ "json"
11
+ ],
7
12
  "homepage": "https://github.com/craigahobbs/schema-markdown-js#readme",
8
13
  "bugs": "https://github.com/craigahobbs/schema-markdown-js/issues",
9
14
  "license": "MIT",
@@ -20,10 +25,10 @@
20
25
  "test": "ava -v 'src/tests/**/*.js'"
21
26
  },
22
27
  "devDependencies": {
23
- "ava": "4.0.0-alpha.2",
24
- "c8": "7.7.3",
25
- "eslint": "7.31.0",
26
- "jsdoc": "3.6.7",
27
- "window": "4.2.7"
28
+ "ava": "^4.0.0-rc.1",
29
+ "c8": "~7.10",
30
+ "eslint": "~8.3",
31
+ "jsdoc": "~3.6",
32
+ "jsdom": "~18.1"
28
33
  }
29
34
  }
@@ -58,11 +58,11 @@ function encodeQueryStringHelper(obj, memberFqn = null, keyValues = []) {
58
58
  export function decodeQueryString(paramStr) {
59
59
  // Decode the parameter string key/values
60
60
  const result = [null];
61
- paramStr.split('&').filter((keyValue) => keyValue.length).forEach(
61
+ paramStr.split('&').forEach(
62
62
  (keyValue, ixKeyValue, keyValuesFiltered) => {
63
- const [keyFqn, valueEncoded = null] = keyValue.split('=');
63
+ const [keyFqn, valueEncoded = null] = keyValue.split('=', 2);
64
64
  if (valueEncoded === null) {
65
- // Ignore anchor tags
65
+ // Ignore hash IDs
66
66
  if (ixKeyValue === keyValuesFiltered.length - 1) {
67
67
  return;
68
68
  }
@@ -97,7 +97,7 @@ function getReferencedTypesHelper(types, type, referencedTypes) {
97
97
  /**
98
98
  * Schema Markdown type model validation error
99
99
  *
100
- * @property {?string} memberFqn - The list of error strings
100
+ * @property {?string} memberFqn - The fully qualified member name
101
101
  */
102
102
  export class ValidationError extends Error {
103
103
  /**
@@ -194,13 +194,13 @@ function validateTypeHelper(types, type, value, memberFqn) {
194
194
  } else if (builtin === 'date' || builtin === 'datetime') {
195
195
  // Convert string?
196
196
  if (typeof value === 'string') {
197
- valueNew = new Date(value);
198
- if (isNaN(valueNew)) {
199
- throwMemberError(type, value, memberFqn);
200
- }
201
-
202
- // Invalid date format?
203
- if (!(rDate.test(value) || rDatetime.test(value))) {
197
+ // Valid date format?
198
+ if (rDate.test(value)) {
199
+ const localDate = new Date(value);
200
+ valueNew = new Date(localDate.getUTCFullYear(), localDate.getUTCMonth(), localDate.getUTCDate());
201
+ } else if (rDatetime.test(value)) {
202
+ valueNew = new Date(value);
203
+ } else {
204
204
  throwMemberError(type, value, memberFqn);
205
205
  }
206
206