Past max. Value is still an integer-shaped double.
isSafeInteger. Also enforces the safe band → false.
Pick. Need exact counting / IDs → prefer safe check.
Compatibility
Browser & Runtime Support
_.isSafeInteger is a Lodash 4.x Lang helper based on Number.isSafeInteger. It runs anywhere Lodash runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash.
✓ Stable · Lodash 4.x
_.isSafeInteger()
Available in [email protected] full builds and the lodash/isSafeInteger modular import. Native Number.isSafeInteger is supported in all modern engines; Lodash provides a consistent API and polyfill-style behavior via its build.
100%With Lodash 4.x
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
_.isSafeIntegerLodash 4.x+
Bottom line: Safe for production once Lodash is loaded. Prefer import isSafeInteger from "lodash/isSafeInteger" for smaller bundles. Use it whenever counts or IDs must remain exact in JavaScript Numbers.
Frequently Asked Questions
_.isSafeInteger(value) returns true when value is an integer that fits exactly in an IEEE-754 double — between Number.MIN_SAFE_INTEGER and Number.MAX_SAFE_INTEGER inclusive.
An integer that round-trips exactly as a JavaScript Number. The range is -(2^53 - 1) … 2^53 - 1 (±9007199254740991).
Lodash does not coerce strings. Convert with Number(value) first when input arrives as text.
isInteger only checks integer-ness. isSafeInteger also rejects magnitudes outside the safe range (for example Number.MAX_SAFE_INTEGER + 1).
Yes in spirit — Lodash documents it as based on Number.isSafeInteger. Prefer the Lodash helper for consistent Lodash-style checks and modular imports.
Use import isSafeInteger from "lodash/isSafeInteger" or require("lodash/isSafeInteger") for tree-shaking friendly bundles. Full build: import _ from "lodash" then _.isSafeInteger.