edi9999 / jsqrcode

[deprecated] Lazarsoft's jsqrcode as a node module, object oriented, and with tests
Apache License 2.0
278 stars 63 forks source link

returned values from qrcode.process() do not include bounding box #35

Closed yellowdoge closed 7 years ago

yellowdoge commented 7 years ago

In this line I see return qrcode.decode_utf8(str);

however in my local npm package I have return {url: this.decode_utf8(str), points: qRCodeMatrix.points}; which also makes sense to me, otherwise why do we create qRCodeMatrix.

I might very well need to file this upstream, but I'm starting here since that's the package I'm using.

My local npm package details are:

{ name: 'qrcode-reader',
  description: 'fork of lazarsoft\'s jsqrcode for node',
  'dist-tags': { latest: '0.2.2' },
  versions: 
   [ '0.0.1',
     '0.0.2',
     '0.0.3',
     '0.0.4',
     '0.0.5',
     '0.0.6',
     '0.0.7',
     '0.1.0',
     '0.1.1',
     '0.2.0',
     '0.2.1',
     '0.2.2' ],
  maintainers: [ 'edi9999 <hipp.edg@gmail.com>' ],
  time: 
   { modified: '2016-12-05T02:54:16.907Z',
     created: '2014-08-20T17:36:54.679Z',
     '0.0.1': '2014-08-20T17:36:54.679Z',
     '0.0.2': '2014-08-20T17:53:45.257Z',
     '0.0.3': '2014-08-20T17:55:47.110Z',
     '0.0.4': '2014-08-20T18:06:50.551Z',
     '0.0.5': '2014-08-21T08:45:23.429Z',
     '0.0.6': '2015-10-28T20:15:29.821Z',
     '0.0.7': '2015-10-28T20:17:21.944Z',
     '0.1.0': '2016-01-14T07:01:27.192Z',
     '0.1.1': '2016-04-11T06:28:06.788Z',
     '0.2.0': '2016-06-23T07:19:05.609Z',
     '0.2.1': '2016-06-23T07:20:16.920Z',
     '0.2.2': '2016-09-14T06:18:24.194Z' },
  homepage: 'https://github.com/edi9999/jsqrcode',
  repository: 
   { type: 'git',
     url: 'git+https://github.com/edi9999/jsqrcode.git' },
  bugs: { url: 'https://github.com/edi9999/jsqrcode/issues' },
  license: 'MIT',
  readmeFilename: 'README.md',
  users: 
   { shanewholloway: true,
     manvalls: true,
     jasonevrtt: true,
     gsimone: true,
     '3846masa': true },
  version: '0.2.2',
  main: 'dist/index.js',
  module: 'src/index.js',
  'jsnext:main': 'src/index.js',
  scripts: 
   { build: 'rollup -c',
     watch: 'rollup -c -w',
     minify: 'uglifyjs dist/index.js -o dist/index.min.js --compress --mangle',
     lint: 'eslint src test',
     pretest: 'npm run lint',
     test: 'mocha',
     'build-and-test': 'npm run build && npm test',
     prepublish: 'npm run build && npm run minify' },
  author: '',
  devDependencies: 
   { chai: '^1.9.1',
     eslint: '^2.13.1',
     mocha: '^2.4.5',
     'png-js': '^0.1.1',
     rollup: '^0.34.13',
     'uglify-js': '^2.7.3' },
  gitHead: 'c72886b18197be2dda5e3177cf033a73f430f0b7',
  dist: 
   { shasum: '1f202f2461d0eeed85e8794a6f44fe418dda7f87',
     tarball: 'https://registry.npmjs.org/qrcode-reader/-/qrcode-reader-0.2.2.tgz' },
  directories: {} }
edi9999 commented 7 years ago

I find this quite strange.

If I install the qrcode-reader package, I see in line 3139 of build/index.js

  return this.decode_utf8(str);

It is the same as the line in the git repository.

yellowdoge commented 7 years ago

Very strange - perhaps I mixed up my local node_modules folder.

Regardless of that, I think it'd be cool to be able to return the bounding box associated to a decoded QR code. Is there something we can do here? I.e. any way we could maintain backwards compatibility and return qRCodeMatrix.points as well?

yellowdoge commented 7 years ago

An image of the output to wet the appetites :-) http://imgur.com/a/rT8Zp

edi9999 commented 7 years ago

This could be in the v1 (I just created a branch for this https://github.com/edi9999/jsqrcode/tree/v1) can you create a MR that targets v1 ?

edi9999 commented 7 years ago

I have now commited this myself in v1

yellowdoge commented 7 years ago

The change in v1 looks good, thanks! Are you planning to upload v1t to npm?

edi9999 commented 7 years ago

Probably in a month or so, the time that we need to make sure that they are not other breaking changes that we would like to introduce

yellowdoge commented 7 years ago

@edi9999 played with the unpublished v1 (that I packed locally as v 0.3.0) and adapted accordingly my code, otherwise everything played out fine, cheers!

yellowdoge commented 7 years ago

Hi @edi9999! About a month has passed, can we consider publishing v1 to npmjs ?

edi9999 commented 7 years ago

Pushed to git and to npm to 1.0.0 !

yellowdoge commented 7 years ago

It works! https://miguelao.github.io/shapedetection-polyfill/demo.bundle.html Thanks!