@ptolemy2002/rgx 2.3.0 → 2.3.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
@@ -395,7 +395,7 @@ As an alternative to using the `rgx` template tag, you can directly call `rgxa`
395
395
  - `RegExp`: A `RegExp` object constructed from the resolved tokens and the provided flags.
396
396
 
397
397
  ## Peer Dependencies
398
- - `@ptolemy2002/immutability-utils` ^1.2.1
398
+ - `@ptolemy2002/immutability-utils` ^2.0.0
399
399
  - `@ptolemy2002/js-utils` ^3.2.2
400
400
  - `@ptolemy2002/ts-brand-utils` ^1.0.0
401
401
  - `@ptolemy2002/ts-utils` ^3.4.0
@@ -1,4 +1,5 @@
1
1
  import { RGXConvertibleTokenOutput, RGXToken } from "./types";
2
+ import { CloneDepth } from "@ptolemy2002/immutability-utils";
2
3
  export type RGXTokenCollectionMode = 'union' | 'concat';
3
4
  export declare class RGXTokenCollection {
4
5
  mode: RGXTokenCollectionMode;
@@ -6,7 +7,7 @@ export declare class RGXTokenCollection {
6
7
  constructor(tokens?: RGXToken[], mode?: RGXTokenCollectionMode);
7
8
  toRgx(): RGXConvertibleTokenOutput;
8
9
  getTokens(): RGXToken[];
9
- clone(): RGXTokenCollection;
10
+ clone(depth?: CloneDepth): RGXTokenCollection;
10
11
  asConcat(): RGXTokenCollection;
11
12
  asUnion(): RGXTokenCollection;
12
13
  get length(): number;
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.RGXTokenCollection = void 0;
7
- const lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep"));
8
4
  const index_1 = require("./index");
9
5
  const immutability_utils_1 = require("@ptolemy2002/immutability-utils");
10
6
  class RGXTokenCollection {
11
7
  constructor(tokens = [], mode = 'concat') {
12
8
  this.tokens = [];
13
- this.tokens = (0, lodash_clonedeep_1.default)(tokens);
9
+ this.tokens = tokens;
14
10
  this.mode = mode;
15
11
  }
16
12
  toRgx() {
@@ -22,10 +18,12 @@ class RGXTokenCollection {
22
18
  }
23
19
  }
24
20
  getTokens() {
25
- return (0, lodash_clonedeep_1.default)(this.tokens);
21
+ return (0, immutability_utils_1.extClone)(this.tokens, "max");
26
22
  }
27
- clone() {
28
- return new RGXTokenCollection(this.tokens, this.mode);
23
+ clone(depth = "max") {
24
+ if (depth === 0)
25
+ return this; // No cloning at depth 0, return the same instance.
26
+ return new RGXTokenCollection((0, immutability_utils_1.extClone)(this.tokens, typeof depth === "number" ? depth - 1 : depth), this.mode);
29
27
  }
30
28
  asConcat() {
31
29
  if (this.mode === 'concat')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptolemy2002/rgx",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  "release-major": "bash ./scripts/release.sh major"
30
30
  },
31
31
  "devDependencies": {
32
- "@ptolemy2002/immutability-utils": "^1.2.1",
32
+ "@ptolemy2002/immutability-utils": "^2.0.0",
33
33
  "@ptolemy2002/js-utils": "^3.2.2",
34
34
  "@ptolemy2002/ts-brand-utils": "^1.0.0",
35
35
  "@ptolemy2002/ts-utils": "^3.4.0",
@@ -45,7 +45,7 @@
45
45
  "typescript-transform-paths": "^3.5.3"
46
46
  },
47
47
  "peerDependencies": {
48
- "@ptolemy2002/immutability-utils": "^1.2.1",
48
+ "@ptolemy2002/immutability-utils": "^2.0.0",
49
49
  "@ptolemy2002/js-utils": "^3.2.2",
50
50
  "@ptolemy2002/ts-brand-utils": "^1.0.0",
51
51
  "@ptolemy2002/ts-utils": "^3.4.0",