@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;

Readme

Keywords

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