assign-gingerly 0.0.87 → 0.0.89
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/DX/emojis.js +1 -0
- package/DX/emojis.ts +1 -0
- package/package.json +1 -1
- package/resolve/getValues.js +15 -4
- package/resolve/getValues.ts +16 -4
package/DX/emojis.js
CHANGED
package/DX/emojis.ts
CHANGED
package/package.json
CHANGED
package/resolve/getValues.js
CHANGED
|
@@ -145,12 +145,23 @@ function navigatePath(source, parts, withMethods, permissionProcessor) {
|
|
|
145
145
|
while (i < parts.length) {
|
|
146
146
|
if (current == null)
|
|
147
147
|
return current;
|
|
148
|
-
const
|
|
149
|
-
|
|
148
|
+
const rawPart = parts[i];
|
|
149
|
+
// A trailing | forces a zero-argument method call: 'toLocaleString|' calls
|
|
150
|
+
// toLocaleString() without consuming the next segment. Only applies to
|
|
151
|
+
// names listed in withMethods; otherwise | is part of a literal key.
|
|
152
|
+
const isZeroArg = rawPart.endsWith('|')
|
|
153
|
+
&& isAllowedMethod(rawPart.slice(0, -1), withMethods, permissionProcessor);
|
|
154
|
+
const part = isZeroArg ? rawPart.slice(0, -1) : rawPart;
|
|
155
|
+
if (isZeroArg || isAllowedMethod(part, withMethods, permissionProcessor)) {
|
|
150
156
|
const method = current[part];
|
|
151
157
|
if (typeof method === 'function') {
|
|
152
158
|
const nextPart = parts[i + 1];
|
|
153
|
-
|
|
159
|
+
// Consecutive methods (including a |-marked next segment) mean a
|
|
160
|
+
// zero-arg call; otherwise the next segment is the string argument.
|
|
161
|
+
const nextIsMethod = nextPart !== undefined
|
|
162
|
+
&& (isAllowedMethod(nextPart, withMethods, permissionProcessor)
|
|
163
|
+
|| (nextPart.endsWith('|') && isAllowedMethod(nextPart.slice(0, -1), withMethods, permissionProcessor)));
|
|
164
|
+
if (!isZeroArg && nextPart !== undefined && !nextIsMethod) {
|
|
154
165
|
current = method.call(current, nextPart);
|
|
155
166
|
i += 2;
|
|
156
167
|
}
|
|
@@ -165,7 +176,7 @@ function navigatePath(source, parts, withMethods, permissionProcessor) {
|
|
|
165
176
|
}
|
|
166
177
|
}
|
|
167
178
|
else {
|
|
168
|
-
current = current[
|
|
179
|
+
current = current[rawPart];
|
|
169
180
|
i++;
|
|
170
181
|
}
|
|
171
182
|
}
|
package/resolve/getValues.ts
CHANGED
|
@@ -182,13 +182,25 @@ function navigatePath(
|
|
|
182
182
|
while (i < parts.length) {
|
|
183
183
|
if (current == null) return current;
|
|
184
184
|
|
|
185
|
-
const
|
|
185
|
+
const rawPart = parts[i];
|
|
186
186
|
|
|
187
|
-
|
|
187
|
+
// A trailing | forces a zero-argument method call: 'toLocaleString|' calls
|
|
188
|
+
// toLocaleString() without consuming the next segment. Only applies to
|
|
189
|
+
// names listed in withMethods; otherwise | is part of a literal key.
|
|
190
|
+
const isZeroArg = rawPart.endsWith('|')
|
|
191
|
+
&& isAllowedMethod(rawPart.slice(0, -1), withMethods, permissionProcessor);
|
|
192
|
+
const part = isZeroArg ? rawPart.slice(0, -1) : rawPart;
|
|
193
|
+
|
|
194
|
+
if (isZeroArg || isAllowedMethod(part, withMethods, permissionProcessor)) {
|
|
188
195
|
const method = current[part];
|
|
189
196
|
if (typeof method === 'function') {
|
|
190
197
|
const nextPart = parts[i + 1];
|
|
191
|
-
|
|
198
|
+
// Consecutive methods (including a |-marked next segment) mean a
|
|
199
|
+
// zero-arg call; otherwise the next segment is the string argument.
|
|
200
|
+
const nextIsMethod = nextPart !== undefined
|
|
201
|
+
&& (isAllowedMethod(nextPart, withMethods, permissionProcessor)
|
|
202
|
+
|| (nextPart.endsWith('|') && isAllowedMethod(nextPart.slice(0, -1), withMethods, permissionProcessor)));
|
|
203
|
+
if (!isZeroArg && nextPart !== undefined && !nextIsMethod) {
|
|
192
204
|
current = method.call(current, nextPart);
|
|
193
205
|
i += 2;
|
|
194
206
|
} else {
|
|
@@ -200,7 +212,7 @@ function navigatePath(
|
|
|
200
212
|
i++;
|
|
201
213
|
}
|
|
202
214
|
} else {
|
|
203
|
-
current = current[
|
|
215
|
+
current = current[rawPart];
|
|
204
216
|
i++;
|
|
205
217
|
}
|
|
206
218
|
}
|