UNPKG

5.02 kBMarkdownView Raw
1<a
2 href="https://travis-ci.org/Xotic750/white-space-x"
3 title="Travis status">
4<img
5 src="https://travis-ci.org/Xotic750/white-space-x.svg?branch=master"
6 alt="Travis status" height="18">
7</a>
8<a
9 href="https://david-dm.org/Xotic750/white-space-x"
10 title="Dependency status">
11<img src="https://david-dm.org/Xotic750/white-space-x/status.svg"
12 alt="Dependency status" height="18"/>
13</a>
14<a
15 href="https://david-dm.org/Xotic750/white-space-x?type=dev"
16 title="devDependency status">
17<img src="https://david-dm.org/Xotic750/white-space-x/dev-status.svg"
18 alt="devDependency status" height="18"/>
19</a>
20<a
21 href="https://badge.fury.io/js/white-space-x"
22 title="npm version">
23<img src="https://badge.fury.io/js/white-space-x.svg"
24 alt="npm version" height="18">
25</a>
26<a
27 href="https://www.jsdelivr.com/package/npm/white-space-x"
28 title="jsDelivr hits">
29<img src="https://data.jsdelivr.com/v1/package/npm/white-space-x/badge?style=rounded"
30 alt="jsDelivr hits" height="18">
31</a>
32<a
33 href="https://bettercodehub.com/results/Xotic750/white-space-x"
34 title="bettercodehub score">
35<img src="https://bettercodehub.com/edge/badge/Xotic750/white-space-x?branch=master"
36 alt="bettercodehub score" height="18">
37</a>
38<a
39 href="https://coveralls.io/github/Xotic750/white-space-x?branch=master"
40 title="Coverage Status">
41<img src="https://coveralls.io/repos/github/Xotic750/white-space-x/badge.svg?branch=master"
42 alt="Coverage Status" height="18">
43</a>
44
45<a name="module_white-space-x"></a>
46
47## white-space-x
48
49### `module.exports` : <code>string</code> ⏏
50
51List of ECMAScript white space characters.
52
53**Kind**: Exported member
54**Example**
55
56```js
57import whiteSpace from 'white-space-x';
58whiteSpaces.list.foreach(function(item) {
59 console.log(item.description, item.code, item.string);
60});
61
62const characters = [
63 '\u0009',
64 '\u000a',
65 '\u000b',
66 '\u000c',
67 '\u000d',
68 '\u0020',
69 '\u00a0',
70 '\u1680',
71 '\u2000',
72 '\u2001',
73 '\u2002',
74 '\u2003',
75 '\u2004',
76 '\u2005',
77 '\u2006',
78 '\u2007',
79 '\u2008',
80 '\u2009',
81 '\u200a',
82 '\u2028',
83 '\u2029',
84 '\u202f',
85 '\u205f',
86 '\u3000',
87 '\ufeff',
88];
89const ws = characters.join('');
90const re1 = new RegExp('^[' + whiteSpace + ']+$)');
91console.log(re1.test(ws)); // true
92```
93
94- [white-space-x](#module_white-space-x)
95 - _static_
96 - [`.list`](#module_white-space-x.list) : <code>Array.&lt;CharRecord&gt;</code>
97 - [`.string2016`](#module_white-space-x.string2016) : <code>string</code>
98 - _inner_
99 - [`~CharRecord`](#module_white-space-x..CharRecord) : <code>Object</code>
100
101<a name="module_white-space-x.list"></a>
102
103### `white-space-x.list` : <code>Array.&lt;CharRecord&gt;</code>
104
105An array of the whitespace char codes, string, descriptions and language
106presence in the specifications.
107
108**Kind**: static property of [<code>white-space-x</code>](#module_white-space-x)
109<a name="module_white-space-x.string2016"></a>
110
111### `white-space-x.string2016` : <code>string</code>
112
113A string of the ES5 to ES2016 whitespace characters.
114
115**Kind**: static property of [<code>white-space-x</code>](#module_white-space-x)
116**Example**
117
118```js
119import {string2016 as whiteSpace2016} from 'white-space-x';
120const characters = [
121 '\u0009',
122 '\u000a',
123 '\u000b',
124 '\u000c',
125 '\u000d',
126 '\u0020',
127 '\u00a0',
128 '\u1680',
129 '\u180e',
130 '\u2000',
131 '\u2001',
132 '\u2002',
133 '\u2003',
134 '\u2004',
135 '\u2005',
136 '\u2006',
137 '\u2007',
138 '\u2008',
139 '\u2009',
140 '\u200a',
141 '\u2028',
142 '\u2029',
143 '\u202f',
144 '\u205f',
145 '\u3000',
146 '\ufeff',
147];
148const ws = characters.join('');
149const re1 = new RegExp('^[' + whiteSpace2016 + ']+$)');
150console.log(re1.test(ws)); // true
151```
152
153<a name="module_white-space-x.string2017"></a>
154
155### `white-space-x.string2017` : <code>string</code>
156
157A string of the ES2017 to ES2018 whitespace characters.
158
159**Kind**: static property of [<code>white-space-x</code>](#module_white-space-x)
160<a name="module_white-space-x.string2018"></a>
161
162<a name="module_white-space-x..CharRecord"></a>
163
164### `white-space-x~CharRecord` : <code>Object</code>
165
166A record of a white space character.
167
168**Kind**: inner typedef of [<code>white-space-x</code>](#module_white-space-x)
169**Properties**
170
171| Name | Type | Description |
172| ----------- | -------------------- | --------------------------------------------- |
173| code | <code>number</code> | The character code. |
174| description | <code>string</code> | A description of the character. |
175| es5 | <code>boolean</code> | Whether the spec lists this as a white space. |
176| es2015 | <code>boolean</code> | Whether the spec lists this as a white space. |
177| es2016 | <code>boolean</code> | Whether the spec lists this as a white space. |
178| es2017 | <code>boolean</code> | Whether the spec lists this as a white space. |
179| es2018 | <code>boolean</code> | Whether the spec lists this as a white space. |
180| string | <code>string</code> | The character string. |