![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
assert-types
Advanced tools
A small JavaScript library for arguments assertion. Browser and Node.JS compatible.
The main mission is to provide simple and slick API for checking arguments and throwing exceptions. Let's get rid of explicit complex conditions.
7.5 Kb unminified with comments, 3.6 Kb minified
npm install assert-types
Install dependencies
npm install && bower install
Build Project
npm run build
Run Tests
npm run test
If you're running in Node.js, you can require
assertTypes.js like so:
var assertTypes = require('assert-types');
It also supports Require.js:
require.config({
paths: {
'assert-types': 'assert-types.js/dist/assert-types.min.js'
}
});
require(['assert-types'], function(assert) {});
Also assertTypes.js could be included with an HTML <script>
tag and assertTypes
variable will be visible globally.
// Numbers
assertTypes.number(num);
assertTypes.numberPositive(num);
assertTypes.numberNegative(num);
assertTypes.numberOdd(num);
assertTypes.numberEven(num);
assertTypes.numberInt(num);
assertTypes.numberFloat(num);
assertTypes.numberRange(num, min, max);
// Equals
assertTypes.equal(value, expectedValue);
// Boolean
assertTypes.bool(value);
assertTypes.boolTrue(value);
assertTypes.boolFalse(value);
// String
assertTypes.string(value);
assertTypes.stringNotEmpty(value);
// Other
assertTypes.object(value);
assertTypes.fn(value);
assertTypes.array(value);
assertTypes.instance(value, instance);
assertTypes.nulled(value);
assertTypes.defined(value);
assertTypes.date(value);
In case if assertion is failed, assertTypes will throw Error.
Also the library has possibility to define conditions. Let's take a look here:
// These could be translated as: if value is defined then it should be a number
assertTypes.number(value, assertTypes.conditionIfDefined);
// Other examples
assertTypes.object(value, assertTypes.conditionIfDefined);
// You can define your own conditions
assertTypes.defined(value, today === 'Friday');
// Condition could be a function
assertTypes.numberPositive(value, function(value) {
return today === 'Friday' || today === 'Monday';
});
The assertion will be performed if condition is true;
FAQs
A small JavaScript library for arguments assertion
The npm package assert-types receives a total of 0 weekly downloads. As such, assert-types popularity was classified as not popular.
We found that assert-types 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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.