Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
MooTools convenient type-check methods and deep equality comparator.
Version: 0.0.3
Influences:
Dependencies:
Is is an object that contains methods for checking type and equality. The API contains all of the methods found in Type
from MooTools-Core, with a few additions. Type
is decorated so that a convenient type-check method is also added to Is
whenever a new type is created.
Along with the positive checks, we have the opposing negative checks that can be accessed in Is.not
.
All type-check methods take only one argument: the object which will be type-checked. Is.Equal
is the only method that takes two arguments.
// start a new type.
var Human = function(){};
Is.Human; // returns undefined
Is.not.Human // returns undefined
// create the Human type.
new Type('Human', Human);
Is.Human; // returns function
Is.not.Human; // returns function
var Garrick;
Is.Human(Garrick); // returns false
Garrick = new Human;
Is.Human(Garrick); // returns true
Performs an optimized deep comparison between the two objects, to determine if they should be considered equal.
Is.Equal(object, other);
object
- (Mixed)
Can be anything. Used to compare with other
object. Deep comparisons are done on Object
types where each item is compared with the each item in other
.other
- (Mixed)
Just like object
, can be anything.If either object
or other
contains an isEqual
method, that method is passed the opposing object that is being tested. The result will be returned by Equal
method and the comparisons stops there.
// Two objects that have the same properties, but are two different Object instances.
var a = {something: 'to', compare: 'to'},
b = {something: 'to', compare: 'to'};
a == b; // returns false
Is.Equal(a, b); // returns true because the properties are the same
// Change the properties
b = {something: 'else', to: {compare: 'to'}};
a == b; // returns false
Is.Equal(a, b); // returns false
// an isEqual that will be used to test two objects
a.isEqual = function(other){
// we know they do not equal, but lets just say it does
return true;
}
Is.Equal(a, b); // returns true
Type-check for NaN
.
Is.NaN('1'); // returns false
Is.NaN('NaN'); // returns false
Is.NaN(NaN); // returns true
Type-check for null
.
Is.Null(''); // returns false
Is.Null(undefined); // returns false
Is.Null(null); // returns true
Type-check for undefined
.
Is.Undefined(''); // returns false
Is.Undefined(null); // returns false
Is.Undefined(); // returns true
Is.Undefined(undefined); // returns true
Is.Undefined(void 0); // returns true
The following methods have been implemented from MooTools-Core Type
. They take the same arguments as their Type
counterparts. They also exist in Is.not
.
Arguments
Array
Boolean
Class
DOMEvent
Date
Document
Element
Elements
Enumerable
Function
IFrame
Number
Object
RegExp
String
TextNode
Type
WhiteSpace
Window
FAQs
MooTools Type-Test Utility
The npm package neuro-is receives a total of 18 weekly downloads. As such, neuro-is popularity was classified as not popular.
We found that neuro-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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.