Skip to content

Commit 4e67042

Browse files
committed
Use isInt instead of deprecated Integer.isInteger
Also cleanup imports and constants.
1 parent f0c48a0 commit 4e67042

File tree

1 file changed

+26
-31
lines changed

1 file changed

+26
-31
lines changed

src/v1/internal/packstream.js

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,33 @@
1616
* See the License for the specific language governing permissions and
1717
* limitations under the License.
1818
*/
19-
20-
import debug from "./log";
21-
import {alloc} from "./buf";
2219
import utf8 from "./utf8";
23-
import Integer from "../integer";
24-
import {int} from "../integer";
25-
import {newError} from './../error';
20+
import Integer, {int, isInt} from "../integer";
21+
import {newError} from "./../error";
2622

27-
let MAX_CHUNK_SIZE = 16383,
28-
TINY_STRING = 0x80,
29-
TINY_LIST = 0x90,
30-
TINY_MAP = 0xA0,
31-
TINY_STRUCT = 0xB0,
32-
NULL = 0xC0,
33-
FLOAT_64 = 0xC1,
34-
FALSE = 0xC2,
35-
TRUE = 0xC3,
36-
INT_8 = 0xC8,
37-
INT_16 = 0xC9,
38-
INT_32 = 0xCA,
39-
INT_64 = 0xCB,
40-
STRING_8 = 0xD0,
41-
STRING_16 = 0xD1,
42-
STRING_32 = 0xD2,
43-
LIST_8 = 0xD4,
44-
LIST_16 = 0xD5,
45-
LIST_32 = 0xD6,
46-
MAP_8 = 0xD8,
47-
MAP_16 = 0xD9,
48-
MAP_32 = 0xDA,
49-
STRUCT_8 = 0xDC,
50-
STRUCT_16 = 0xDD;
23+
const TINY_STRING = 0x80;
24+
const TINY_LIST = 0x90;
25+
const TINY_MAP = 0xA0;
26+
const TINY_STRUCT = 0xB0;
27+
const NULL = 0xC0;
28+
const FLOAT_64 = 0xC1;
29+
const FALSE = 0xC2;
30+
const TRUE = 0xC3;
31+
const INT_8 = 0xC8;
32+
const INT_16 = 0xC9;
33+
const INT_32 = 0xCA;
34+
const INT_64 = 0xCB;
35+
const STRING_8 = 0xD0;
36+
const STRING_16 = 0xD1;
37+
const STRING_32 = 0xD2;
38+
const LIST_8 = 0xD4;
39+
const LIST_16 = 0xD5;
40+
const LIST_32 = 0xD6;
41+
const MAP_8 = 0xD8;
42+
const MAP_16 = 0xD9;
43+
const MAP_32 = 0xDA;
44+
const STRUCT_8 = 0xDC;
45+
const STRUCT_16 = 0xDD;
5146

5247
/**
5348
* A Structure have a signature and fields.
@@ -98,7 +93,7 @@ class Packer {
9893
return () => this.packFloat(x);
9994
} else if (typeof(x) == "string") {
10095
return () => this.packString(x, onError);
101-
} else if (Integer.isInteger(x)) {
96+
} else if (isInt(x)) {
10297
return () => this.packInteger( x );
10398
} else if (x instanceof Array) {
10499
return () => {

0 commit comments

Comments
 (0)