# jonschlinkert/is-number architecture

> Architecture diagram of the GitHub repository jonschlinkert/is-number, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jonschlinkert/is-number
- Repository: https://github.com/jonschlinkert/is-number
- Video tour (about a minute): https://gitdiagram.com/jonschlinkert/is-number/video

## Overview

#### Purpose and principal workflow

`is-number` is a small CommonJS library that determines whether an input is a finite number, accepting numeric primitives and non-blank numeric strings. The external JavaScript package consumer initiates the workflow by requiring the package and calling its exported predicate, which returns a boolean.

#### Components

##### Public predicate API — `index.js`

Exports the sole function, classifying the input by type, rejecting unsupported values, converting eligible strings with `Number`, and checking finiteness; this is the documented package entry point and implementation.

##### Package consumer — external, no repository path

Application code, user-input handling, parsers, or other JavaScript code that requires the package and supplies a value to the predicate.

##### JavaScript numeric runtime — external, no repository path

Provides `typeof`, string `trim`, unary numeric coercion, and either `Number.isFinite` or the global `isFinite` used by the implementation.

#### Relationships

- Package consumer -> Public predicate API: requires the package and calls the exported function; the package metadata identifies `index.js` as `main`.

- Public predicate API -> JavaScript numeric runtime: classifies values with `typeof`; accepts primitive numbers only when subtracting the value from itself yields zero, thereby rejecting `NaN` and infinities.

- Public predicate API -> JavaScript numeric runtime: trims strings and rejects blank strings before applying unary numeric coercion.

- Public predicate API -> JavaScript numeric runtime: checks coerced string results with `Number.isFinite`, falling back to global `isFinite` when unavailable.

- Public predicate API -> Package consumer: returns `true` for finite numeric numbers or numeric strings and `false` for unsupported, blank, nonnumeric, or non-finite inputs.

#### Coverage limits

The sampled repository contains only the package entry implementation and metadata; tests and benchmarks were excluded. No broader application orchestration, persistence, network interface, or runtime call-site behavior can be established.

Main entry points: [`index.js`](https://github.com/jonschlinkert/is-number/blob/master/index.js) (Numeric Predicate)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Public API"]
  node_predicate["Numeric Predicate<br/>CommonJS API"]
end

subgraph group_external["External Runtime"]
  node_consumer(("Package Consumer<br/>external actor"))
  node_runtime{{"JavaScript Runtime"}}
end

node_consumer -->|"calls predicate"| node_predicate
node_predicate -->|"classifies values"| node_runtime
node_predicate -->|"coerces strings"| node_runtime
node_predicate -.->|"checks finiteness"| node_runtime
node_predicate -->|"returns boolean"| node_consumer

click node_predicate "https://github.com/jonschlinkert/is-number/blob/master/index.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_predicate toneBlue
class node_consumer,node_runtime toneAmber
```

## Components

### Public API

Documented package entry point and predicate implementation.

- [Numeric Predicate](https://github.com/jonschlinkert/is-number/blob/master/index.js): CommonJS API · Classifies values as finite numbers or numeric strings. · `index.js`

### External Runtime

Package consumer and JavaScript numeric facilities.

- **Package Consumer**: external actor · JavaScript code that requires the package and supplies a value.
- **JavaScript Runtime**: runtime · Provides type checks, trimming, coercion, and finiteness checks.

## Connections

- Package Consumer → Numeric Predicate: calls predicate · Requires the package; package metadata identifies index.js as main.
- Numeric Predicate → JavaScript Runtime: classifies values · Uses typeof and self-subtraction to validate primitive numbers.
- Numeric Predicate → JavaScript Runtime: coerces strings · Trims strings, rejects blanks, and applies unary numeric coercion.
- Numeric Predicate → JavaScript Runtime: checks finiteness · Uses Number.isFinite or falls back to global isFinite.
- Numeric Predicate → Package Consumer: returns boolean · Returns true for finite numeric values and false otherwise.
