ssjs-data 0.4.0 → 0.4.2

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.
@@ -3505,6 +3505,68 @@
3505
3505
  ],
3506
3506
  "returnType": "boolean"
3507
3507
  },
3508
+ {
3509
+ "name": "RegExp.test",
3510
+ "url": "/language/regular-expressions/",
3511
+ "section": "ECMAScript Builtins",
3512
+ "type": "method",
3513
+ "description": "Tests whether the string matches the pattern.",
3514
+ "params": [
3515
+ "string"
3516
+ ],
3517
+ "returnType": "boolean"
3518
+ },
3519
+ {
3520
+ "name": "RegExp.exec",
3521
+ "url": "/language/regular-expressions/",
3522
+ "section": "ECMAScript Builtins",
3523
+ "type": "method",
3524
+ "description": "Executes a search for a match in the string.",
3525
+ "params": [
3526
+ "string"
3527
+ ],
3528
+ "returnType": "array"
3529
+ },
3530
+ {
3531
+ "name": "RegExp.source",
3532
+ "url": "/language/regular-expressions/",
3533
+ "section": "ECMAScript Builtins",
3534
+ "type": "property",
3535
+ "description": "The text of the pattern, excluding the enclosing slashes and any flags.",
3536
+ "returnType": "string"
3537
+ },
3538
+ {
3539
+ "name": "RegExp.global",
3540
+ "url": "/language/regular-expressions/",
3541
+ "section": "ECMAScript Builtins",
3542
+ "type": "property",
3543
+ "description": "True if the g (global) flag was specified when creating the regular expression.",
3544
+ "returnType": "boolean"
3545
+ },
3546
+ {
3547
+ "name": "RegExp.ignoreCase",
3548
+ "url": "/language/regular-expressions/",
3549
+ "section": "ECMAScript Builtins",
3550
+ "type": "property",
3551
+ "description": "True if the i (case-insensitive) flag was specified.",
3552
+ "returnType": "boolean"
3553
+ },
3554
+ {
3555
+ "name": "RegExp.multiline",
3556
+ "url": "/language/regular-expressions/",
3557
+ "section": "ECMAScript Builtins",
3558
+ "type": "property",
3559
+ "description": "True if the m (multiline) flag was specified.",
3560
+ "returnType": "boolean"
3561
+ },
3562
+ {
3563
+ "name": "RegExp.lastIndex",
3564
+ "url": "/language/regular-expressions/",
3565
+ "section": "ECMAScript Builtins",
3566
+ "type": "property",
3567
+ "description": "The index at which to start the next match.",
3568
+ "returnType": "number"
3569
+ },
3508
3570
  {
3509
3571
  "name": "String",
3510
3572
  "url": "/global-functions/string/",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ssjs-data",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Canonical SSJS (Server-Side JavaScript) function catalog, Core library objects, Platform methods, and globals for SFMC tooling",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/index.js CHANGED
@@ -7263,6 +7263,150 @@ export const ECMASCRIPT_BUILTINS = [
7263
7263
  'Write(isFinite(1 / 0)); // false (Infinity)\n' +
7264
7264
  'Write(isFinite(NaN)); // false',
7265
7265
  },
7266
+ // ── RegExp constructor ────────────────────────────────────────────────────
7267
+ // Emitted as `declare function RegExp(...)` so that `new RegExp(...)` and
7268
+ // `RegExp(...)` both pass TypeScript validation in .ssjs files.
7269
+ {
7270
+ name: 'RegExp',
7271
+ owner: 'Global',
7272
+ description:
7273
+ 'Creates a regular expression object for pattern matching. ' +
7274
+ 'Prefer the literal syntax (/pattern/flags) when the pattern is known at write time. ' +
7275
+ 'Use the constructor when the pattern must be built dynamically at runtime.',
7276
+ params: [
7277
+ {
7278
+ name: 'pattern',
7279
+ description: 'Regular expression pattern string',
7280
+ type: 'string',
7281
+ },
7282
+ {
7283
+ name: 'flags',
7284
+ description: 'Optional flags: g (global), i (case-insensitive), m (multiline)',
7285
+ type: 'string',
7286
+ optional: true,
7287
+ },
7288
+ ],
7289
+ returnType: 'RegExp',
7290
+ syntax: 'new RegExp(pattern[, flags])',
7291
+ minArgs: 1,
7292
+ maxArgs: 2,
7293
+ example:
7294
+ 'var fieldName = "email";\n' +
7295
+ 'var re = new RegExp(fieldName + "=([^&]+)", "i");\n' +
7296
+ 'var match = queryString.match(re);\n' +
7297
+ 'if (match) { Write(match[1]); }',
7298
+ },
7299
+ // ── RegExp.prototype methods ──────────────────────────────────────────────
7300
+ {
7301
+ name: 'test',
7302
+ owner: 'RegExp',
7303
+ description:
7304
+ 'Tests whether the string matches the pattern. ' +
7305
+ 'Returns true if the pattern is found, false otherwise. ' +
7306
+ 'When the g flag is set, successive calls advance lastIndex.',
7307
+ params: [
7308
+ {
7309
+ name: 'string',
7310
+ description: 'The string to test against the regular expression',
7311
+ type: 'string',
7312
+ },
7313
+ ],
7314
+ returnType: 'boolean',
7315
+ syntax: 'RegExp.test(string)',
7316
+ minArgs: 1,
7317
+ maxArgs: 1,
7318
+ example:
7319
+ 'var emailRe = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n' +
7320
+ 'if (emailRe.test(subscriberEmail)) {\n' +
7321
+ ' Write("Valid email");\n' +
7322
+ '}',
7323
+ },
7324
+ {
7325
+ name: 'exec',
7326
+ owner: 'RegExp',
7327
+ description:
7328
+ 'Executes a search for a match in the string. ' +
7329
+ 'Returns an array with the full match at index 0 and any capture groups at subsequent indices, ' +
7330
+ 'or null if no match is found. ' +
7331
+ 'The array also has index and input properties. ' +
7332
+ 'When the g flag is set, successive calls advance lastIndex.',
7333
+ params: [
7334
+ {
7335
+ name: 'string',
7336
+ description: 'The string to search',
7337
+ type: 'string',
7338
+ },
7339
+ ],
7340
+ returnType: 'array',
7341
+ syntax: 'RegExp.exec(string)',
7342
+ minArgs: 1,
7343
+ maxArgs: 1,
7344
+ example:
7345
+ 'var re = /(\\d{4})-(\\d{2})-(\\d{2})/;\n' +
7346
+ 'var result = re.exec("Order placed on 2026-01-15");\n' +
7347
+ 'if (result) {\n' +
7348
+ ' Write("Year: " + result[1]); // "2026"\n' +
7349
+ ' Write("Month: " + result[2]); // "01"\n' +
7350
+ '}',
7351
+ },
7352
+ // ── RegExp.prototype properties ───────────────────────────────────────────
7353
+ {
7354
+ name: 'source',
7355
+ owner: 'RegExp',
7356
+ isProperty: true,
7357
+ description: 'The text of the pattern, excluding the enclosing slashes and any flags.',
7358
+ params: [],
7359
+ returnType: 'string',
7360
+ syntax: 'RegExp.source',
7361
+ example: 'var re = /hello/gi;\nWrite(re.source); // "hello"',
7362
+ },
7363
+ {
7364
+ name: 'global',
7365
+ owner: 'RegExp',
7366
+ isProperty: true,
7367
+ description:
7368
+ 'True if the g (global) flag was specified when creating the regular expression.',
7369
+ params: [],
7370
+ returnType: 'boolean',
7371
+ syntax: 'RegExp.global',
7372
+ example: 'var re = /hello/g;\nWrite(re.global); // true',
7373
+ },
7374
+ {
7375
+ name: 'ignoreCase',
7376
+ owner: 'RegExp',
7377
+ isProperty: true,
7378
+ description: 'True if the i (case-insensitive) flag was specified.',
7379
+ params: [],
7380
+ returnType: 'boolean',
7381
+ syntax: 'RegExp.ignoreCase',
7382
+ example: 'var re = /hello/i;\nWrite(re.ignoreCase); // true',
7383
+ },
7384
+ {
7385
+ name: 'multiline',
7386
+ owner: 'RegExp',
7387
+ isProperty: true,
7388
+ description: 'True if the m (multiline) flag was specified.',
7389
+ params: [],
7390
+ returnType: 'boolean',
7391
+ syntax: 'RegExp.multiline',
7392
+ example: 'var re = /^hello/m;\nWrite(re.multiline); // true',
7393
+ },
7394
+ {
7395
+ name: 'lastIndex',
7396
+ owner: 'RegExp',
7397
+ isProperty: true,
7398
+ description:
7399
+ 'The index at which to start the next match. ' +
7400
+ 'Only relevant when the g or y flag is set. ' +
7401
+ 'Automatically updated by exec() and test().',
7402
+ params: [],
7403
+ returnType: 'number',
7404
+ syntax: 'RegExp.lastIndex',
7405
+ example:
7406
+ 'var re = /\\d+/g;\n' +
7407
+ 're.exec("abc 123 def 456");\n' +
7408
+ 'Write(re.lastIndex); // 7 (after first match)',
7409
+ },
7266
7410
  ];
7267
7411
 
7268
7412
  // ── Unsupported ES6+ syntax ──────────────────────────────────────────────────
package/src/urls.js CHANGED
@@ -132,6 +132,7 @@ export const ECMASCRIPT_URLS = {
132
132
  Math: '/ecmascript-builtins/math/',
133
133
  'Number.prototype': '/ecmascript-builtins/number-methods/',
134
134
  'Object.prototype': '/ecmascript-builtins/object-methods/',
135
+ RegExp: '/language/regular-expressions/',
135
136
  };
136
137
 
137
138
  /**