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

object-unpacker

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-unpacker - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

64

dist/ObjectUnpacker.js

@@ -7,3 +7,2 @@ "use strict";

exports.createObjectUnpacker = void 0;
var ajv_1 = __importDefault(require("ajv"));
var loglevel_1 = __importDefault(require("loglevel"));

@@ -17,57 +16,2 @@ var ReferencesResolver_1 = require("./ReferencesResolver");

exports.createObjectUnpacker = createObjectUnpacker;
var ajv = new ajv_1.default({ allowUnionTypes: true });
var schema = {
$schema: 'http://json-schema.org/draft-07/schema#',
$id: 'https://modules.numprotocol.com/unpacker-schema.json',
title: 'Root',
type: 'object',
definitions: {
notNullStringNoWhitespace: {
$id: '#root/notNullStringNoWhitespace',
title: 'notNullStringNoWhitespace',
type: 'string',
pattern: '^[^ \t\n\r\f\b]+$',
nullable: false,
minLength: 1,
},
nullableString: {
$id: '#root/nullableString',
title: 'nullableString',
type: 'string',
nullable: true,
},
assignKeys: {
$id: '#root/assignKeys',
title: 'assignKeys',
type: 'array',
items: {
$ref: '#root/notNullStringNoWhitespace',
},
minItems: 1,
},
rewriteValue: {
$id: '#root/rewriteValue',
title: 'rewriteValue',
type: ['object', 'string', 'array', 'number', 'boolean', 'integer', 'null'],
},
},
properties: {
assignKeys: {
$ref: '#root/assignKeys',
},
replacePair: {
type: ['object', 'string', 'array', 'number', 'boolean', 'integer', 'null'],
},
rewriteKey: {
$ref: '#root/notNullStringNoWhitespace',
},
rewriteValue: {
$ref: '#root/rewriteValue',
},
arrayItems: {
$ref: '#root/notNullStringNoWhitespace',
},
},
additionalProperties: true,
};
var prefix = '%';

@@ -82,6 +26,2 @@ var postfix = '%';

try {
var validate = ajv.compile(schema);
if (!validate(rawMapping)) {
throw new Error('The unpacker spec does not match the unpacker schema.');
}
var mapping = toTransformationInstructions(rawMapping);

@@ -358,3 +298,3 @@ var data = Util_1.transform(rawData, Util_1.prefixReferences);

var newValueObj = {};
Object.keys(valueObj).forEach(function (k) {
for (var k in valueObj) {
if (mapSpec.additionalKeys.has(k)) {

@@ -368,5 +308,5 @@ var spec = mapSpec.additionalKeys.get(k);

}
});
}
return newValueObj;
};
//# sourceMappingURL=ObjectUnpacker.js.map

11

package.json
{
"name": "object-unpacker",
"version": "0.0.8",
"version": "0.0.9",
"description": "A JSON to JSON mapper in TypeScript",

@@ -8,8 +8,4 @@ "main": "dist/index.js",

"dependencies": {
"deep-eql": "^4.0.0",
"ajv": "^8.0.3",
"fs": "0.0.1-security",
"loglevel": "^1.7.0",
"loglevel-plugin-prefix": "^0.8.4",
"typescript": "^4.0.2"
"loglevel-plugin-prefix": "^0.8.4"
},

@@ -22,2 +18,4 @@ "devDependencies": {

"chai": "^4.2.0",
"deep-eql": "^4.0.0",
"fs": "0.0.1-security",
"mocha": "^8.1.3",

@@ -28,2 +26,3 @@ "ts-loader": "^7.0.5",

"tslint-config-prettier": "^1.18.0",
"typescript": "^4.0.2",
"webpack": "^5.23.0"

@@ -30,0 +29,0 @@ },

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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