
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
@bit-js/valify
Advanced tools
A JSON schema library.
Valify includes a compiler to compile JSON schemas to assertion functions.
import { schema } from "@bit-js/valify";
import { evaluate, keywords } from "@bit-js/valify/compiler/assertion";
const User = schema({
type: "object",
required: ["name", "age"],
properties: {
name: {
type: "string",
minLength: 3,
maxLength: 32,
},
age: {
type: "integer",
exclusiveMinimum: 0,
exclusiveMaximum: 150,
},
},
});
const isUser = evaluate(User, keywords.draft6);
To compile the schema ahead-of-time:
import { schema } from "@bit-js/valify";
import { inspect, keywords } from "@bit-js/valify/compiler/assertion";
const User = schema({
type: "object",
required: ["name", "age"],
properties: {
name: {
type: "string",
minLength: 3,
maxLength: 32,
},
age: {
type: "integer",
exclusiveMinimum: 0,
exclusiveMaximum: 150,
},
},
});
const content = `export const isUser=(()=>{${inspect(User, keywords.draft6)}})();`;
Compilation options include:
evaluate(User, keywords.draft6, {
// Does not count `Number.NaN`, `Number.POSITIVE_INFINITY` and `Number.NEGATIVE_INFINITY` as valid numbers if set to true
noNonFiniteNumber: true; // Default: false
// Handle string width correctly for Unicode characters if set to true
strictStringWidth: true; // Default: false
// Use `Object.hasOwn` instead of directly accessing the property and check its value if set to true
strictPropertyCheck: true; // Default: false
// Array does not count as objects if set to true
noArrayObject: true; // Default: false
// Handle `multipleOf` keyword correctly for numbers below 1 if set to true
accurateMultipleOf: true; // Default: false
// Handle Unicode regular expressions correctly if set to true
unicodeAwareRegex: true; // Default: false
// Do deep comparisons for `uniqueItems`, `enum` and `const` keywords if set to false
fastAssertions: false; // Default: false
});
This library is experimental and still in active development.
Currently only draft 6 keywords (without format
, $ref
and $id
keywords) are supported.
FAQs
A JSON schema library.
The npm package @bit-js/valify receives a total of 353 weekly downloads. As such, @bit-js/valify popularity was classified as not popular.
We found that @bit-js/valify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.