{"id":15744055,"url":"https://github.com/stonelasley/barcode-parsing","last_synced_at":"2025-05-13T01:05:09.317Z","repository":{"id":17547375,"uuid":"82215537","full_name":"stonelasley/barcode-parsing","owner":"stonelasley","description":"Parse values from common barcode symbologies","archived":false,"fork":false,"pushed_at":"2023-03-04T04:02:13.000Z","size":1867,"stargazers_count":1,"open_issues_count":11,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-15T07:27:22.957Z","etag":null,"topics":["barcode","barcodes","gs1","gs1-128","gtin","gtin-codes","itf14","itf8","wedge-scanner"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stonelasley.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-16T19:01:47.000Z","updated_at":"2023-01-08T20:25:26.000Z","dependencies_parsed_at":"2024-10-04T03:40:43.315Z","dependency_job_id":"5f495a1a-64bf-4aab-aad7-fbf3be2ffc12","html_url":"https://github.com/stonelasley/barcode-parsing","commit_stats":{"total_commits":97,"total_committers":3,"mean_commits":"32.333333333333336","dds":0.3298969072164949,"last_synced_commit":"421727123c8716fce22b867e026bb51319b42165"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stonelasley%2Fbarcode-parsing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stonelasley%2Fbarcode-parsing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stonelasley%2Fbarcode-parsing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stonelasley%2Fbarcode-parsing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stonelasley","download_url":"https://codeload.github.com/stonelasley/barcode-parsing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246588743,"owners_count":20801527,"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":["barcode","barcodes","gs1","gs1-128","gtin","gtin-codes","itf14","itf8","wedge-scanner"],"created_at":"2024-10-04T03:40:31.440Z","updated_at":"2025-04-01T12:30:34.329Z","avatar_url":"https://github.com/stonelasley.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![npm](https://img.shields.io/npm/v/barcode-parser)\r\n[![Coverage Status](https://coveralls.io/repos/github/stonelasley/barcode-parsing/badge.svg?branch=master)](https://coveralls.io/github/stonelasley/barcode-parsing?branch=master)\r\n[![Build](https://github.com/stonelasley/barcode-parsing/actions/workflows/test-release.yml/badge.svg)](https://github.com/stonelasley/barcode-parsing/actions/workflows/test-release.yml)\r\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\r\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\r\n[![Total alerts](https://img.shields.io/lgtm/alerts/g/stonelasley/barcode-parsing.svg?logo=lgtm\u0026logoWidth=18)](https://lgtm.com/projects/g/stonelasley/barcode-parsing/alerts/)\r\n[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/stonelasley/barcode-parsing.svg?logo=lgtm\u0026logoWidth=18)](https://lgtm.com/projects/g/stonelasley/barcode-parsing/context:javascript)\r\n\r\n\r\n\r\n# Barcode-Parsing\r\n\r\nthis package has a fairly narrow scope and is used in conjunction with an [Ionic](https://ionicframework.com/) project to read values provided by a physical wedge scanner and parse out the values. I am working on wrapping up the scanning angular component that consumes this directly. \r\n\r\n\r\n## Usage\r\n```javascript\r\n    const barcodeParser = new BarcodeParser({\r\n        readers: [\r\n            Symbologies.Code39,\r\n            Symbologies.ITF8,\r\n            ...Symbologies.GTINX // This spreads to support all GTIN lengths 8-14\r\n        ],\r\n        readerConfigurations: [\r\n            {\r\n              symbology: Symbologies.Code39,\r\n              values: [\r\n                {\r\n                  length: 2,\r\n                  start: 0,\r\n                  valueType: 'foo'\r\n                },\r\n                {\r\n                  length: 3,\r\n                  start: 2,\r\n                  valueType: 'bar'\r\n                }\r\n              ]\r\n            }\r\n        ]\r\n    });\r\n\r\n\r\n\r\n    const itfResult = barcodeParser.parse(']I010734074010258');\r\n    // {\r\n    //   symbology: 'itf_14',\r\n    //   rawValue: ']I010734074010258',\r\n    //   checkDigit: 8,\r\n    //   success: true,\r\n    //   values: '1073407401025'\r\n    // }\r\n\r\n    // the below input with spaces would never be valid from a scanner, the spaces would instead be an invisible [group seperator](http://www.theasciicode.com.ar/ascii-control-characters/group-separator-ascii-code-29.html). This library replaces the GS character with a space before parsing so it works for both illustrative purposes and testing. \r\n    const code128Result = barcodeParser.parse(']C100111111111111111111101234 30100 310600100');\r\n    code128Result.pluck(AICode.BatchLot) // '1234'\r\n    code128Result.pluck(AICode.SerialShippingContainerCode) // '111111111111111111'\r\n    code128Result.pluck(AICode.CountOfItems) // '100'\r\n    code128Result.pluck(AICode.ProductNetWeightKg) // .0001\r\n\r\n    // {\r\n    //   symbology: 'gs1_128',\r\n    //   rawValue: ']C100111111111111111111101234 30100 310600100',\r\n    //   checkDigit: -1,\r\n    //   success: true,\r\n    //   values: [\r\n    //     {\r\n    //       code: '10',\r\n    //       value: '1234'\r\n    //     },\r\n    //     {\r\n    //       code: '00',\r\n    //       value: '111111111111111111'\r\n    //     },\r\n    //     {\r\n    //       code: '30',\r\n    //       value: '100'\r\n    //     },\r\n    //     {\r\n    //       'code': '310',\r\n    //       'value': 0.0001\r\n    //     }\r\n    //   ]\r\n    // }  \r\n\r\n    const code39Result = barcodeParser.parse(']A01234567777777');\r\n    code39Result.success // true\r\n    code39Result.errorMessage // undefined\r\n    code39Result.pluck('foo') // '12'\r\n    code39Result.pluck('bar') // '345'\r\n    code39Result.pluck('bizz') // undefined\r\n    {\r\n      symbology: 'code_39',\r\n      rawValue: ']A01234567777777',\r\n      checkDigit: -1,\r\n      success: true,\r\n      values: [\r\n        {\r\n          code: 'foo',\r\n          value: '12'\r\n        },\r\n        {\r\n          code: 'bar',\r\n          value: '345'\r\n        }\r\n      ]\r\n    }\r\n\r\n    const invalidInputResult = barcodeParser.parse(']Z00000000');\r\n    invalidInputResult.success // false\r\n    invalidInputResult.errorMessage // 'No Reader Found'\r\n    // {\r\n    //   symbology: null,\r\n    //   rawValue: ']Z00000000',\r\n    //   checkDigit: -1,\r\n    //   success: false,\r\n    //   values: [],\r\n    //   errorMessage: 'No Reader Found'\r\n    // }\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstonelasley%2Fbarcode-parsing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstonelasley%2Fbarcode-parsing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstonelasley%2Fbarcode-parsing/lists"}