Comparing version 9.2.4 to 9.3.0
@@ -24,2 +24,3 @@ /** | ||
expected = _.cloneDeep(expected); | ||
// TODO: add sufficient tests to ensure this is never a problem, then remove this to improve performance. | ||
@@ -26,0 +27,0 @@ // Jump into recursive validation |
@@ -402,3 +402,3 @@ /** | ||
getBase: function (){ | ||
return undefined; | ||
return null; | ||
}, | ||
@@ -405,0 +405,0 @@ getExemplar: function() { |
@@ -25,2 +25,3 @@ /** | ||
expected = _.cloneDeep(expected); | ||
// TODO: add sufficient tests to ensure this is never a problem, then remove this to improve performance. | ||
@@ -27,0 +28,0 @@ var errors = []; |
{ | ||
"name": "rttc", | ||
"version": "9.2.4", | ||
"version": "9.3.0", | ||
"description": "Runtime type-checking for JavaScript.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -194,5 +194,5 @@ # rttc | ||
> Note: Generic array exemplar syntax is really just another way to write `['*']`. The special empty array syntax will continue to be supported for backwards compatibility, but it may eventually be removed from documentation and tests to avoid potential confusion. | ||
### Patterned arrays | ||
@@ -426,17 +426,15 @@ | ||
This is a lot like `util.inspect(val, false, null)`, but it also has special handling for Errors, Dates, and RegExps (using `dehydrate()` with `allowNull` enabled), as well as for Functions (making them `eval()`-ready.) The biggest difference is that everything you get from `rttc.compile()` is ready for use as values in `*`, `{}`, or `[]` type machines, Treeline, Angular's rendering engine, and JavaScript code in general (i.e. if you were to append it on the right-hand side of `var x = `, or if you ran `eval()` on it) | ||
This is a lot like `util.inspect(val, false, null)`, but it also has special handling for Errors, Dates, and RegExps (using `dehydrate()` with `allowNull` enabled), as well as for Functions (making them `eval()`-ready.) The biggest difference is that the string you get back from `rttc.compile()` is ready for use as the right hand side of a variable initialization statement in JavaSript. | ||
Note that undefined values in arrays and undefined values of keys in dictionaries will be stripped out, and circular references will be handled as they are in `util.inspect(val, false, null)` | ||
Useful for: | ||
+ bootstrapping data on server-rendered views for access by client-side JavaScript | ||
+ see [this gist](https://gist.github.com/mikermcneil/f8faae5903f049640d15) for a comprehensive example | ||
+ generating code samples | ||
+ in particular for bootstrapping data on server-rendered views for access by client-side JavaScript | ||
+ error messages, | ||
+ error messages | ||
+ debugging | ||
+ user interfaces | ||
Finally, here's a table listing notable differences between `util.inspect()` and `rttc.compile()` for reference: | ||
Here's a table listing notable differences between `util.inspect()` and `rttc.compile()` for reference: | ||
| value | util.inspect() | rttc.compile() | | ||
@@ -460,3 +458,8 @@ |--------------------------|-------------------------------------------|--------------------------------------| | ||
> Note that undefined values in arrays and undefined values of keys in dictionaries will be stripped out, and circular references will be handled as they are in `util.inspect(val, false, null)`. | ||
### Experimental | ||
@@ -487,3 +490,3 @@ | ||
If the `allowSpecialSyntax` flag is enabled, then `*`, `->`, and `===` will take on their traditional meaning instead of being replaced with strings (e.g. "a star symbol"). | ||
If the `allowSpecialSyntax` flag is enabled, then `*`, `->`, and `===` will be left untouched (allowing them to be intperpreted as special rttc exemplar syntax) instead of being replaced with string samples (e.g. "a star symbol" or "an arrow symbol"). | ||
@@ -490,0 +493,0 @@ ```js |
@@ -427,3 +427,3 @@ // Export the array of tests below. | ||
{ example: undefined, actual: undefined, result: undefined, }, | ||
{ example: undefined, actual: undefined, result: null, }, | ||
@@ -430,0 +430,0 @@ { example: undefined, actual: NaN, result: NaN, }, |
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
218177
4643
576