@twin.org/nameof-transformer 0.0.1-next.12 → 0.0.1-next.14

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.
@@ -122,22 +122,10 @@ function manual(content) {
122
122
  // Replace the nameof<IMyObject>() with "IMyObject"
123
123
  // or the nameof<IMyObject<IType2>>() with "IMyObject"
124
124
  const nameRegEx = /nameof<(.*?)(?:<.*>)?>\(\)/g;
125
- let matchName;
126
- do {
127
- matchName = nameRegEx.exec(content);
128
- if (matchName && matchName.length === 2) {
129
- content = content.replace(matchName[0], `"${matchName[1].replace(/\?/g, "")}"`);
130
- }
131
- } while (matchName);
125
+ content = content.replace(nameRegEx, '"$1"');
132
126
  // Replace the nameof(object?.prop) with "object.prop"
133
127
  const propRegEx = /nameof\((.*?)\)/g;
134
- let matchProp;
135
- do {
136
- matchProp = propRegEx.exec(content);
137
- if (matchProp && matchProp.length === 2) {
138
- content = content.replace(matchProp[0], `"${matchProp[1].replace(/\?/g, "")}"`);
139
- }
140
- } while (matchProp);
128
+ content = content.replace(propRegEx, '"$1"');
141
129
  }
142
130
  return content;
143
131
  }
@@ -174,7 +162,7 @@ const factory = () => transformerFactory;
174
162
  * Exports the factory version.
175
163
  * @returns The factory.
176
164
  */
177
- const version = "0.0.1-next.12";
165
+ const version = "0.0.1-next.14";
178
166
  /**
179
167
  * Exports the factory name.
180
168
  * @returns The factory.
@@ -99,22 +99,10 @@ function manual(content) {
99
99
  // Replace the nameof<IMyObject>() with "IMyObject"
100
100
  // or the nameof<IMyObject<IType2>>() with "IMyObject"
101
101
  const nameRegEx = /nameof<(.*?)(?:<.*>)?>\(\)/g;
102
- let matchName;
103
- do {
104
- matchName = nameRegEx.exec(content);
105
- if (matchName && matchName.length === 2) {
106
- content = content.replace(matchName[0], `"${matchName[1].replace(/\?/g, "")}"`);
107
- }
108
- } while (matchName);
102
+ content = content.replace(nameRegEx, '"$1"');
109
103
  // Replace the nameof(object?.prop) with "object.prop"
110
104
  const propRegEx = /nameof\((.*?)\)/g;
111
- let matchProp;
112
- do {
113
- matchProp = propRegEx.exec(content);
114
- if (matchProp && matchProp.length === 2) {
115
- content = content.replace(matchProp[0], `"${matchProp[1].replace(/\?/g, "")}"`);
116
- }
117
- } while (matchProp);
105
+ content = content.replace(propRegEx, '"$1"');
118
106
  }
119
107
  return content;
120
108
  }
@@ -151,7 +139,7 @@ const factory = () => transformerFactory;
151
139
  * Exports the factory version.
152
140
  * @returns The factory.
153
141
  */
154
- const version = "0.0.1-next.12";
142
+ const version = "0.0.1-next.14";
155
143
  /**
156
144
  * Exports the factory name.
157
145
  * @returns The factory.
@@ -8,7 +8,7 @@ export declare const factory: () => ts.TransformerFactory<ts.Node>;
8
8
  * Exports the factory version.
9
9
  * @returns The factory.
10
10
  */
11
- export declare const version = "0.0.1-next.12";
11
+ export declare const version = "0.0.1-next.14";
12
12
  /**
13
13
  * Exports the factory name.
14
14
  * @returns The factory.
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/nameof-transformer - Changelog
2
2
 
3
- ## v0.0.1-next.12
3
+ ## v0.0.1-next.14
4
4
 
5
5
  - Initial Release
@@ -1,6 +1,6 @@
1
1
  # Variable: version
2
2
 
3
- > `const` **version**: `"0.0.1-next.12"` = `"0.0.1-next.12"`
3
+ > `const` **version**: `"0.0.1-next.14"` = `"0.0.1-next.14"`
4
4
 
5
5
  Exports the factory version.
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/nameof-transformer",
3
- "version": "0.0.1-next.12",
3
+ "version": "0.0.1-next.14",
4
4
  "description": "A TypeScript transformer which converts types and properties to their actual name for use at runtime",
5
5
  "repository": {
6
6
  "type": "git",