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

type-of-is

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

type-of-is - npm Package Compare versions

Comparing version 3.2.1 to 3.3.0

test/BarfClasses.coffee

23

index.js

@@ -80,2 +80,13 @@ (function (factory) {

function extension (_Extension, _Base) {
var SuperClass = _Extension;
while (SuperClass.__super__) {
SuperClass = SuperClass.__super__.constructor;
if (SuperClass === _Base) {
return true;
}
}
return false;
}
function any (obj, tests) {

@@ -106,10 +117,10 @@ if (!is(tests, Array)) {

exports.instance = instance;
exports.string = stringType;
exports.of = of;
exports.is = is;
exports.any = any;
exports.instance = instance;
exports.string = stringType;
exports.of = of;
exports.is = is;
exports.any = any;
exports.extension = extension;
return exports;
}));
{
"name": "type-of-is",
"version": "3.2.1",
"version": "3.3.0",
"description": "Determine and test types using constructor or {}.toString",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -43,3 +43,3 @@ # Description

3.2.1
3.3.0

@@ -59,3 +59,3 @@

"dependencies": {
"type-of-is": "3.2.x"
"type-of-is": "~3.3.0"
}

@@ -75,2 +75,3 @@ }

Type.instance(obj, type); // wrapper of "obj instanceof type"
Type.extension(SomeCoffeeScriptClassThatExtendsBarf, SomeCoffeeScriptClassNamedBarf)

@@ -77,0 +78,0 @@ // The top level Type export delegates to Type.of or Type.is based on argument count

@@ -14,2 +14,4 @@ var Path = require('path');

var BarfClasses = require('./BarfClasses')
Asserts({

@@ -144,3 +146,17 @@ "Type, Type.of, and Type.string should properly find types": function () {

}, /should be array/);
},
"Type.extension(ClassA, ClassB) should properly check CoffeeScript inheritance" : function () {
var Barf = BarfClasses.Barf;
var Hurl = BarfClasses.Hurl;
var Chuck = BarfClasses.Chuck;
var Derp = BarfClasses.Derp;
Assert.equal(Type.extension(Hurl, Barf), true, 'Hurl < Barf');
Assert.equal(Type.extension(Chuck, Barf), true, 'Chuck < Barf');
Assert.equal(Type.extension(Chuck, Hurl), true, 'Chuck < Hurl');
Assert.equal(Type.extension(Barf, Hurl), false, 'Barf < Hurl');
Assert.equal(Type.extension(Barf, Chuck), false, 'Barf < Chuck');
Assert.equal(Type.extension(Barf, Derp), false, 'Barf < Derp');
Assert.equal(Type.extension(Derp, Barf), false, 'Derp < Barf');
}
});
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