@jellybeanci/int
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

int

npm

Integer type caster module for JavaScript/TypeScript.

npm i @jellybeanci/int

import module

// ES6 Syntax
import {int} from "@jellybeanci/int";

// Commonjs Syntax
const {int} = require("@jellybeanci/int");

// Commonjs with custom name
const integer = require("@jellybeanci/int").int;

usage

const integerNumber = int(floatingPointNumber);

const parsedIntegerNumber = int(stringNumber);

demo

console.log(int(3.1415)); // 3

console.log(int(-6.2342)); // -6

console.log(int("25.3")); // 25

console.log(int("not a number")); // 0

types

type intFunctionType = (numberValue: number | string) => number;

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.10latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.10
0.1.00
0.0.80
0.0.70
0.0.60
0.0.50
0.0.30
0.0.20
0.0.11

Package Sidebar

Install

npm i @jellybeanci/int

Weekly Downloads

1

Version

0.1.1

License

MIT

Unpacked Size

2.84 kB

Total Files

5

Last publish

Collaborators

  • jellybeanci