Giter VIP home page Giter VIP logo

Comments (3)

Uzef1997 avatar Uzef1997 commented on June 21, 2024

Information :-

System: OS: Windows 10 10.0.19042 CPU: (8) x64 Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz Memory: 559.27 MB / 7.82 GB Binaries: Node: 16.13.1 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.18 - ~\AppData\Roaming\npm\yarn.CMD npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: API Levels: 28, 30, 33 Build Tools: 30.0.2, 33.0.0 System Images: android-30 | Google APIs Intel x86 Atom Android NDK: Not Found Windows SDK: Not Found IDEs: Android Studio: Not Found Visual Studio: Not Found Languages: Java: Not Found npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.66.4 => 0.66.4 react-native-windows: Not Found npmGlobalPackages: react-native: Not Found

I got this error when i tried to parse value of gs128 type barcode which is having expiry date here is the barcode which i tried to parse image

here is the error which i am getting image

Please help me thank you

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my above problem:

diff --git a/node_modules/bark-js/src/gs1/dataReaders.js b/node_modules/bark-js/src/gs1/dataReaders.js
index ae0fe4a..4531f6c 100644
--- a/node_modules/bark-js/src/gs1/dataReaders.js
+++ b/node_modules/bark-js/src/gs1/dataReaders.js
@@ -1,7 +1,7 @@
 
 const injectDecimal = require('./utils/injectDecimal')
 
-exports.fixedLength = (length) => ({
+export const fixedLength = (length) => ({
   barcode,
   fnc = String.fromCharCode(29),
 }) => {
@@ -46,7 +46,7 @@ exports.fixedLengthDecimal = (length, decimalPositionFromEnd) => ({
   barcode,
   fnc = String.fromCharCode(29),
 }) => {
-  const { value: originalValue, raw } = this.fixedLength(length)({ barcode, fnc })
+  const { value: originalValue, raw } = fixedLength(length)({ barcode, fnc })
   const value = injectDecimal(originalValue, decimalPositionFromEnd)
   return {
     value,
@@ -115,7 +115,8 @@ exports.date = () => ({
   barcode,
   fnc = String.fromCharCode(29),
 }) => {
-  const { value: yymmdd, raw } = this.fixedLength(6)({ barcode, fnc })
+
+  const { value: yymmdd, raw } = fixedLength(6)({ barcode, fnc })
 
   const year = parseInt(yymmdd.slice(0, 2), 10)
   const month = yymmdd.slice(2, 4)
@@ -142,7 +143,7 @@ exports.dateTime = ({ optionalMinutesAndSeconds = false } = {}) => ({
   barcode,
   fnc = String.fromCharCode(29),
 }) => {
-  const { value: yymmddhhmm, raw } = this.fixedLength(optionalMinutesAndSeconds ? 12 : 10)({ barcode, fnc })
+  const { value: yymmddhhmm, raw } = fixedLength(optionalMinutesAndSeconds ? 12 : 10)({ barcode, fnc })
 
   const { value: yymmdd } = this.date()({
     barcode: yymmddhhmm.slice(0, 6),

from bark-js.

Sleavely avatar Sleavely commented on June 21, 2024

First off, thanks for the thorough report!

This seems related to #13 and #23 which are partially fixed by #24 (which is basically the same as the diff you posted). I would love to know more about your build process to understand what may be causing the issue - are you using Rollup, Webpack, Esbuild or similar? Could you share you build config here?

Regardless, since it seems to be a recurring problem I will merge and publish a patch this weekend.

from bark-js.

Uzef1997 avatar Uzef1997 commented on June 21, 2024

Hello there i am using webpack

from bark-js.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.