@e-mc/image 0.9.1 → 0.9.2

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.
Files changed (3) hide show
  1. package/README.md +4 -4
  2. package/index.js +19 -19
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.9.1/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.9.2/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { IHost, ModuleConstructor } from "./index";
@@ -86,9 +86,9 @@ NOTE: Usage without a **Host** is conducted through static methods. The **using*
86
86
 
87
87
  ## References
88
88
 
89
- - https://www.unpkg.com/@e-mc/types@0.9.1/lib/asset.d.ts
90
- - https://www.unpkg.com/@e-mc/types@0.9.1/lib/image.d.ts
91
- - https://www.unpkg.com/@e-mc/types@0.9.1/lib/settings.d.ts
89
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/asset.d.ts
90
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/image.d.ts
91
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/settings.d.ts
92
92
 
93
93
  ## LICENSE
94
94
 
package/index.js CHANGED
@@ -10,6 +10,20 @@ const REGEXP_RESIZE = /\(\s*(\d+|auto)\s*x\s*(\d+|auto)(?:\s*\[\s*(bilinear|bicu
10
10
  const REGEXP_ROTATE = /\{((?:\s*-?\d+\s*,?)+)(?:\s*#\s*([a-f\d]{1,8}))?\s*\}/i;
11
11
  const REGEXP_METHOD = /!\s*([a-z$][\w$]*)(\()?/gi;
12
12
  const REGEXP_SIZERANGE = /(!\s*[\w$]+)?\(\s*(\d+)\s*(?:,\s*(\d+|\*)\s*)?\)/;
13
+ function isEscaped(value, checkQuote) {
14
+ if (!checkQuote || /["']/.test(value)) {
15
+ let k = 0;
16
+ for (let j = value.length - 1; j >= 0; --j) {
17
+ if (value[j] === '\\') {
18
+ ++k;
19
+ }
20
+ }
21
+ if (k % 2 === 1) {
22
+ return true;
23
+ }
24
+ }
25
+ return false;
26
+ }
13
27
  const isNumber = (ch) => ch >= '0' && ch <= '9';
14
28
  const parseHexDecimal = (value) => value ? +('0x' + value.toUpperCase().padEnd(8, 'F')) : NaN;
15
29
  class Image extends core_1.Client {
@@ -148,20 +162,6 @@ class Image extends core_1.Client {
148
162
  next = false;
149
163
  args.push(item);
150
164
  };
151
- const isEscaped = (checkQuote = true) => {
152
- if (!checkQuote || /["']/.test(current)) {
153
- let k = 0;
154
- for (let j = current.length - 1; j >= 0; --j) {
155
- if (current[j] === '\\') {
156
- ++k;
157
- }
158
- }
159
- if (k % 2 === 1) {
160
- return true;
161
- }
162
- }
163
- return false;
164
- };
165
165
  found: {
166
166
  for (const length = value.length; i < length; ++i) {
167
167
  const ch = value[i];
@@ -173,7 +173,7 @@ class Image extends core_1.Client {
173
173
  stringType = ch;
174
174
  continue;
175
175
  }
176
- else if (type === 3 && ch === stringType && !isEscaped(false)) {
176
+ else if (type === 3 && ch === stringType && !isEscaped(current, false)) {
177
177
  addArg(current);
178
178
  continue;
179
179
  }
@@ -183,12 +183,12 @@ class Image extends core_1.Client {
183
183
  type = 1;
184
184
  arrayCount = 1;
185
185
  }
186
- else if (type === 1 && !isEscaped()) {
186
+ else if (type === 1 && !isEscaped(current, true)) {
187
187
  ++arrayCount;
188
188
  }
189
189
  break;
190
190
  case ']':
191
- if (type === 1 && !isEscaped() && --arrayCount === 0) {
191
+ if (type === 1 && !isEscaped(current, true) && --arrayCount === 0) {
192
192
  try {
193
193
  addArg(JSON.parse(current + ']'));
194
194
  continue;
@@ -203,12 +203,12 @@ class Image extends core_1.Client {
203
203
  type = 2;
204
204
  objectCount = 1;
205
205
  }
206
- else if (type === 2 && !isEscaped()) {
206
+ else if (type === 2 && !isEscaped(current, true)) {
207
207
  ++objectCount;
208
208
  }
209
209
  break;
210
210
  case '}':
211
- if (type === 2 && !isEscaped() && --objectCount === 0) {
211
+ if (type === 2 && !isEscaped(current, true) && --objectCount === 0) {
212
212
  try {
213
213
  addArg(JSON.parse(current + '}'));
214
214
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/image",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "Image constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -20,6 +20,6 @@
20
20
  "license": "BSD 3-Clause",
21
21
  "homepage": "https://github.com/anpham6/e-mc#readme",
22
22
  "dependencies": {
23
- "@e-mc/core": "0.9.1"
23
+ "@e-mc/core": "0.9.2"
24
24
  }
25
25
  }