{"id":21640607,"url":"https://github.com/ppvg/svg-numbers","last_synced_at":"2025-04-11T16:53:23.613Z","repository":{"id":12098522,"uuid":"14687127","full_name":"ppvg/svg-numbers","owner":"ppvg","description":"Parse SVG coordinates in JavaScript.","archived":false,"fork":false,"pushed_at":"2013-11-30T11:07:16.000Z","size":160,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T13:01:56.361Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/ppvg.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":"2013-11-25T14:04:42.000Z","updated_at":"2021-02-04T15:34:01.000Z","dependencies_parsed_at":"2022-09-26T18:20:22.846Z","dependency_job_id":null,"html_url":"https://github.com/ppvg/svg-numbers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppvg%2Fsvg-numbers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppvg%2Fsvg-numbers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppvg%2Fsvg-numbers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppvg%2Fsvg-numbers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ppvg","download_url":"https://codeload.github.com/ppvg/svg-numbers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248443589,"owners_count":21104454,"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":[],"created_at":"2024-11-25T04:19:13.303Z","updated_at":"2025-04-11T16:53:23.594Z","avatar_url":"https://github.com/ppvg.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# svg-numbers\n\nParser and serializer for lists of coordinates in SVG documents, such as [the `points` attribute of a `\u003cpolyline\u003e` element](http://www.w3.org/TR/SVG/shapes.html#PointsBNF).\n\n[![NPM version](https://badge.fury.io/js/svg-numbers.png)](http://badge.fury.io/js/svg-numbers) [![Build status](https://travis-ci.org/PPvG/svg-numbers.png?branch=master)](https://travis-ci.org/PPvG/svg-numbers)\n\n## Installation\n\nWith [npm](https://npmjs.org/): `$ npm install svg-numbers`\n\n## Usage\n\n### Parsing\n\n    var parse = require('svg-numbers').parse\n\n    var numbers = parse('10, 15.20.8 -11,15-25+75 4.2e3')\n    console.log(numbers)\n    // [ 10, 15.2, .8, -11, 15, -25, 75, 4200 ]\n\n### Serializing\n\n    var serialize = require('svg-numbers').serialize\n\n    var numbers = [10, 4.2, .333, -8]\n    var str = serialize(numbers)\n    console.log(str)\n    // '10,4.2.333-8'\n\nSeparators (commas and/or spaces) are left out wherever the SVG recommendation allows it. If you'd rather have separators everywhere, just use `Array.prototype.join`:\n\n    var str = numbers.join(', ')\n    console.log(str)\n    // '10, 4.2, .333, -8'\n\n### Catching syntax errors\n\nIf a syntax error is found, an error is thrown. The valid coordinates up to and until the syntax error are available as `error.partial`:\n\n    try {\n      var numbers = parse('10, 20, , 30, 40')\n    } catch (error) {\n      console.log(error.partial)\n      // [ 10, 20 ]\n    }\n\n(The W3C SVG recommendation has something to say about [error processing](http://www.w3.org/TR/SVG/implnote.html#ErrorProcessing).)\n\n## Running the tests\n\n    $ git clone https://github.com/PPvG/svg-numbers\n\n    $ cd svg-numbers\n\n    $ npm install\n\n    $ npm test\n\n## Browser support\n\nUse [browserify](http://browserify.org/). All major browsers are supported:\n\n[![Browser support](https://ci.testling.com/PPvG/svg-numbers.png)](https://ci.testling.com/PPvG/svg-numbers)\n\n## License\n\n[MIT](https://raw.github.com/PPvG/svg-numbers/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppvg%2Fsvg-numbers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fppvg%2Fsvg-numbers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppvg%2Fsvg-numbers/lists"}