This repository was archived by the owner on Jun 28, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +67
-0
lines changed Expand file tree Collapse file tree 4 files changed +67
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ Please join and contribute:
19
19
20
20
## Trunk
21
21
22
+ * docs: browser demo fix #302
22
23
* fix: browserify export parse instead of stringify
23
24
24
25
## Version 4.15.1
Original file line number Diff line number Diff line change 60
60
"csv-spectrum" : " ^1.0.0" ,
61
61
"each" : " ^1.2.2" ,
62
62
"eslint" : " ^7.13.0" ,
63
+ "express" : " ^4.17.1" ,
63
64
"mocha" : " ^8.2.1" ,
64
65
"pad" : " ^3.2.0" ,
65
66
"should" : " ^13.2.3" ,
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html >
3
+ < head >
4
+ < title > Page Title</ title >
5
+ < script src ="lib/index.js "> </ script >
6
+ < style >
7
+ div {
8
+ width : 60% ;
9
+ margin : 5rem auto;
10
+ text-align : center;
11
+ }
12
+ textarea {
13
+ width : 100% ;
14
+ height : 200px ;
15
+ }
16
+ input {
17
+ margin : 1rem ;
18
+ }
19
+ pre {
20
+ text-align : left;
21
+ padding : 2rem ;
22
+ border : 1px solid black;
23
+ }
24
+ </ style >
25
+ </ head >
26
+ < body >
27
+ < div >
28
+ < h1 > CSV parse demo</ h1 >
29
+ < label for ="input "> JSON input:</ label >
30
+ < textarea id ="input "> year,phone
31
+ XXXX,XXX XXXX
32
+ YYYY,YYY YYYY</ textarea >
33
+ < input id ="convert " type ="submit " value ="convert " />
34
+ < pre > < code id ="output "> </ code > </ pre >
35
+ < script >
36
+ const convertEl = document . getElementById ( 'convert' )
37
+ const inputEl = document . getElementById ( 'input' )
38
+ const outputEl = document . getElementById ( 'output' )
39
+ convertEl . onclick = ( e ) => {
40
+ let input ;
41
+ parse ( inputEl . value , {
42
+ columns : true
43
+ } , function ( err , data ) {
44
+ if ( err ) {
45
+ return alert ( 'Invalid CSV: ' + err . message )
46
+ }
47
+ console . log ( data )
48
+ outputEl . innerHTML = JSON . stringify ( data , null , 2 )
49
+ } )
50
+ }
51
+ </ script >
52
+ < div >
53
+ </ body >
54
+ </ html >
Original file line number Diff line number Diff line change
1
+
2
+ const express = require ( 'express' )
3
+ const app = express ( )
4
+ const port = 3000
5
+
6
+ app . use ( express . static ( __dirname ) )
7
+ app . use ( '/lib' , express . static ( `${ __dirname } /../../lib/browser` ) )
8
+
9
+ app . listen ( port , ( ) => {
10
+ console . log ( `Example app listening at http://localhost:${ port } ` )
11
+ } )
You can’t perform that action at this time.
0 commit comments