Skip to content

Basic integer casting module for JavaScript/TypeScript.

License

Notifications You must be signed in to change notification settings

jellybeanci/int

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

index

npm

Integer type caster module for JavaScript/TypeScript.

npm i @jellybeanci/index

import module

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

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

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

usage

const integerNumber = index(floatingPointNumber);

const parsedIntegerNumber = index(stringNumber);

demo

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

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

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

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

types

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

About

Basic integer casting module for JavaScript/TypeScript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published