![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.
@jsweb/truetype
Advanced tools
Simple JS module to check types consistently and concisely.
Tests coverage at https://truetype.jsweb.app
Checking types in JavaScript is not so easy...
The builtin operators typeof
, instanceof
and other methods are not precise enough to report the exact type of a value.
So, this module aims to check types of variables with more useful returns.
Now, its a full ES module, there is no UMD or CommonJS version.
ES modules are the new pattern in modern JS development, already supported in newer versions of Node.js and modern borwsers natively.
Backward compatibility is not a concern here. If you use a module bundler (like Webpack or Rollup) to transpile your code, the result will be compatible according to your setup.
You can install with NPM, Yarn or Unpkg CDN:
npm i -S @jsweb/truetype
yarn add @jsweb/truetype
pnpm add @jsweb/truetype
Tree shaking (since v3.0.0):
import { isInteger, isDate, isNotNull } from '@jsweb/truetype'
<script type="module">
import { isNumber } from 'https://unpkg.com/@jsweb/truetype'
const number = isNumber(1)
</script>
Check if a value is not undefined.
Check if value is null.
Check if value is not null.
Check if value is "valid" (is not null or undefined).
Get the constructor name of the value.
Returns a string with a type name like Object
, Array
, String
, Number
, ...
Can be a native or custom constructor name.
instance(1) // returns Number
class Foo {
constructor(x) {
this.x = x
}
}
const bar = new Foo(1)
instance(bar) // returns Foo
Check if value
is of type
.
Can be a native or custom constructor name.
is({}, 'Object') // returns true
is([], 'Array') // returns true
is('foo', 'String') // returns true
is(false, 'Boolean') // returns true
// ...
class Foo {
constructor(x) {
this.x = x
}
}
const bar = new Foo(1)
is(bar, 'Foo') // returns true
Check if value is a boolean.
Check if value is a string.
Check if value is a number.
Check if value is an integer number.
Check if value is a float point number.
Check if value is an object.
Check if value is an Array.
Check if value is a Date object.
Check if value is a Regular Expression.
Check if value is a function.
This is a bonus utility.
Check if value is empty.
Only for string, array and objects. Any other type will return false.
FAQs
Simple JS module to check types consistently and concisely
We found that @jsweb/truetype 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.