Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sanitized

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sanitized - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

20

index.js
const sanitizer = require("./sanitizer");
module.exports = (value) => {
const handlers = {
const handle = {
string: (str) => (str ? sanitizer(str).trim() : ""),
array: (arr) => {
var clone = [].concat(arr);
clone.forEach((item, index) => (clone[index] = module.exports(item)));
for (var i = clone.length - 1; i >= 0; i--) {
clone[i] = module.exports(clone[i]);
}
return clone;

@@ -13,5 +15,7 @@ },

var clone = JSON.parse(JSON.stringify(obj));
Object.keys(clone).forEach(
(key) => (clone[key] = module.exports(clone[key]))
);
const cloneKeys = Object.keys(clone);
for (var i = cloneKeys.length - 1; i >= 0; i--) {
const cloneKey = cloneKeys[i];
clone[cloneKey] = module.exports(clone[cloneKey]);
}
return clone;

@@ -22,9 +26,9 @@ },

? value.constructor === String
? handlers.string(value)
? handle.string(value)
: value.constructor === Array
? handlers.array(value)
? handle.array(value)
: value.constructor === Object
? handlers.object(value)
? handle.object(value)
: value
: value;
};

2

package.json
{
"name": "sanitized",
"version": "1.0.5",
"version": "1.0.6",
"description": "Recursive function that'll sanitize a string or ALL values in an object or array.",

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

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