Gathering detailed insights and metrics for @jsweb/truetype
Gathering detailed insights and metrics for @jsweb/truetype
Gathering detailed insights and metrics for @jsweb/truetype
Gathering detailed insights and metrics for @jsweb/truetype
Simple JS module to check types consistently and concisely
npm install @jsweb/truetype
Typescript
Module System
Node Version
NPM Version
TypeScript (92.75%)
JavaScript (7.25%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
2 Stars
108 Commits
1 Watchers
1 Branches
Updated on Dec 07, 2022
Latest Version
4.0.6
Package Id
@jsweb/truetype@4.0.6
Unpacked Size
9.75 kB
Size
3.37 kB
File Count
6
NPM Version
8.11.0
Node Version
16.16.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
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):
1import { isInteger, isDate, isNotNull } from '@jsweb/truetype'
1<script type="module"> 2 import { isNumber } from 'https://unpkg.com/@jsweb/truetype' 3 4 const number = isNumber(1) 5</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.
1instance(1) // returns Number 2 3class Foo { 4 constructor(x) { 5 this.x = x 6 } 7} 8 9const bar = new Foo(1) 10 11instance(bar) // returns Foo
Check if value
is of type
.
Can be a native or custom constructor name.
1is({}, 'Object') // returns true 2is([], 'Array') // returns true 3is('foo', 'String') // returns true 4is(false, 'Boolean') // returns true 5// ... 6 7class Foo { 8 constructor(x) { 9 this.x = x 10 } 11} 12 13const bar = new Foo(1) 14 15is(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.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/20 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More