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

libskynet

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libskynet - npm Package Compare versions

Comparing version 0.1.8 to 0.1.9

29

dist/validateObjPropType.test.js

@@ -102,2 +102,3 @@ import { validateObjPropTypes } from "./validateObjPropTypes.js";

butter: 5n,
someU8: new Uint8Array([1, 2, 3, 4]),
arrBool: [true, true, false],

@@ -114,2 +115,3 @@ toast: false,

["butter", "bigint"],
["someU8", "Uint8Array"],
["toast", "boolean"],

@@ -126,2 +128,3 @@ ["pecans", "boolean"],

const obj9 = {
someU8: new Uint8Array([1, 2, 3, 4]),
arrStr: ["hi", "hello"],

@@ -145,2 +148,3 @@ prop: "a",

["butter", "bigint"],
["someU8", "Uint8Array"],
["toast", "boolean"],

@@ -166,2 +170,3 @@ ["pecans", "boolean"],

arrBig: [1n, 2n, 3n],
someU8: new Uint8Array([1, 2, 3, 4]),
};

@@ -180,4 +185,28 @@ // We are now checking the objects out of order as another test.

["arrBool", "booleanArray"],
["someU8", "Uint8Array"],
]);
expect(obj10Err).not.toBe(null);
// Validate an object with a Uint8Array.
const u8arr = new Uint8Array([1, 2, 3, 5]);
const obj11 = {
u8: u8arr,
};
const obj11Err = validateObjPropTypes(obj11, [["u8", "Uint8Array"]]);
expect(obj11Err).toBe(null);
// Validate an object with a non Uint8Array.
const uXarr = [257, 1, 2, 3];
const obj12 = {
u8: uXarr,
};
const obj12Err = validateObjPropTypes(obj12, [["u8", "Uint8Array"]]);
expect(obj12Err).not.toBe(null);
// Test that an object works.
const smallObj = {
key: "value",
};
const obj13 = {
innerObj: smallObj,
};
const obj13Err = validateObjPropTypes(obj13, [["innerObj", "object"]]);
expect(obj13Err).toBe(null);
});

@@ -30,2 +30,3 @@ import { addContextToErr } from "./err.js";

// ["aArr", "numberArray"],
// ["aUint8Array", "Uint8Array"],
// ]);

@@ -63,2 +64,11 @@ function validateObjPropTypes(obj, checks) {

}
// Uint8Array check.
if (expectedType === "Uint8Array") {
if (obj[property] instanceof Uint8Array) {
continue;
}
else {
return `check failed for property '${property};, expecting Uint8Array`;
}
}
// Generic typeof check.

@@ -65,0 +75,0 @@ const type = typeof obj[property];

6

package.json
{
"name": "libskynet",
"version": "0.1.8",
"version": "0.1.9",
"author": "Skynet Labs",

@@ -16,7 +16,7 @@ "description": "helper library to interact with skynet's low level primitives",

"scripts": {
"lint": "prettier -l 'src' 'src-test' '*.js' '*.json' && eslint 'src' 'src-test' '*.js' '*.json'",
"lint": "prettier -l 'src' '*.js' '*.json' && eslint 'src' '*.js' '*.json'",
"clean": "node ./clean.js",
"deps": "npm audit fix",
"update-deps": "npm run clean && npm run deps && npm install",
"update-lint": "prettier -w 'src' 'src-test' '*.js' '*.json' && eslint 'src' 'src-test' '*.js' '*.json' --fix",
"update-lint": "prettier -w 'src' '*.js' '*.json' && eslint 'src' '*.js' '*.json' --fix",
"update": "npm run update-deps && npm run update-lint && tsc",

@@ -23,0 +23,0 @@ "spot-test": "node --no-warnings --loader ts-node/esm spotTest.ts",

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