Comparing version 7.0.0 to 7.1.0
{ | ||
"name": "typical", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "7.0.0", | ||
"version": "7.1.0", | ||
"description": "Isomorphic, functional type-checking for Javascript", | ||
"repository": "https://github.com/75lb/typical", | ||
"license": "MIT", | ||
"main": "./index.mjs", | ||
"exports": "./index.mjs", | ||
"type": "module", | ||
"exports": "./index.js", | ||
"keywords": [ | ||
@@ -38,18 +38,18 @@ "type", | ||
"engines": { | ||
"node": ">=14" | ||
"node": ">=12.17" | ||
}, | ||
"scripts": { | ||
"test": "npm run test:cli && npm run test:web", | ||
"test:cli": "test-runner test/*.mjs", | ||
"test:web": "web-runner test/*.mjs", | ||
"docs": "jsdoc2md -c jsdoc.conf -t README.hbs index.mjs > README.md", | ||
"test:cli": "test-runner test/*.js", | ||
"test:web": "web-runner test/test.js", | ||
"docs": "jsdoc2md -c jsdoc.conf -t README.hbs index.js > README.md", | ||
"cover": "c8 npm test && c8 report --reporter=text-lcov | coveralls" | ||
}, | ||
"devDependencies": { | ||
"@test-runner/web": "^0.3.5", | ||
"c8": "^7.7.2", | ||
"coveralls": "^3.1.0", | ||
"isomorphic-assert": "^0.2.0", | ||
"@test-runner/web": "^0.4.4", | ||
"c8": "^7.8.0", | ||
"coveralls": "^3.1.1", | ||
"isomorphic-assert": "^1.0.0", | ||
"jsdoc-to-markdown": "^7.0.1", | ||
"rollup": "^2.51.1", | ||
"rollup": "^2.56.2", | ||
"test-object-model": "^0.7.1" | ||
@@ -56,0 +56,0 @@ }, |
@@ -0,1 +1,3 @@ | ||
head | ||
[![view on npm](https://badgen.net/npm/v/typical)](https://www.npmjs.org/package/typical) | ||
@@ -5,4 +7,5 @@ [![npm module downloads](https://badgen.net/npm/dt/typical)](https://www.npmjs.org/package/typical) | ||
[![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/typical)](https://github.com/75lb/typical/network/dependents?dependent_type=PACKAGE) | ||
[![Build Status](https://travis-ci.org/75lb/typical.svg?branch=master)](https://travis-ci.org/75lb/typical) | ||
[![Node.js CI](https://github.com/75lb/typical/actions/workflows/node.js.yml/badge.svg)](https://github.com/75lb/typical/actions/workflows/node.js.yml) | ||
[![Coverage Status](https://coveralls.io/repos/github/75lb/typical/badge.svg)](https://coveralls.io/github/75lb/typical) | ||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) | ||
@@ -17,3 +20,3 @@ | ||
```js | ||
const t = require('typical') | ||
import * as t from 'typical' | ||
const allDefined = array.every(t.isDefined) | ||
@@ -24,2 +27,3 @@ ``` | ||
* [.isNumber(n)](#module_typical.isNumber) ⇒ <code>boolean</code> | ||
* [.isFiniteNumber(n)](#module_typical.isFiniteNumber) ⇒ <code>boolean</code> | ||
* [.isPlainObject(input)](#module_typical.isPlainObject) ⇒ <code>boolean</code> | ||
@@ -42,9 +46,10 @@ * [.isArrayLike(input)](#module_typical.isArrayLike) ⇒ <code>boolean</code> | ||
### t.isNumber(n) ⇒ <code>boolean</code> | ||
Returns true if input is a number. It is a more reasonable alternative to `typeof n` which returns `number` for `NaN` and `Infinity`. | ||
Returns true if input is a number (including infinity). It is a more reasonable alternative to `typeof n` which returns `number` for `NaN`. | ||
**Kind**: static method of [<code>typical</code>](#module_typical) | ||
**Returns**: <code>boolean</code> - `true` if input is a number | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| n | <code>\*</code> | the input to test | | ||
| n | <code>\*</code> | The input to test | | ||
@@ -68,3 +73,33 @@ **Example** | ||
> t.isNumber(Infinity) | ||
true | ||
``` | ||
<a name="module_typical.isFiniteNumber"></a> | ||
### t.isFiniteNumber(n) ⇒ <code>boolean</code> | ||
Returns true if input is a finite number. Identical to `isNumber` beside excluding infinity. | ||
**Kind**: static method of [<code>typical</code>](#module_typical) | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| n | <code>\*</code> | The input to test | | ||
**Example** | ||
```js | ||
> t.isFiniteNumber(0) | ||
true | ||
> t.isFiniteNumber(1) | ||
true | ||
> t.isFiniteNumber(1.1) | ||
true | ||
> t.isFiniteNumber(0xff) | ||
true | ||
> t.isFiniteNumber(0644) | ||
true | ||
> t.isFiniteNumber(6.2e5) | ||
true | ||
> t.isFiniteNumber(NaN) | ||
false | ||
> t.isFiniteNumber(Infinity) | ||
false | ||
``` | ||
@@ -80,3 +115,3 @@ <a name="module_typical.isPlainObject"></a> | ||
| --- | --- | --- | | ||
| input | <code>\*</code> | the input to test | | ||
| input | <code>\*</code> | The input to test | | ||
@@ -113,3 +148,3 @@ **Example** | ||
| --- | --- | --- | | ||
| input | <code>\*</code> | the input to test | | ||
| input | <code>\*</code> | The input to test | | ||
@@ -132,3 +167,3 @@ **Example** | ||
| --- | --- | --- | | ||
| input | <code>\*</code> | the input to test | | ||
| input | <code>\*</code> | The input to test | | ||
@@ -144,3 +179,3 @@ <a name="module_typical.isDefined"></a> | ||
| --- | --- | --- | | ||
| input | <code>\*</code> | the input to test | | ||
| input | <code>\*</code> | The input to test | | ||
@@ -156,3 +191,3 @@ <a name="module_typical.isUndefined"></a> | ||
| --- | --- | --- | | ||
| input | <code>\*</code> | the input to test | | ||
| input | <code>\*</code> | The input to test | | ||
@@ -168,3 +203,3 @@ <a name="module_typical.isNull"></a> | ||
| --- | --- | --- | | ||
| input | <code>\*</code> | the input to test | | ||
| input | <code>\*</code> | The input to test | | ||
@@ -180,3 +215,3 @@ <a name="module_typical.isDefinedValue"></a> | ||
| --- | --- | --- | | ||
| input | <code>\*</code> | the input to test | | ||
| input | <code>\*</code> | The input to test | | ||
@@ -192,3 +227,3 @@ <a name="module_typical.isClass"></a> | ||
| --- | --- | --- | | ||
| input | <code>\*</code> | the input to test | | ||
| input | <code>\*</code> | The input to test | | ||
@@ -204,3 +239,3 @@ <a name="module_typical.isPrimitive"></a> | ||
| --- | --- | --- | | ||
| input | <code>\*</code> | the input to test | | ||
| input | <code>\*</code> | The input to test | | ||
@@ -216,3 +251,3 @@ <a name="module_typical.isPromise"></a> | ||
| --- | --- | --- | | ||
| input | <code>\*</code> | the input to test | | ||
| input | <code>\*</code> | The input to test | | ||
@@ -228,3 +263,3 @@ <a name="module_typical.isIterable"></a> | ||
| --- | --- | --- | | ||
| input | <code>\*</code> | the input to test | | ||
| input | <code>\*</code> | The input to test | | ||
@@ -275,3 +310,3 @@ **Example** | ||
| --- | --- | --- | | ||
| input | <code>\*</code> | the input to test | | ||
| input | <code>\*</code> | The input to test | | ||
@@ -287,3 +322,3 @@ <a name="module_typical.isFunction"></a> | ||
| --- | --- | --- | | ||
| input | <code>\*</code> | the input to test | | ||
| input | <code>\*</code> | The input to test | | ||
@@ -295,12 +330,12 @@ | ||
Node.js: | ||
Within a Node.js ECMAScript Module: | ||
```js | ||
const typical = require('typical') | ||
import * as typical from 'typical' | ||
``` | ||
Within Node.js with ECMAScript Module support enabled: | ||
or | ||
```js | ||
import typical from 'typical' | ||
import { isNumber } from 'typical' | ||
``` | ||
@@ -314,12 +349,6 @@ | ||
Old browser (adds `window.typical`): | ||
```html | ||
<script nomodule src="./node_modules/typical/dist/index.js"></script> | ||
``` | ||
* * * | ||
© 2014-20 Lloyd Brookes \<75pound@gmail.com\>. | ||
© 2014-21 Lloyd Brookes \<75pound@gmail.com\>. | ||
Isomorphic test suite by [esm-runner](https://github.com/test-runner-js/esm-runner) and [web-runner](https://github.com/test-runner-js/web-runner). Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown). | ||
Isomorphic test suite by [test-runner](https://github.com/test-runner-js/test-runner) and [web-runner](https://github.com/test-runner-js/web-runner). Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
335
Yes
13883
4
0
2