Skip to content
This repository was archived by the owner on Mar 18, 2019. It is now read-only.

Commit 651cf16

Browse files
committed
Remove import/export
1 parent 0eac204 commit 651cf16

8 files changed

Lines changed: 32 additions & 8 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Install it with NPM or add it to your package.json:
4747

4848

4949
```javascript
50-
import coreapi from 'coreapi';
50+
const coreapi = require('coreapi');
5151

5252
const client = new coreapi.Client()
5353

lib/client.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const codecs = require('./codecs')
22
const transports = require('./transports')
33
const utils = require('./utils')
44

5-
export class Client {
5+
class Client {
66
constructor () {
77
this.decoders = [new codecs.CoreJSONCodec(), new codecs.JSONCodec(), new codecs.TextCodec()]
88
this.transports = [new transports.HTTPTransport()]
@@ -17,3 +17,7 @@ export class Client {
1717
return transport.action(url, this.decoders)
1818
}
1919
}
20+
21+
module.exports = {
22+
Client: Client
23+
}

lib/codecs/corejson.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const document = require('../document')
22

3-
export class CoreJSONCodec {
3+
class CoreJSONCodec {
44
constructor () {
55
this.mediaType = 'application/coreapi+json'
66
}
@@ -9,3 +9,7 @@ export class CoreJSONCodec {
99
return new document.Document(text)
1010
}
1111
}
12+
13+
module.exports = {
14+
CoreJSONCodec: CoreJSONCodec
15+
}

lib/codecs/json.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export class JSONCodec {
1+
class JSONCodec {
22
constructor () {
33
this.mediaType = 'application/json'
44
}
@@ -7,3 +7,7 @@ export class JSONCodec {
77
return JSON.parse(text)
88
}
99
}
10+
11+
module.exports = {
12+
JSONCodec: JSONCodec
13+
}

lib/codecs/text.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export class TextCodec {
1+
class TextCodec {
22
constructor () {
33
this.mediaType = 'text/*'
44
}
@@ -7,3 +7,7 @@ export class TextCodec {
77
return text
88
}
99
}
10+
11+
module.exports = {
12+
TextCodec: TextCodec
13+
}

lib/document.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
export class Document {
1+
class Document {
22
constructor (text) {
33
this.text = text
44
}
55
}
6+
7+
module.exports = {
8+
Document: Document
9+
}

lib/transports/http.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const parseResponse = (response, decoders) => {
99
})
1010
}
1111

12-
export class HTTPTransport {
12+
class HTTPTransport {
1313
constructor () {
1414
this.schemes = ['http', 'https']
1515
}
@@ -25,3 +25,7 @@ export class HTTPTransport {
2525
})
2626
}
2727
}
28+
29+
module.exports = {
30+
HTTPTransport: HTTPTransport
31+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "coreapi",
3-
"version": "0.0.3",
3+
"version": "0.0.5",
44
"description": "Javascript client library for Core API",
55
"main": "lib/index.js",
66
"scripts": {

0 commit comments

Comments
 (0)