
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
Check the values of arguments passed to a function -Â see if they quack like a duck.
var quack = require('quack');
var coolFunction = function(string, array, object, number){
if (! quack('string, array, object, number', arguments)) {
throw new Error('is not a duck');
}
console.log('is a duck');
};
coolFunction('one', ['two'], {three: 3}, 'four'); // throws: "is not a duck", last arg is wrong
coolFunction('one', ['two'], {three: 3}, 4); // logs: "is a duck", tick
npm install quack
var quack = require('quack');
Download quack.js, quack.min.js, and quack.js.src, and add them to your project.
RequireJS (AMD)
require(['path/to/quack'], function(quack){
// use quack here
});
Standard
<script src="path/to/quack.min.js"></script>
quack takes two arguments, and returns a boolean (true if it validates)
array or arguments object)Two arrays:
quack(['string', 'number'], ['my string', 123]); // true
A string and arguments object:
var coolFunction = function(){
return quack('string, number', arguments);
};
coolFunction('my string', 123); // true
String (primitive)Number (primitive)Boolean (primitive)Object,
including Array, Function, Object, RegExp, new Number(0), and new String('')Array (not including arguments object)FunctionDate objectRegExp objectarguments objectstring, number, object, & array (with tests)function, date, regexp, arguments'"", [], 1' short for 'string, array, number'options: a third argument
boolean: throw an error if validation failsboolean: log to the console if validation failsstring: a specific message for logged/thrown errorsarrays & object properties
'[]string': an array of strings'[string, number]': specific types within an array'{}string': an object with only string properties'{val1: string, val2: number}': specific object property names and types'{}' shorthandFAQs
Check the values of passed arguments in a function - see if they quack like a duck.
The npm package quack receives a total of 0 weekly downloads. As such, quack popularity was classified as not popular.
We found that quack 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.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.