autopair 0.1.1 → 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/README.md CHANGED
@@ -43,3 +43,7 @@ npm install autopair
43
43
  });
44
44
  </script>
45
45
  ```
46
+
47
+ ## Development
48
+
49
+ Run a webserver and open `index.html`.
package/index.html CHANGED
@@ -8,8 +8,9 @@
8
8
  <h1>Autopair Test</h1>
9
9
  <textarea id="editor" rows="10" cols="50" autofocus></textarea>
10
10
 
11
- <script src="./src/autopair.js"></script>
12
- <script>
11
+ <script type="module">
12
+ import autopair from './src/autopair.js';
13
+
13
14
  // Use the autopair module
14
15
  const textarea = document.getElementById('editor');
15
16
 
package/package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "name": "autopair",
3
- "version": "0.1.1",
4
- "description": "Automatically close special characters like parentheses.",
3
+ "version": "1.0.1",
4
+ "description": "Automatically closes parentheses and similar characters.",
5
5
  "main": "index.js",
6
6
  "author": "Dennis Hackethal <engineering@dennishackethal.com>",
7
- "license": "Adjusted MIT"
7
+ "license": "Adjusted MIT",
8
+ "homepage": "https://github.com/dchacke/autopair.js",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/dchacke/autopair.js.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/dchacke/autopair.js/issues"
15
+ },
16
+ "keywords": [
17
+ "autopair",
18
+ "auto-pair",
19
+ "pairing",
20
+ "autocomplete",
21
+ "text",
22
+ "textarea",
23
+ "editor",
24
+ "brackets",
25
+ "parentheses",
26
+ "quotes",
27
+ "typethrough",
28
+ "markdown",
29
+ "syntax",
30
+ "input",
31
+ "javascript",
32
+ "web"
33
+ ]
8
34
  }
package/src/autopair.js CHANGED
@@ -1,4 +1,4 @@
1
- function autopair(textarea, pairs = {
1
+ export default function autopair(textarea, pairs = {
2
2
  '(': ')',
3
3
  '[': ']',
4
4
  '{': '}',
@@ -67,13 +67,3 @@ function autopair(textarea, pairs = {
67
67
  textarea.selectionStart = textarea.selectionEnd = start + 1;
68
68
  });
69
69
  }
70
-
71
- // Export for Node
72
- if (typeof module !== 'undefined' && module.exports) {
73
- module.exports = autopair;
74
- }
75
-
76
- // Attach to window for browser
77
- if (typeof window !== 'undefined') {
78
- window.autopair = autopair;
79
- }