{"id":20393051,"url":"https://github.com/aichbauer/node-convert-string-to-number","last_synced_at":"2025-04-12T11:54:48.874Z","repository":{"id":31525773,"uuid":"128179586","full_name":"aichbauer/node-convert-string-to-number","owner":"aichbauer","description":"Convert a string to its numerical value (float or integer)","archived":false,"fork":false,"pushed_at":"2022-03-07T03:20:42.000Z","size":70,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T06:43:17.910Z","etag":null,"topics":["converter","float","integer","nodejs","number","string","string-parser"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aichbauer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2018-04-05T08:36:16.000Z","updated_at":"2024-05-14T18:58:32.000Z","dependencies_parsed_at":"2022-08-07T16:30:27.553Z","dependency_job_id":null,"html_url":"https://github.com/aichbauer/node-convert-string-to-number","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aichbauer%2Fnode-convert-string-to-number","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aichbauer%2Fnode-convert-string-to-number/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aichbauer%2Fnode-convert-string-to-number/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aichbauer%2Fnode-convert-string-to-number/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aichbauer","download_url":"https://codeload.github.com/aichbauer/node-convert-string-to-number/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248565051,"owners_count":21125415,"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":["converter","float","integer","nodejs","number","string","string-parser"],"created_at":"2024-11-15T03:47:09.411Z","updated_at":"2025-04-12T11:54:48.846Z","avatar_url":"https://github.com/aichbauer.png","language":"JavaScript","readme":"# convert-string-to-number\n\n[![npm](https://img.shields.io/npm/v/convert-string-to-number.svg?style=flat-square)](https://www.npmjs.com/package/convert-string-to-number)\n[![Travis branch](https://img.shields.io/travis/aichbauer/node-convert-string-to-number/master.svg?style=flat-square)](https://travis-ci.org/aichbauer/node-convert-string-to-number)\n[![Codecov branch](https://img.shields.io/codecov/c/github/aichbauer/node-convert-string-to-number/master.svg?style=flat-square)](https://codecov.io/gh/aichbauer/node-convert-string-to-number)\n\n\u003e Convert a string to its numerical value (float or integer)\n\n## Table of Contents\n\n* [Why?](#why)\n* [Installation](#installation)\n* [Functions](#functions)\n* [Usage](#usage)\n* [License](#license)\n\n## Why?\n\nI needed a simple way to parse string numbers to its matching numerical value, for parsing csv formatted files.\n\n## Installation\n\n```sh\n$ npm i convert-string-to-number -S\n```\n\nor\n\n```sh\n$ yarn add convert-string-to-number\n```\n\n## Functions\n\nTake a look into the [usage section](#usage) for a detailed example.\n\n### convertStringToNumber\n\n\u003e Note: you can also use the default export.\n\nThis function converts a string to its numerical value (float, int, or NaN).\n\n#### Syntax\n\nReturns a number or NaN.\n\n```js\nconst number = convertStringToNumber(value);\n```\n\n##### Parameters\n\n* **value**: a string\n\n## Usage\n\nAn example how to use it.\n\n```js\nconst { convertStringToNumber } = require('convert-string-to-number'); // named export\nconst converter = require('convert-string-to-number'); // default export\n\nconst int = convertStringToNumber('2'); // =\u003e 2\nconst float = converter('2.2'); // =\u003e 2.2\nconst notANumber = converter('franz'); // =\u003e NaN\n```\n\n## License\n\nMIT © Lukas Aichbauer\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faichbauer%2Fnode-convert-string-to-number","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faichbauer%2Fnode-convert-string-to-number","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faichbauer%2Fnode-convert-string-to-number/lists"}