is-space 1.0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 kasukabe tsumugi
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 all
13
+ 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 THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # is-space
2
+
3
+ [![npm version](https://img.shields.io/npm/v/is-space.svg)](https://www.npmjs.com/package/is-space) [![npm downloads](http://img.shields.io/npm/dm/is-space.svg)](https://npmcharts.com/compare/is-space,token-types?start=1200&interval=30)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/59dd6795e61949fb97066ca52e6097ef)](https://www.codacy.com/app/Borewit/is-space?utm_source=github.com&utm_medium=referral&utm_content=Borewit/is-space&utm_campaign=Badge_Grade)
5
+
6
+ After waking up from my nap, I came up with an approach to determine whitespace characters that is absolutely compliant with ECMA-262. Now I've packaged it up for everyone to use.
7
+
8
+ This package exports only one function: `isSpace`. Use it to check whether a character or string consists solely of whitespace characters — without worrying about whether you've written the complete regular expression.
9
+
10
+ For more awesome packages, check out [my homepage💛](https://baendlorel.github.io/?repoType=npm)
11
+
12
+ ## Features
13
+
14
+ **`isSpace`**: Checks if a string contains only space characters via JavaScript's standard (ECMA-262).
15
+
16
+ ## Usage
17
+
18
+ ```ts
19
+ import { isSpace } from 'is-space';
20
+
21
+ // Check single characters
22
+ isSpace(' ') // true (regular space)
23
+ isSpace('\t') // true (tab)
24
+ isSpace('\n') // true (newline)
25
+ isSpace('\r') // true (carriage return)
26
+ isSpace('a') // false (regular character)
27
+ isSpace('5') // false (number)
28
+ isSpace('') // true (empty string)
29
+
30
+ // Check other whitespace characters
31
+ isSpace('\f') // true (form feed)
32
+ isSpace('\v') // true (vertical tab)
33
+ isSpace(' ') // true (non-breaking space)
34
+ isSpace('') // true (line separator)
35
+ isSpace('') // true (paragraph separator)
36
+
37
+ // Works with any character
38
+ isSpace('🚀') // false (emoji)
39
+ isSpace('中') // false (Chinese character)
40
+ ```
41
+
42
+ ## License
43
+
44
+ MIT
package/dist/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=e=>e.trim()===``;exports.isSpace=e;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Returns `true` if JavaScript considers it a space.\n *\n * __PKG_INFO_SIMPLE__\n */\nexport const isSpace = (char: string): boolean => char.trim() === '';\n"],"mappings":"mEAKA,MAAa,EAAW,GAA0B,EAAK,KAAK,IAAM"}
@@ -0,0 +1,10 @@
1
+ //#region src/index.d.ts
2
+ /**
3
+ * Returns `true` if JavaScript considers it a space.
4
+ *
5
+ * __PKG_INFO_SIMPLE__
6
+ */
7
+ declare const isSpace: (char: string) => boolean;
8
+ //#endregion
9
+ export { isSpace };
10
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1,17 @@
1
+ //#region src/index.d.ts
2
+ /**
3
+ * Returns `true` if JavaScript considers it a space.
4
+ *
5
+ * ## About
6
+ * @package IsSpace MIT
7
+ * @author KasukabeTsumugi <futami16237@gmail.com>
8
+ * @version 1.0.0 (Last Update: 2026.08.30 15:30:51.235)
9
+ * @link git+https://github.com/baendlorel/kt-packages.git
10
+ * @link https://baendlorel.github.io/ Welcome to my site!
11
+ * @description Check if a character is considered a space by JavaScript.
12
+ * @copyright Copyright (c) 2026 KasukabeTsumugi. All rights reserved.
13
+ */
14
+ declare const isSpace: (char: string) => boolean;
15
+ //#endregion
16
+ export { isSpace };
17
+ //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ const e=e=>e.trim()===``;export{e as isSpace};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Returns `true` if JavaScript considers it a space.\n *\n * __PKG_INFO_SIMPLE__\n */\nexport const isSpace = (char: string): boolean => char.trim() === '';\n"],"mappings":"AAKA,MAAa,EAAW,GAA0B,EAAK,KAAK,IAAM"}
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "is-space",
3
+ "version": "1.0.0",
4
+ "author": {
5
+ "name": "KasukabeTsumugi",
6
+ "email": "futami16237@gmail.com"
7
+ },
8
+ "description": "Check if a character is considered a space by JavaScript.",
9
+ "description_zh": "检查一个字符是否被JavaScript认为是空格。",
10
+ "type": "module",
11
+ "exports": {
12
+ "import": "./dist/index.mjs",
13
+ "default": "./dist/index.mjs",
14
+ "types": "./dist/index.d.ts"
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "build": "rimraf dist && rollup -c",
21
+ "test": "clear && vitest"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/baendlorel/kt-packages.git",
26
+ "directory": "packages/is-space"
27
+ },
28
+ "keywords": [
29
+ "space",
30
+ "string",
31
+ "whitespace",
32
+ "character",
33
+ "validation",
34
+ "utility",
35
+ "javascript",
36
+ "npm"
37
+ ],
38
+ "license": "MIT",
39
+ "bugs": {
40
+ "url": "https://github.com/baendlorel/kt-packages/issues"
41
+ },
42
+ "homepage": "https://github.com/baendlorel/kt-packages/tree/main/packages/is-space#readme",
43
+ "devDependencies": {}
44
+ }