Socket
Socket
Sign inDemoInstall

rttc

Package Overview
Dependencies
Maintainers
4
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rttc - npm Package Compare versions

Comparing version 7.3.0 to 7.4.0

5

lib/dehydrate.js

@@ -18,6 +18,7 @@ /**

* @param {Boolean} allowNull [defaults to false]
* @param {Boolean} dontStringifyFunctions [defaults to false]
* @return {String}
*/
module.exports = function dehydrate (value, allowNull) {
return rebuildSanitized(value,allowNull);
module.exports = function dehydrate (value, allowNull, dontStringifyFunctions) {
return rebuildSanitized(value,allowNull,dontStringifyFunctions);
};

13

lib/helpers/sanitize.js

@@ -15,3 +15,3 @@ /**

*/
module.exports = function rebuildSanitized(val, allowNull) {
module.exports = function rebuildSanitized(val, allowNull, dontStringifyFunctions) {

@@ -26,3 +26,3 @@ // Does not `allowNull` by default.

return _rebuild(val, allowNull);
return _rebuild(val, allowNull, dontStringifyFunctions);
};

@@ -58,3 +58,3 @@

function _rebuild(val, allowNull) {
function _rebuild(val, allowNull, dontStringifyFunctions) {
var stack = [];

@@ -107,3 +107,5 @@ var keys = [];

else if (_.isFunction(val)){
val = val.toString();
if (!dontStringifyFunctions) {
val = val.toString();
}
}

@@ -145,4 +147,5 @@ else if (!_.isObject(val)) {

// Pass in the empty string to satisfy Mr. isaac's replacer
// Pass in the empty string for the top-level "key"
// to satisfy Mr. isaac's replacer
return _recursivelyRebuildAndSanitize(val, '');
}
{
"name": "rttc",
"version": "7.3.0",
"version": "7.4.0",
"description": "Runtime type-checking for JavaScript.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -130,3 +130,3 @@ # rttc

The **lamda** type accepts any function.
The **lamda** type accepts any function.

@@ -331,7 +331,7 @@ ### Generic dictionaries

##### .dehydrate(value, [_allowNull_=`false`])
##### .dehydrate(value, [_allowNull_=`false`], [_dontStringifyFunctions_=`false`])
This takes care of a few serialization edge-cases, such as:
+ stringifies functions, regexps, and errors (grabs the `.stack` property)
+ stringifies regexps, errors (grabs the `.stack` property), and functions (unless `dontStringifyFunctions` is set)
+ replacing circular references with a string (e.g. `[Circular]`)

@@ -338,0 +338,0 @@ + replaces `-Infinity`, `Infinity`, and `NaN` with 0

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc