@webdeveric/utils 1.1.0 → 1.2.0

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.
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.indent = indent;
4
+ const constants_js_1 = require("./constants.js");
5
+ /**
6
+ * Add `indent` before each line in `input`.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * indent('one\ntwo\nthree', ' '); // ' one\n two\n three'
11
+ * ```
12
+ */
13
+ function indent(input, indentation) {
14
+ return (indentation +
15
+ input.replaceAll(new RegExp(String.raw `(?<newLine>${constants_js_1.NEWLINE_RAW_PATTERN})`, 'g'), `$<newLine>${indentation}`));
16
+ }
package/dist/cjs/index.js CHANGED
@@ -60,6 +60,7 @@ __exportStar(require("./getType.js"), exports);
60
60
  __exportStar(require("./graphemeLength.js"), exports);
61
61
  __exportStar(require("./has.js"), exports);
62
62
  __exportStar(require("./hasAdditionalProperties.js"), exports);
63
+ __exportStar(require("./indent.js"), exports);
63
64
  __exportStar(require("./inRange.js"), exports);
64
65
  __exportStar(require("./isEmpty.js"), exports);
65
66
  __exportStar(require("./iterateForever.js"), exports);
@@ -0,0 +1,13 @@
1
+ import { NEWLINE_RAW_PATTERN } from './constants.js';
2
+ /**
3
+ * Add `indent` before each line in `input`.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * indent('one\ntwo\nthree', ' '); // ' one\n two\n three'
8
+ * ```
9
+ */
10
+ export function indent(input, indentation) {
11
+ return (indentation +
12
+ input.replaceAll(new RegExp(String.raw `(?<newLine>${NEWLINE_RAW_PATTERN})`, 'g'), `$<newLine>${indentation}`));
13
+ }
package/dist/mjs/index.js CHANGED
@@ -44,6 +44,7 @@ export * from './getType.js';
44
44
  export * from './graphemeLength.js';
45
45
  export * from './has.js';
46
46
  export * from './hasAdditionalProperties.js';
47
+ export * from './indent.js';
47
48
  export * from './inRange.js';
48
49
  export * from './isEmpty.js';
49
50
  export * from './iterateForever.js';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Add `indent` before each line in `input`.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * indent('one\ntwo\nthree', ' '); // ' one\n two\n three'
7
+ * ```
8
+ */
9
+ export declare function indent(input: string, indentation: string): string;
@@ -42,6 +42,7 @@ export * from './getType.js';
42
42
  export * from './graphemeLength.js';
43
43
  export * from './has.js';
44
44
  export * from './hasAdditionalProperties.js';
45
+ export * from './indent.js';
45
46
  export * from './inRange.js';
46
47
  export * from './isEmpty.js';
47
48
  export * from './iterateForever.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@webdeveric/utils",
3
3
  "description": "Just another collection of utilities.",
4
- "version": "1.1.0",
4
+ "version": "1.2.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -66,7 +66,7 @@
66
66
  "url": "https://github.com/webdeveric/utils/issues"
67
67
  },
68
68
  "homepage": "https://github.com/webdeveric/utils/#readme",
69
- "packageManager": "pnpm@11.11.0+sha512.4463f65fd80ed80d69bc1d4bf163ee94f605c7380fc318bb5b2ebe15f8cd12d49c51a4d59e951b401e764d3b6ca751cbf51bc50ed7001a6bcb4935e684c34882",
69
+ "packageManager": "pnpm@11.15.0+sha512.266f8957a30d2be6e9468e5e66bcdedd35a794175f71b067ba8504d686cce1d0c0f429b33c323c3c569ad4891e667574a49ff71d1b89a22cc66f13c65818c578",
70
70
  "scripts": {
71
71
  "clean": "rimraf ./dist/ ./cache/ ./coverage/",
72
72
  "prebuild": "pnpm clean",
@@ -107,9 +107,9 @@
107
107
  "lint-staged": "^17.0.8",
108
108
  "prettier": "^3.9.5",
109
109
  "rimraf": "^6.1.3",
110
- "semantic-release": "^25.0.6",
110
+ "semantic-release": "^25.0.7",
111
111
  "typedoc": "^0.28.20",
112
- "validate-package-exports": "^1.2.1",
112
+ "validate-package-exports": "^1.3.1",
113
113
  "vitest": "^4.1.10"
114
114
  }
115
115
  }