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

intertype

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

intertype - npm Package Compare versions

Comparing version 2.7.0 to 2.8.0

11

lib/cataloguing.js

@@ -1,5 +0,4 @@

// Generated by CoffeeScript 2.4.1
(function() {
'use strict';
var CND, alert, assign, badge, debug, flatten, help, info, inspect, jr, rpr, urge, warn, whisper;
var CND, alert, assign, badge, debug, help, info, inspect, jr, rpr, urge, warn, whisper;

@@ -29,4 +28,2 @@ //###########################################################################################################

flatten = require('lodash.flattendeep');
//...........................................................................................................

@@ -150,3 +147,3 @@ ({inspect} = require('util'));

}
/* TAINT or throw error */ ref = flatten(P);
/* TAINT or throw error */ ref = P.flat(2e308);
for (i = 0, len = ref.length; i < len; i++) {

@@ -170,3 +167,3 @@ key = ref[i];

var keys, probes;
probes = (flatten(P)).sort();
probes = (P.flat(2e308)).sort();
keys = (this.values_of(this.keys_of(x))).sort();

@@ -177,3 +174,1 @@ return CND.equals(probes, keys);

}).call(this);
//# sourceMappingURL=cataloguing.js.map

@@ -105,2 +105,8 @@ (function() {

});
this.declare('asyncgeneratorfunction', (x) => {
return (js_type_of(x)) === 'asyncgeneratorfunction';
});
this.declare('asyncgenerator', (x) => {
return (js_type_of(x)) === 'asyncgenerator';
});
this.declare('generator', (x) => {

@@ -411,3 +417,3 @@ return (js_type_of(x)) === 'generator';

//.........................................................................................................
return this.declare('vnr', function(x) {
this.declare('vnr', function(x) {
/* A vectorial number (VNR) is a non-empty array of integers. It can be expressed as an ordinary

@@ -417,4 +423,57 @@ list of integers or as an `Int32Array`. */

});
//.........................................................................................................
return this.declare('fs_stats', {
tests: {
'x is an object': function(x) {
return this.isa.object(x);
},
'x.size is a count': function(x) {
return this.isa.count(x.size);
},
'x.atimeMs is a number': function(x) {
return this.isa.number(x.atimeMs);
},
'x.atime is a date': function(x) {
return this.isa.date(x.atime);
}
}
});
};
//===========================================================================================================
// TYPE DECLARATIONS
//-----------------------------------------------------------------------------------------------------------
this.declare_checks = function() {
var FS, PATH;
PATH = require('path');
FS = require('fs');
//.........................................................................................................
/* NOTE: will throw error unless path exists, error is implicitly caught, represents sad path */
this.declare_check('fso_exists', function(path, stats = null) {
return FS.statSync(path);
});
// try ( stats ? FS.statSync path ) catch error then error
//.........................................................................................................
this.declare_check('is_file', function(path, stats = null) {
var bad;
if (this.is_sad((bad = stats = this.check.fso_exists(path, stats)))) {
return bad;
}
if (stats.isFile()) {
return stats;
}
return this.sadden(`not a file: ${path}`);
});
//.........................................................................................................
return this.declare_check('is_json_file', function(path) {
var error;
try {
return JSON.parse(FS.readFileSync(path));
} catch (error1) {
error = error1;
return error;
}
});
};
/* not supported until we figure out how to do it in strict mode: */

@@ -421,0 +480,0 @@ // @declare 'arguments', ( x ) -> ( js_type_of x ) is 'arguments'

@@ -124,2 +124,3 @@ (function() {

declarations.declare_types.apply(this);
declarations.declare_checks.apply(this);
if (target != null) {

@@ -126,0 +127,0 @@ this.export(target);

@@ -128,3 +128,3 @@ (function() {

//.........................................................................................................
probes_and_matchers = [["type_of( new WeakMap() )", 'weakmap', null], ["type_of( new Map() )", 'map', null], ["type_of( new Set() )", 'set', null], ["type_of( new Date() )", 'date', null], ["type_of( new Error() )", 'error', null], ["type_of( [] )", 'list', null], ["type_of( true )", 'boolean', null], ["type_of( false )", 'boolean', null], ["type_of( ( () => {} ) )", 'function', null], ["type_of( ( async () => { await f() } ) )", 'asyncfunction', null], ["type_of( null )", 'null', null], ["type_of( 'helo' )", 'text', null], ["type_of( undefined )", 'undefined', null], ["type_of( global )", 'global', null], ["type_of( /^xxx$/g )", 'regex', null], ["type_of( {} )", 'object', null], ["type_of( NaN )", 'nan', null], ["type_of( 1 / 0 )", 'infinity', null], ["type_of( -1 / 0 )", 'infinity', null], ["type_of( 12345 )", 'number', null], ["type_of( 'xxx' )", 'text', null], ["type_of( function () {} )", 'function', null], ["type_of( async function () { await 42 } )", 'asyncfunction', null], ["type_of( function* () { yield 42 } )", 'generatorfunction', null], ["type_of( ( function* () { yield 42 } )() )", 'generator', null], ["type_of( 123 )", 'number', null], ["type_of( 42 )", 'number', null], ["type_of( [] )", 'list', null], ["type_of( global )", 'global', null], ["type_of( new Date() )", 'date', null], ["type_of( {} )", 'object', null], ["type_of( new Buffer( 'helo' ) )", 'buffer', null], ["type_of( new ArrayBuffer( 42 ) )", 'arraybuffer', null], ["type_of( new Int8Array( 5 ) )", 'int8array', null], ["type_of( new Uint8Array( 5 ) )", 'uint8array', null], ["type_of( new Uint8ClampedArray( 5 ) )", 'uint8clampedarray', null], ["type_of( new Int16Array( 5 ) )", 'int16array', null], ["type_of( new Uint16Array( 5 ) )", 'uint16array', null], ["type_of( new Int32Array( 5 ) )", 'int32array', null], ["type_of( new Uint32Array( 5 ) )", 'uint32array', null], ["type_of( new Float32Array( 5 ) )", 'float32array', null], ["type_of( new Float64Array( 5 ) )", 'float64array', null], ["type_of( new Promise( ( rslv, rjct ) => {} ) )", 'promise', null]];
probes_and_matchers = [["type_of( new WeakMap() )", 'weakmap', null], ["type_of( new Map() )", 'map', null], ["type_of( new Set() )", 'set', null], ["type_of( new Date() )", 'date', null], ["type_of( new Error() )", 'error', null], ["type_of( [] )", 'list', null], ["type_of( true )", 'boolean', null], ["type_of( false )", 'boolean', null], ["type_of( ( () => {} ) )", 'function', null], ["type_of( ( async () => { await f() } ) )", 'asyncfunction', null], ["type_of( null )", 'null', null], ["type_of( 'helo' )", 'text', null], ["type_of( undefined )", 'undefined', null], ["type_of( global )", 'global', null], ["type_of( /^xxx$/g )", 'regex', null], ["type_of( {} )", 'object', null], ["type_of( NaN )", 'nan', null], ["type_of( 1 / 0 )", 'infinity', null], ["type_of( -1 / 0 )", 'infinity', null], ["type_of( 12345 )", 'number', null], ["type_of( 'xxx' )", 'text', null], ["type_of( function () {} )", 'function', null], ["type_of( async function () { await 42 } )", 'asyncfunction', null], ["type_of( function* () { yield 42 } )", 'generatorfunction', null], ["type_of( ( function* () { yield 42 } )() )", 'generator', null], ["type_of( 123 )", 'number', null], ["type_of( 42 )", 'number', null], ["type_of( [] )", 'list', null], ["type_of( global )", 'global', null], ["type_of( new Date() )", 'date', null], ["type_of( {} )", 'object', null], ["type_of( new Buffer( 'helo' ) )", 'buffer', null], ["type_of( new ArrayBuffer( 42 ) )", 'arraybuffer', null], ["type_of( new Int8Array( 5 ) )", 'int8array', null], ["type_of( new Uint8Array( 5 ) )", 'uint8array', null], ["type_of( new Uint8ClampedArray( 5 ) )", 'uint8clampedarray', null], ["type_of( new Int16Array( 5 ) )", 'int16array', null], ["type_of( new Uint16Array( 5 ) )", 'uint16array', null], ["type_of( new Int32Array( 5 ) )", 'int32array', null], ["type_of( new Uint32Array( 5 ) )", 'uint32array', null], ["type_of( new Float32Array( 5 ) )", 'float32array', null], ["type_of( new Float64Array( 5 ) )", 'float64array', null], ["type_of( new Promise( ( rslv, rjct ) => {} ) )", 'promise', null], ["type_of( async function* () { await f(); yield 42; } )", 'asyncgeneratorfunction', null], ["type_of( ( async function* () { await f(); yield 42; } )() )", 'asyncgenerator', null]];
//.........................................................................................................

@@ -754,47 +754,21 @@ for (i = 0, len = probes_and_matchers.length; i < len; i++) {

T.ok(isa.error(check.dvsbl_2_3(43)));
// #.........................................................................................................
// declare 'fs_stats', tests:
// 'x is an object': ( x ) -> @isa.object x
// 'x.size is a count': ( x ) -> @isa.count x.size
// 'x.atimeMs is a number': ( x ) -> @isa.number x.atimeMs
// 'x.atime is a date': ( x ) -> @isa.date x.atime
// #.........................................................................................................
// ### NOTE: will throw error unless path exists, error is implicitly caught, represents sad path ###
// declare_check 'fso_exists', ( path, stats = null ) -> FS.statSync path
// # try ( stats ? FS.statSync path ) catch error then error
// #.........................................................................................................
// declare_check 'is_file', ( path, stats = null ) ->
// return bad if is_sad ( bad = stats = @check.fso_exists path, stats )
// return stats if stats.isFile()
// return sadden "not a file: #{path}"
// #.........................................................................................................
// declare_check 'is_json_file', ( path ) ->
// return try ( JSON.parse FS.readFileSync path ) catch error then error
//.........................................................................................................
declare('fs_stats', {
tests: {
'x is an object': function(x) {
return this.isa.object(x);
},
'x.size is a count': function(x) {
return this.isa.count(x.size);
},
'x.atimeMs is a number': function(x) {
return this.isa.number(x.atimeMs);
},
'x.atime is a date': function(x) {
return this.isa.date(x.atime);
}
}
});
//.........................................................................................................
/* NOTE: will throw error unless path exists, error is implicitly caught, represents sad path */
declare_check('fso_exists', function(path, stats = null) {
return FS.statSync(path);
});
// try ( stats ? FS.statSync path ) catch error then error
//.........................................................................................................
declare_check('is_file', function(path, stats = null) {
var bad;
if (is_sad((bad = stats = this.check.fso_exists(path, stats)))) {
return bad;
}
if (stats.isFile()) {
return stats;
}
return sadden(`not a file: ${path}`);
});
//.........................................................................................................
declare_check('is_json_file', function(path) {
var error;
try {
return JSON.parse(FS.readFileSync(path));
} catch (error1) {
error = error1;
return error;
}
});
//.........................................................................................................
/* overloading 'path' here, obviously */

@@ -801,0 +775,0 @@ happy_path = PATH.resolve(PATH.join(__dirname, '../../package.json'));

{
"name": "intertype",
"version": "2.7.0",
"version": "2.8.0",
"description": "A JavaScript typechecker",

@@ -20,4 +20,3 @@ "main": "lib/main.js",

"dependencies": {
"cnd": "^4.6.0",
"lodash.flattendeep": "^4.4.0",
"cnd": "^4.7.3",
"multimix": "^2.1.1"

@@ -24,0 +23,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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