
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
My eyes feel pain when i see:
if ( x+'' === x ) { ... } // if that string
if ( x*1 === x ) { ... } // if that number
... // and many others
Let me introduce a simple way to ensure the correctness of the target data. As I see it.
Node.jsnpm i s-is --save
Browserbower i s-is --save
In javascript definition of data types associated with some difficulties. Due to the fact that the original methods do not always work as expected. We are forced to turn to non-standard decisions. Not always, these decisions are correct, and even rarer - code still readable. If we are interested in conditional of 10 data types.And we want them correctly and to determine.
NaN, null, undefined, infinity, number, string, boolean, function, array, object
var is = require('s-is');
is.array([]); // => true
is.array({}); // => false
is('Array', []); // => true
is.nan('Hello !'); // => false
is('NaN','Hello !'); // => false
is('NaN','Hello !' - 2); // => true
is.nan(NaN); // => true
Note - This approach is implemented for all the previously identified 10 of types data.
It gives us a lot of benefits and expands our capabilities. And also adds surprises.
// try it
typeof Symbol() == 'symbol'; // => true
// but
typeof ( new Promise(new Function) ) == 'object'; // => true
// or
typeof (class test {}) == 'function'; // => true
In connection with such innovations was established method of determining the 10 data types, plus all the innovations.
var is = require('s-is');
is.typeof( {} ); // => "object"
is.typeof( [] ); // => "array"
is.typeof( NaN ); // => "nan"
is.typeof( Infinity ); // => "infinity"
is.typeof( null ); // => "null"
is.typeof( 5 ); // => "number"
is.typeof( '5' ); // => "string"
is.typeof( true ); // => "boolean"
is.typeof( undefined ); // => "undefined"
is.typeof( function () {} ); // => "function"
// just more example
is.typeof( Symbol() ); // => "symbol"
is.typeof( process ); // => "object"
is.typeof( new function Test () {} ); // => "object"
is.typeof( new class test {} );// => "object"
is.typeof( class test {} ); // => "function"
And in the end, we frequently need to define some specific objects. This applies mainly to proven technologies.
var is = require('s-is');
// date
is.date( new Date() ); // => true
is('date', new Date() ); // => true
is('date', (new Date()).getDate() ); // => false
// promise
var p = new Promise(new Function);
is.promise( p ); // => true
is('promise', p ); // => true
is.promise( {} ); // => false
is('promise', {then: new Function} ); // => true
// isn't native
is._object( {} ); // => true
is._object( new function Test () {} ); // => true
is._object( new class test {} ); // => true
is('_object', window ); // => false
is('_object', process ); // => false
is('_object', new Promise(new Function) );// => false
// arguments
(function ( x ) {
console.log(
'\n is.argument', is.argument(arguments),
'\n is.empty', is.empty(arguments),
'\n arguments', arguments
);
})(1);
(function ( x ) {
console.log(
'\n is.argument', is.argument(arguments),
'\n is.empty', is.empty(arguments),
'\n arguments', arguments
);
})();
API documentation Table of results that generates a test script module.termainal
.png?raw=true)
FAQs
A simple way to ensure the correctness of the target data.
We found that s-is 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.