@lumjs/encode 1.0.0 → 1.2.0

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/CHANGELOG.md CHANGED
@@ -6,10 +6,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.2.0] - 2023-01-06
10
+ ### Changed
11
+ - Bumped `@lumjs/core` to `1.8.0`.
12
+ - Moved away from abandoned `ModuleBuilder`.
13
+
14
+ ## [1.1.0] - 2022-10-18
15
+ ### Changed
16
+ - Added a link to the PHP version in the README.
17
+ - Bumped `@lumjs/core` to `1.7.1`.
18
+ - Refactored default module to use `ModuleBuilder` and lazy-loading.
19
+ ### Fixed
20
+ - A typo in a DocBlock.
21
+
9
22
  ## [1.0.0] - 2022-09-30
10
23
  ### Added
11
24
  - Initial release.
12
25
 
13
- [Unreleased]: https://github.com/supernovus/lum.encode.js/compare/v1.0.0...HEAD
26
+ [Unreleased]: https://github.com/supernovus/lum.encode.js/compare/v1.2.0...HEAD
27
+ [1.2.0]: https://github.com/supernovus/lum.encode.js/compare/v1.1.0...v1.2.0
28
+ [1.1.0]: https://github.com/supernovus/lum.encode.js/compare/v1.0.0...v1.1.0
14
29
  [1.0.0]: https://github.com/supernovus/lum.encode.js/releases/tag/v1.0.0
15
-
package/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  A bunch of encoding libraries.
4
4
 
5
+ Among other things, it offers a pure JS implementation of my
6
+ [Safe64](https://github.com/supernovus/lum.encode.php)
7
+ data serialization and encoding format.
8
+
5
9
  ## Official URLs
6
10
 
7
11
  This library can be found in two places:
package/lib/base64.js CHANGED
@@ -44,7 +44,7 @@ exports.encode = function(rawdata, stringFormat=Utf8)
44
44
  *
45
45
  * If this is `false`, we'll return a `WordArray` object.
46
46
  *
47
- * @return {(string|WordArray))} The decoded output.
47
+ * @return {(string|WordArray)} The decoded output.
48
48
  */
49
49
  exports.decode = function(string, stringFormat=Utf8)
50
50
  {
package/lib/index.js CHANGED
@@ -3,51 +3,51 @@
3
3
  * @module @lumjs/encode
4
4
  */
5
5
 
6
+ const {def,lazy} = require('@lumjs/core/types');
7
+
8
+ const E = def.e;
9
+
10
+ const util = require('./util');
11
+
6
12
  /**
7
- * @name module:@lumjs/encode.ord
8
- * @function
13
+ * @alias module:@lumjs/encode.ord
9
14
  * @see {@link module:@lumjs/encode/util.ord}
10
15
  */
16
+ def(exports, 'ord', util.ord, E);
11
17
 
12
18
  /**
13
19
  * @name module:@lumjs/encode.numByteArray
14
20
  * @function
15
21
  * @see {@link module:@lumjs/encode/util.numByteArray}
16
22
  */
17
-
18
- const {ord, numByteArray} = require('./util');
23
+ def(exports, 'numByteArray', util.numByteArray, E);
19
24
 
20
25
  /**
26
+ * @name module:@lumjs/encode.Base64
21
27
  * @see {@link module:@lumjs/encode/base64}
22
- * @alias module:@lumjs/encode.Base64
23
28
  */
24
- const Base64 = require('./base64');
29
+ lazy(exports, 'Base64', () => require('./base64'), E);
25
30
 
26
31
  /**
32
+ * @name module:@lumjs/encode.Base91
27
33
  * @see {@link module:@lumjs/encode/base91}
28
- * @alias module:@lumjs/encode.Base91
29
34
  */
30
- const Base91 = require('./base91');
35
+ lazy(exports, 'Base91', () => require('./base91'), E);
31
36
 
32
37
  /**
38
+ * @name module:@lumjs/encode.Safe64
33
39
  * @see {@link module:@lumjs/encode/safe64}
34
- * @alias module:@lumjs/encode.Safe64
35
40
  */
36
- const Safe64 = require('./safe64');
41
+ lazy(exports, 'Safe64', () => require('./safe64'), E);
37
42
 
38
43
  /**
44
+ * @name module:@lumjs/encode.Hash
39
45
  * @see {@link module:@lumjs/encode/hash}
40
- * @alias module:@lumjs/encode.Hash
41
46
  */
42
- const Hash = require('./hash');
47
+ lazy(exports, 'Hash', () => require('./hash'), E);
43
48
 
44
49
  /**
50
+ * @name module:@lumjs/encode.Crypto
45
51
  * @see {@link module:@lumjs/encode/crypto}
46
- * @alias module:@lumjs/encode.Crypto
47
52
  */
48
- const Crypto = require('./crypto');
49
-
50
- module.exports = exports =
51
- {
52
- ord, numByteArray, Base64, Safe64, Base91, Hash, Crypto,
53
- }
53
+ lazy(exports, 'Crypto', () => require('./crypto'), E);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumjs/encode",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "main": "lib/index.js",
5
5
  "exports":
6
6
  {
@@ -22,14 +22,14 @@
22
22
  "url": "https://github.com/supernovus/lum.encode.js.git"
23
23
  },
24
24
  "dependencies": {
25
- "@lumjs/core": "^1.5.1",
25
+ "@lumjs/core": "^1.8.0",
26
26
  "crypto-js": "^4.1.1",
27
27
  "php-serialize": "^4.0.2",
28
28
  "@shelacek/ubjson": "^1.1.1"
29
29
  },
30
30
  "devDependencies":
31
31
  {
32
- "@lumjs/tests": "^1.7.0"
32
+ "@lumjs/tests": "^1.8.0"
33
33
  },
34
34
  "scripts":
35
35
  {
package/ub-dev.js DELETED
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const UB = require('@shelacek/ubjson');
4
-
5
- const data = {hello:["world","darkness my old friend"]};
6
- const ubj = UB.encode(data);
7
-
8
- console.log("Size:", ubj.byteLength);
9
- const utf8 = new TextDecoder().decode(ubj);
10
- console.log("UTF-8:", utf8);
11
- console.log("JSON:", JSON.stringify(utf8));