{"id":24079917,"url":"https://github.com/hypersoftllc/qc-to_int","last_synced_at":"2025-06-13T10:09:47.885Z","repository":{"id":65371674,"uuid":"90197822","full_name":"hypersoftllc/qc-to_int","owner":"hypersoftllc","description":"A simple JavaScript utility to convert various value to an integer.","archived":false,"fork":false,"pushed_at":"2017-06-02T19:54:10.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-06-13T10:09:41.751Z","etag":null,"topics":["javascript-utility"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hypersoftllc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-03T22:14:11.000Z","updated_at":"2017-05-18T16:10:18.000Z","dependencies_parsed_at":"2023-01-19T22:55:22.674Z","dependency_job_id":null,"html_url":"https://github.com/hypersoftllc/qc-to_int","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/hypersoftllc/qc-to_int","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypersoftllc%2Fqc-to_int","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypersoftllc%2Fqc-to_int/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypersoftllc%2Fqc-to_int/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypersoftllc%2Fqc-to_int/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hypersoftllc","download_url":"https://codeload.github.com/hypersoftllc/qc-to_int/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypersoftllc%2Fqc-to_int/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259624736,"owners_count":22886330,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript-utility"],"created_at":"2025-01-09T22:26:35.494Z","updated_at":"2025-06-13T10:09:47.857Z","avatar_url":"https://github.com/hypersoftllc.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# qc-to_int\n\n[![Build Status][travis-svg]][travis-url]\n[![Coverage Status][coverage-image]][coverage-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\n[![npm badge][npm-badge-png]][package-url]\n\nA simple JavaScript utility to convert various values to an integer.\n\n**What it does that `parseInt` doesn't**\n\n* Allow a default value to be set instead of returning `NaN`.\n* Convert `'-0'` to `0` instead of `-0`.\n* Convert strings in scientific notation to the correct value.\n  - `'1e-4'` is converted to `0` instead of `1`.\n* Convert very large numbers written in scientific notation to the correct\n  value.\n  - `6.022e23` is converted to `6.022e23` instead of `6`.\n* Convert `Number.MIN_VALUE` to `0` instead of `5`.\n* Convert `Number.MAX_VALUE` to `Number.MAX_VALUE` instead of `1`.\n* Convert `Infinity` to `Infinity` instead of `NaN`.\n\n\n## Installation\n\n```sh\nnpm install --save qc-to_int\n```\n\n\n## Example Usage\n\n```js\nimport { toInt, toIntOrNull } from 'qc-to_int';\n\ntoInt('+3.1459');         // 3\ntoInt('1e4');             // 10000\ntoInt('-2.6');            // -3\ntoInt(-2.6);              // -3\ntoInt();                  // `undefined`\ntoIntOrNull();            // `null`\ntoInt('');                // `''`\ntoIntOrNull('');          // `null`\ntoInt('', 0);             // `0`\ntoInt('', { def: 0 });    // `0`\ntoInt(NaN);               // `NaN`\ntoIntOrNull(NaN);         // `null`\ntoInt(null);              // `null`\ntoIntOrNull(null);        // `null`\ntoInt(undefined);         // `undefined`\ntoIntOrNull(undefined);   // `null`\n```\n\n\n[coverage-image]: https://coveralls.io/repos/github/hypersoftllc/qc-to_int/badge.svg?branch=master\n[coverage-url]: https://coveralls.io/github/hypersoftllc/qc-to_int?branch=master\n[downloads-image]: http://img.shields.io/npm/dm/qc-to_int.svg\n[downloads-url]: http://npm-stat.com/charts.html?package=qc-to_int\n[license-image]: http://img.shields.io/npm/l/qc-to_int.svg\n[license-url]: LICENSE\n[package-url]: https://npmjs.org/package/qc-to_int\n[npm-badge-png]: https://nodei.co/npm/qc-to_int.png?downloads=true\u0026stars=true\n[travis-svg]: https://travis-ci.org/hypersoftllc/qc-to_int.svg?branch=master\n[travis-url]: https://travis-ci.org/hypersoftllc/qc-to_int\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhypersoftllc%2Fqc-to_int","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhypersoftllc%2Fqc-to_int","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhypersoftllc%2Fqc-to_int/lists"}