@appsemble/utils 0.21.0 → 0.21.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.
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.21.0/config/assets/logo.svg) Appsemble Utilities
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.21.2/config/assets/logo.svg) Appsemble Utilities
2
2
 
3
3
  > Internal utility functions used across multiple Appsemble projects.
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/@appsemble/utils)](https://www.npmjs.com/package/@appsemble/utils)
6
- [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.21.0/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.21.0)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.21.2/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.21.2)
7
7
  [![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io)
8
8
 
9
9
  ## Table of Contents
@@ -26,5 +26,5 @@ not guaranteed.
26
26
 
27
27
  ## License
28
28
 
29
- [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.21.0/LICENSE.md) ©
29
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.21.2/LICENSE.md) ©
30
30
  [Appsemble](https://appsemble.com)
package/convertToCsv.js CHANGED
@@ -13,7 +13,7 @@ export function convertToCsv(body) {
13
13
  const quote = '"';
14
14
  const quoteRegex = new RegExp(quote, 'g');
15
15
  const escape = (value) => value.includes(separator) || value.includes(lineEnd) || value.includes(quote)
16
- ? `${quote}${value.replace(quoteRegex, `${quote}${quote}`)}${quote}`
16
+ ? `${quote}${value.replaceAll(quoteRegex, `${quote}${quote}`)}${quote}`
17
17
  : value;
18
18
  if (body == null) {
19
19
  throw new Error('No data');
package/normalize.js CHANGED
@@ -14,11 +14,11 @@ export function normalize(input, stripTrailingHyphen = true) {
14
14
  const normalized = input
15
15
  // Normalize accents. https://stackoverflow.com/a/37511463/1154610
16
16
  .normalize('NFD')
17
- .replace(/[\u0300-\u036F]/g, '')
17
+ .replaceAll(/[\u0300-\u036F]/g, '')
18
18
  // Make it lower case.
19
19
  .toLowerCase()
20
20
  // Replace any non-alphanumeric with single hyphens them at the start.
21
- .replace(/[^\da-z]+/g, (match, index) => (index ? '-' : ''));
21
+ .replaceAll(/[^\da-z]+/g, (match, index) => (index ? '-' : ''));
22
22
  return stripTrailingHyphen ? normalized.replace(/-$/, '') : normalized;
23
23
  }
24
24
  //# sourceMappingURL=normalize.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/utils",
3
- "version": "0.21.0",
3
+ "version": "0.21.2",
4
4
  "description": "Utility functions used in Appsemble internally",
5
5
  "keywords": [
6
6
  "app",
@@ -31,7 +31,7 @@
31
31
  "test": "vitest"
32
32
  },
33
33
  "dependencies": {
34
- "@appsemble/types": "0.21.0",
34
+ "@appsemble/types": "0.21.2",
35
35
  "axios": "^1.0.0",
36
36
  "cron-parser": "^4.0.0",
37
37
  "date-fns": "^2.0.0",
@@ -45,7 +45,7 @@
45
45
  "openapi-types": "^12.0.0",
46
46
  "parse-duration": "^1.0.0",
47
47
  "postcss": "^8.0.0",
48
- "type-fest": "^3.0.0"
48
+ "type-fest": "^4.0.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/langmap": "^0.0.1",
package/pem.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export function stripPem(pem, removeNewlines = false) {
2
2
  return pem
3
- .replace(/^[\s-]*BEGIN [A-Z]+[\s-]*/g, '')
4
- .replace(/[\s-]*END [A-Z]+[\s-]*$/g, '')
5
- .replace(/\r?\n/g, removeNewlines ? '' : '\n')
3
+ .replaceAll(/^[\s-]*BEGIN [A-Z]+[\s-]*/g, '')
4
+ .replaceAll(/[\s-]*END [A-Z]+[\s-]*$/g, '')
5
+ .replaceAll(/\r?\n/g, removeNewlines ? '' : '\n')
6
6
  .trim();
7
7
  }
8
8
  export function wrapPem(pem, type) {
package/remap.js CHANGED
@@ -324,7 +324,7 @@ const mapperImplementations = {
324
324
  },
325
325
  'string.replace'(values, input) {
326
326
  const [[regex, replacer]] = Object.entries(values);
327
- return String(input).replace(new RegExp(regex, 'gm'), replacer);
327
+ return String(input).replaceAll(new RegExp(regex, 'gm'), replacer);
328
328
  },
329
329
  translate(messageId, input, context) {
330
330
  const message = context.getMessage({ id: messageId });
package/string.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * @returns The input, but hyphenated.
6
6
  */
7
7
  export function camelToHyphen(string) {
8
- return string.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
8
+ return string.replaceAll(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
9
9
  }
10
10
  /**
11
11
  * Convert a string to upper case.
@@ -25,6 +25,6 @@ export function toUpperCase(input) {
25
25
  * @returns The escaped JSON pointer segment.
26
26
  */
27
27
  export function decodeJSONRef(ref) {
28
- return decodeURIComponent(ref).replace(/~1/g, '/').replace(/~0/g, '~');
28
+ return decodeURIComponent(ref).replaceAll('~1', '/').replaceAll('~0', '~');
29
29
  }
30
30
  //# sourceMappingURL=string.js.map