synchsafe 8.0.8 → 8.0.9

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.
@@ -0,0 +1,42 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.synchsafe = {}));
5
+ })(this, (function (exports) { 'use strict';
6
+
7
+ /**
8
+ * This functions turns a synchronisation-saved integer into regular one.
9
+ */
10
+ var decode = function decode(synchsafed) {
11
+ var mask = 0x7f000000;
12
+ var unsynchsafed = 0;
13
+ while (mask !== 0) {
14
+ unsynchsafed >>= 1; // tslint:disable-line no-bitwise
15
+ unsynchsafed |= synchsafed & mask; // tslint:disable-line no-bitwise
16
+ mask >>= 8; // tslint:disable-line no-bitwise
17
+ }
18
+
19
+ return unsynchsafed;
20
+ };
21
+ /**
22
+ * This functions turns a regular integer into synchronisation-saved one.
23
+ */
24
+ var encode = function encode(unsynchsafed) {
25
+ var mask = 0x7f;
26
+ var synchsafed;
27
+ var unsynchsafedRest = unsynchsafed;
28
+ // tslint:disable-next-line:no-bitwise
29
+ while ((mask ^ 0x7fffffff) !== 0) {
30
+ synchsafed = unsynchsafedRest & ~mask; // tslint:disable-line no-bitwise
31
+ synchsafed <<= 1; // tslint:disable-line no-bitwise
32
+ synchsafed |= unsynchsafedRest & mask; // tslint:disable-line no-bitwise
33
+ mask = (mask + 1 << 8) - 1; // tslint:disable-line no-bitwise
34
+ unsynchsafedRest = synchsafed;
35
+ }
36
+ return synchsafed;
37
+ };
38
+
39
+ exports.decode = decode;
40
+ exports.encode = encode;
41
+
42
+ }));
package/package.json CHANGED
@@ -28,7 +28,7 @@
28
28
  "commitizen": "^4.3.0",
29
29
  "cz-conventional-changelog": "^3.3.0",
30
30
  "eslint": "^8.46.0",
31
- "eslint-config-holy-grail": "^57.2.19",
31
+ "eslint-config-holy-grail": "^57.2.20",
32
32
  "grunt": "^1.6.1",
33
33
  "grunt-cli": "^1.4.3",
34
34
  "grunt-sh": "^0.2.1",
@@ -46,7 +46,7 @@
46
46
  "prettier": "^2.8.8",
47
47
  "pretty-quick": "^3.1.3",
48
48
  "rimraf": "^5.0.1",
49
- "rollup": "^3.27.0",
49
+ "rollup": "^3.27.2",
50
50
  "sinon": "^15.2.0",
51
51
  "sinon-chai": "^3.7.0",
52
52
  "ts-loader": "^9.4.4",
@@ -75,7 +75,7 @@
75
75
  "url": "https://github.com/chrisguttandin/synchsafe.git"
76
76
  },
77
77
  "scripts": {
78
- "build": "rimraf build/* && tsc --project src/tsconfig.json && babel ./build/es2019 --config-file ./config/babel/build.json --out-dir ./build/node",
78
+ "build": "rimraf build/* && tsc --project src/tsconfig.json && rollup --config config/rollup/bundle.mjs && babel ./build/es2019 --config-file ./config/babel/build.json --out-dir ./build/node",
79
79
  "lint": "npm run lint:config && npm run lint:src && npm run lint:test",
80
80
  "lint:config": "eslint --config config/eslint/config.json --ext .js --report-unused-disable-directives config/",
81
81
  "lint:src": "tslint --config config/tslint/src.json --project src/tsconfig.json src/*.ts src/**/*.ts",
@@ -85,5 +85,5 @@
85
85
  "test": "grunt lint && grunt test"
86
86
  },
87
87
  "types": "build/es2019/module.d.ts",
88
- "version": "8.0.8"
88
+ "version": "8.0.9"
89
89
  }