From e1cd61eeeb89c60f3af40485a921dddd77820104 Mon Sep 17 00:00:00 2001 From: Sonny Piers Date: Sat, 10 Dec 2016 14:27:57 +0100 Subject: [PATCH] stop directly exporting tag method (#107) --- index.js | 4 +++- test/ltx-test.js | 14 ++++++++++++++ test/tag-test.js | 1 - 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 test/ltx-test.js diff --git a/index.js b/index.js index ca39d0bb..cf194cbe 100644 --- a/index.js +++ b/index.js @@ -12,7 +12,9 @@ var is = require('./lib/is') var clone = require('./lib/clone') var stringify = require('./lib/stringify') -exports = module.exports = tag +exports = module.exports = function ltx () { + return tag.apply(null, arguments) +} exports.Element = Element diff --git a/test/ltx-test.js b/test/ltx-test.js new file mode 100644 index 00000000..0511f446 --- /dev/null +++ b/test/ltx-test.js @@ -0,0 +1,14 @@ +'use strict' + +var vows = require('vows') +var assert = require('assert') +var ltx = require('..') +var tag = require('../lib/tag') + +vows.describe('ltx').addBatch({ + 'returns same result as tag': function () { + var a = tag(['', ''], 'bar') + var b = ltx(['', ''], 'bar') + assert.strictEqual(a.toString(), b.toString()) + } +}).export(module) diff --git a/test/tag-test.js b/test/tag-test.js index 5c866db7..547550a8 100644 --- a/test/tag-test.js +++ b/test/tag-test.js @@ -8,7 +8,6 @@ var Element = ltx.Element vows.describe('tag').addBatch({ 'exported correctly': function () { - assert.equal(ltx, tag) assert.equal(ltx.tag, tag) }, 'parses the string and return an Element object': function () {