Skip to content

Commit

Permalink
fix(package): export interface namespaces in addition to merged methods
Browse files Browse the repository at this point in the history
  • Loading branch information
pgoldrbx committed Apr 14, 2020
1 parent 01d312c commit 3545f33
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ Determine if a JsonML node has attributes

### XML

```js
const { xml } = require('@condenast/jsonml.js');
```

#### `fromXML( elem, filter )`

Converts XML nodes to JsonML
Expand Down
19 changes: 17 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
'use strict';

const utils = require('./utils');
const dom = require('./dom');
const html = require('./html');
const utils = require('./utils');
const xml = require('./xml');
Object.assign(module.exports, utils, dom, html, xml);

const namespaces = {
dom,
html,
utils,
xml,
};

// Export all methods and namespaced interfaces
Object.assign(module.exports,
namespaces,
dom,
html,
utils,
xml
);
16 changes: 14 additions & 2 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,20 @@ const xml = require('../lib/xml');
const utils = require('../lib/utils');

describe('JsonML module index', function() {
it('should merge and export interfaces', function() {
assert.deepEqual(JsonML, Object.assign({}, dom, html, xml, utils));
it('should export the dom namespace', function() {
assert.deepEqual(JsonML.dom, dom);
});

it('should export the html namespace', function() {
assert.deepEqual(JsonML.html, html);
});

it('should export the xml namespace', function() {
assert.deepEqual(JsonML.xml, xml);
});

it('should export the utils namespace', function() {
assert.deepEqual(JsonML.utils, utils);
});

it('should export all methods from the dom interface', function() {
Expand Down

0 comments on commit 3545f33

Please sign in to comment.