@poe-platform/safe-js 0.1.458 → 0.1.460

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.
@@ -19733,8 +19733,9 @@ function getNumberMember(property, budget) {
19733
19733
  }
19734
19734
  return createSandboxClosure({
19735
19735
  sandbox: true,
19736
- name: `Number#${property}`,
19737
- ...property === "toLocaleString" ? { guest: true, name: property, length: 0 } : {},
19736
+ guest: true,
19737
+ name: property,
19738
+ length: property === "toLocaleString" ? 0 : 1,
19738
19739
  call: (args, context) => callNumberMethod(context?.thisValue, property, args, budget, context)
19739
19740
  });
19740
19741
  }
@@ -19867,41 +19868,42 @@ async function compareStringLocale(value, args, budget, context) {
19867
19868
  }
19868
19869
 
19869
19870
  // packages/safe-js/src/interp/methods/string.ts
19870
- var stringMethodNames = /* @__PURE__ */ new Set([
19871
- "at",
19872
- "charAt",
19873
- "charCodeAt",
19874
- "codePointAt",
19875
- "concat",
19876
- "endsWith",
19877
- "includes",
19878
- "indexOf",
19879
- "isWellFormed",
19880
- "lastIndexOf",
19881
- "localeCompare",
19882
- "match",
19883
- "matchAll",
19884
- "normalize",
19885
- "padEnd",
19886
- "padStart",
19887
- "repeat",
19888
- "replace",
19889
- "replaceAll",
19890
- "slice",
19891
- "search",
19892
- "split",
19893
- "startsWith",
19894
- "substr",
19895
- "substring",
19896
- "toLowerCase",
19897
- "toUpperCase",
19898
- "toLocaleLowerCase",
19899
- "toLocaleUpperCase",
19900
- "toWellFormed",
19901
- "trim",
19902
- "trimEnd",
19903
- "trimStart"
19904
- ]);
19871
+ var stringMethodLengths = {
19872
+ at: 1,
19873
+ charAt: 1,
19874
+ charCodeAt: 1,
19875
+ codePointAt: 1,
19876
+ concat: 1,
19877
+ endsWith: 1,
19878
+ includes: 1,
19879
+ indexOf: 1,
19880
+ isWellFormed: 0,
19881
+ lastIndexOf: 1,
19882
+ localeCompare: 1,
19883
+ match: 1,
19884
+ matchAll: 1,
19885
+ normalize: 0,
19886
+ padEnd: 1,
19887
+ padStart: 1,
19888
+ repeat: 1,
19889
+ replace: 2,
19890
+ replaceAll: 2,
19891
+ slice: 2,
19892
+ search: 1,
19893
+ split: 2,
19894
+ startsWith: 1,
19895
+ substr: 2,
19896
+ substring: 2,
19897
+ toLowerCase: 0,
19898
+ toUpperCase: 0,
19899
+ toLocaleLowerCase: 0,
19900
+ toLocaleUpperCase: 0,
19901
+ toWellFormed: 0,
19902
+ trim: 0,
19903
+ trimEnd: 0,
19904
+ trimStart: 0
19905
+ };
19906
+ var stringMethodNames = new Set(Object.keys(stringMethodLengths));
19905
19907
  function getStringMember(value, property, budget) {
19906
19908
  const index = getStringIndex(property);
19907
19909
  if (index !== void 0) {
@@ -19915,10 +19917,9 @@ function getStringMember(value, property, budget) {
19915
19917
  }
19916
19918
  return createSandboxClosure({
19917
19919
  sandbox: true,
19918
- name: `String#${property}`,
19919
- ...property === "toLocaleLowerCase" || property === "toLocaleUpperCase" ? { guest: true, name: property, length: 0 } : {},
19920
- ...property === "localeCompare" ? { length: 1 } : {},
19921
- ...property === "isWellFormed" || property === "toWellFormed" ? { length: 0 } : {},
19920
+ guest: true,
19921
+ name: property,
19922
+ length: stringMethodLengths[property],
19922
19923
  call: async (args, context) => {
19923
19924
  const receiver = context?.thisValue;
19924
19925
  if (receiver === null || receiver === void 0) {
@@ -20728,6 +20729,7 @@ function createPrimitiveConstructor(options, budget) {
20728
20729
  "valueOf",
20729
20730
  createSandboxClosure({
20730
20731
  sandbox: true,
20732
+ guest: true,
20731
20733
  name: "valueOf",
20732
20734
  length: 0,
20733
20735
  call: (_args, context) => primitiveReceiver(context?.thisValue, kind)
@@ -20741,13 +20743,17 @@ function createPrimitiveConstructor(options, budget) {
20741
20743
  "toString",
20742
20744
  createSandboxClosure({
20743
20745
  sandbox: true,
20746
+ guest: true,
20744
20747
  name: "toString",
20745
20748
  length: 0,
20746
20749
  call: (_args, context) => budget.allocateString(String(primitiveReceiver(context?.thisValue, kind)))
20747
20750
  })
20748
20751
  );
20749
- if (kind === "string")
20752
+ if (kind === "string") {
20750
20753
  for (const name of stringMethodNames) methods3.set(name, getStringMember("", name, budget));
20754
+ methods3.set("trimLeft", methods3.get("trimStart"));
20755
+ methods3.set("trimRight", methods3.get("trimEnd"));
20756
+ }
20751
20757
  }
20752
20758
  for (const [name, value] of methods3)
20753
20759
  Object.defineProperty(prototype, name, { value, writable: true, configurable: true });
@@ -56299,4 +56305,4 @@ The above copyright notice and this permission notice shall be included in all c
56299
56305
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
56300
56306
 
56301
56307
  */
56302
- //# sourceMappingURL=chunk-GPAQUL2B.js.map
56308
+ //# sourceMappingURL=chunk-BJWRB7U7.js.map