@marijn/find-cluster-break 1.0.0 → 1.0.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (C) 2024 by Marijn Haverbeke <marijn@haverbeke.berlin>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,15 @@
1
+ /**
2
+ Query whether the given character has a `Grapheme_Cluster_Break`
3
+ value of `Extend` in Unicode.
4
+ */
5
+ export declare function isExtendingChar(code: number): boolean
6
+
7
+ /**
8
+ Returns a next grapheme cluster break _after_ (not equal to) `pos`,
9
+ if `forward` is true, or before otherwise. Returns `pos` itself if no
10
+ further cluster break is available in the string. Moves across
11
+ surrogate pairs, extending characters (when `includeExtending` is
12
+ true, which is the default), characters joined with zero-width joiners,
13
+ and flag emoji.
14
+ */
15
+ export declare function findClusterBreak(str: string, pos: number, forward?: boolean, includeExtending?: boolean): number
package/package.json CHANGED
@@ -1,17 +1,27 @@
1
1
  {
2
2
  "name": "@marijn/find-cluster-break",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "description": "Find the position of grapheme cluster breaks in a string",
6
6
  "main": "src/index.js",
7
+ "exports": {
8
+ "import": "./src/index.js",
9
+ "require": "./dist/index.cjs"
10
+ },
7
11
  "scripts": {
8
- "test": "mocha test/*.js"
12
+ "test": "mocha test/*.js",
13
+ "prepare": "rollup -c"
9
14
  },
10
15
  "repository": {
11
16
  "type": "git",
12
17
  "url": "git+https://github.com/marijnh/find-cluster-break.git"
13
18
  },
14
- "keywords": ["unicode", "grapheme", "cluster", "break"],
19
+ "keywords": [
20
+ "unicode",
21
+ "grapheme",
22
+ "cluster",
23
+ "break"
24
+ ],
15
25
  "author": "Marijn Haverbeke <marijn@haverbeke.berlin>",
16
26
  "license": "MIT",
17
27
  "bugs": {
@@ -19,6 +29,7 @@
19
29
  },
20
30
  "homepage": "https://github.com/marijnh/find-cluster-break#readme",
21
31
  "devDependencies": {
22
- "mocha": "^10.7.3"
32
+ "mocha": "^10.7.3",
33
+ "rollup": "^4.28.1"
23
34
  }
24
35
  }
@@ -0,0 +1,7 @@
1
+ export default {
2
+ input: "src/index.js",
3
+ output: {
4
+ file: "dist/index.cjs",
5
+ format: "cjs"
6
+ }
7
+ }