New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jslt

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jslt - npm Package Compare versions

Comparing version 0.2.9 to 0.2.10

23

jslt.js

@@ -324,2 +324,3 @@

$replace(input, args, global) {
if (!args) return error("[arguments]", "missing / invalid");
if (!(typeof args.newSubstr == "string")) return error("[newSubstr]", "missing / invalid");

@@ -357,2 +358,24 @@

$blacklist(input, args, global) {
if (!(args instanceof Array)) return error("[arguments]", "missing / invalid");
if (!(input instanceof Object) || input === null) return input;
var retVal = {};
Object.keys(input).forEach(key => {
if (!args.includes(key)) retVal[key] = input[key];
});
return retVal;
},
$whitelist(input, args, global) {
if (!(args instanceof Array)) return error("[arguments]", "missing / invalid");
if (!(input instanceof Object) || input === null) return input;
var retVal = {};
Object.keys(input).forEach(key => {
if (args.includes(key)) retVal[key] = input[key];
});
return retVal;
},
// Array

@@ -359,0 +382,0 @@ $map(input, args, global) {

2

package.json
{
"name": "jslt",
"version": "0.2.9",
"version": "0.2.10",
"description": "JSON transformer",

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

@@ -164,2 +164,3 @@

test("$replace regexp string", "test 123", { $replace : { regexp : "\\d+", newSubstr : "" } }, "test ");
test("$replace", "test str", { $replace : null }, "$replace.[arguments] - missing / invalid");

@@ -249,2 +250,14 @@ test("$catch - no error", { prop : "test" }, { $fetch : "{{prop}}", $catch : {} }, "test");

test("$blacklist", { a : 3, b : 2 }, { $blacklist : [ "a", "c" ] }, { b : 2 });
test("$blacklist", { a : 3 }, { $blacklist : [ "a" ] }, {});
test("$blacklist", 3, { $blacklist : [ "a", "c" ] }, 3);
test("$blacklist", null, { $blacklist : [ "a", "c" ] }, null);
test("$blacklist", null, { $blacklist : 3 }, "$blacklist.[arguments] - missing / invalid");
test("$whitelist", { a : 3, b : 2 }, { $whitelist : [ "a", "c" ] }, { a : 3 });
test("$whitelist", { a : 3 }, { $whitelist : [ "b" ] }, {});
test("$whitelist", 3, { $whitelist : [ "a", "c" ] }, 3);
test("$whitelist", null, { $whitelist : [ "a", "c" ] }, null);
test("$whitelist", null, { $whitelist : 3 }, "$whitelist.[arguments] - missing / invalid");
console.log(`\nPassed: ${passed}, Failed: ${failed}`);
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