uqr 0.0.4 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,14 @@
1
1
  # uqr
2
2
 
3
- [![NPM version](https://img.shields.io/npm/v/uqr?color=a1b858&label=)](https://www.npmjs.com/package/uqr)
3
+ [![npm version][npm-version-src]][npm-version-href]
4
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
5
+ [![bundle][bundle-src]][bundle-href]
6
+ [![License][license-src]][license-href]
7
+ [![JSDocs][jsdocs-src]][jsdocs-href]
4
8
 
5
- Generate QR Code universally, in any runtime, to ANSI, Unicode or SVG.
9
+ <!-- [![Codecov][codecov-src]][codecov-href] -->
10
+
11
+ Generate QR Code universally, in any runtime, to ANSI, Unicode or SVG. ES module , zero dependency, tree-shakable.
6
12
 
7
13
  ## Install
8
14
 
@@ -114,3 +120,19 @@ CLI renders are inspired by [qrcode-terminal](https://github.com/gtanner/qrcode-
114
120
  ## License
115
121
 
116
122
  [MIT](./LICENSE) License
123
+
124
+
125
+ <!-- Badges -->
126
+
127
+ [npm-version-src]: https://img.shields.io/npm/v/uqr?style=flat&colorA=18181B&colorB=F0DB4F
128
+ [npm-version-href]: https://npmjs.com/package/uqr
129
+ [npm-downloads-src]: https://img.shields.io/npm/dm/uqr?style=flat&colorA=18181B&colorB=F0DB4F
130
+ [npm-downloads-href]: https://npmjs.com/package/uqr
131
+ [codecov-src]: https://img.shields.io/codecov/c/gh/unjs/uqr/main?style=flat&colorA=18181B&colorB=F0DB4F
132
+ [codecov-href]: https://codecov.io/gh/unjs/uqr
133
+ [bundle-src]: https://img.shields.io/bundlephobia/minzip/uqr?style=flat&colorA=18181B&colorB=F0DB4F
134
+ [bundle-href]: https://bundlephobia.com/result?p=uqr
135
+ [license-src]: https://img.shields.io/github/license/unjs/uqr.svg?style=flat&colorA=18181B&colorB=F0DB4F
136
+ [license-href]: https://github.com/unjs/uqr/blob/main/LICENSE
137
+ [jsdocs-src]: https://img.shields.io/badge/jsDocs.io-reference-18181B?style=flat&colorA=18181B&colorB=F0DB4F
138
+ [jsdocs-href]: https://www.jsdocs.io/package/uqr
package/dist/index.cjs CHANGED
@@ -595,7 +595,9 @@ function encode(data, options) {
595
595
  maskPattern = -1,
596
596
  border = 1
597
597
  } = options || {};
598
- const segment = typeof data === "string" ? makeSegments(data) : [makeBytes(data)];
598
+ const segment = typeof data === "string" ? makeSegments(data) : Array.isArray(data) ? [makeBytes(data)] : void 0;
599
+ if (!segment)
600
+ throw new Error(`uqr only supports encoding string and binary data, but got: ${typeof data}`);
599
601
  const qr = encodeSegments(
600
602
  segment,
601
603
  EccMap[ecc],
package/dist/index.mjs CHANGED
@@ -593,7 +593,9 @@ function encode(data, options) {
593
593
  maskPattern = -1,
594
594
  border = 1
595
595
  } = options || {};
596
- const segment = typeof data === "string" ? makeSegments(data) : [makeBytes(data)];
596
+ const segment = typeof data === "string" ? makeSegments(data) : Array.isArray(data) ? [makeBytes(data)] : void 0;
597
+ if (!segment)
598
+ throw new Error(`uqr only supports encoding string and binary data, but got: ${typeof data}`);
597
599
  const qr = encodeSegments(
598
600
  segment,
599
601
  EccMap[ecc],
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "uqr",
3
3
  "type": "module",
4
- "version": "0.0.4",
5
- "packageManager": "pnpm@8.6.11",
4
+ "version": "0.1.1",
5
+ "packageManager": "pnpm@8.6.12",
6
6
  "description": "Generate QR Code universally, in any runtime, to ANSI, Unicode or SVG.",
7
7
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
8
8
  "license": "MIT",
@@ -46,21 +46,21 @@
46
46
  "typecheck": "tsc --noEmit"
47
47
  },
48
48
  "devDependencies": {
49
- "@antfu/eslint-config": "^0.40.0",
49
+ "@antfu/eslint-config": "^0.40.2",
50
50
  "@antfu/ni": "^0.21.5",
51
51
  "@antfu/utils": "^0.7.5",
52
- "@types/node": "^20.4.7",
52
+ "@types/node": "^20.4.9",
53
53
  "bumpp": "^9.1.1",
54
54
  "eslint": "^8.46.0",
55
55
  "esno": "^0.17.0",
56
56
  "lint-staged": "^13.2.3",
57
- "pnpm": "^8.6.11",
57
+ "pnpm": "^8.6.12",
58
58
  "rimraf": "^5.0.1",
59
- "rollup": "^3.27.2",
59
+ "rollup": "^3.28.0",
60
60
  "simple-git-hooks": "^2.9.0",
61
61
  "typescript": "^5.1.6",
62
62
  "unbuild": "^1.2.1",
63
- "vite": "^4.4.8",
63
+ "vite": "^4.4.9",
64
64
  "vitest": "^0.34.1"
65
65
  },
66
66
  "simple-git-hooks": {