From 703cb9a0ee910e8ac0727e95de7a60c1959e9b2a Mon Sep 17 00:00:00 2001 From: Dave Sag Date: Sun, 27 Sep 2020 06:10:41 +1000 Subject: [PATCH 1/2] #161 rename noop to Noop and make it an instatiatable function that returns itself --- src/dataTypes.js | 4 ++-- src/types/noop.js | 3 --- test/unit/dataTypes.test.js | 4 ++-- test/unit/types/noop.test.js | 12 ------------ 4 files changed, 4 insertions(+), 19 deletions(-) delete mode 100644 src/types/noop.js delete mode 100644 test/unit/types/noop.test.js diff --git a/src/dataTypes.js b/src/dataTypes.js index 2556e45..9b9e4c2 100644 --- a/src/dataTypes.js +++ b/src/dataTypes.js @@ -1,4 +1,4 @@ -const noop = require('./types/noop') +const Noop = require('./types/Noop') const NumericType = require('./types/NumericType') const StringType = require('./types/StringType') const basicTypes = require('./constants/basicTypes') @@ -7,7 +7,7 @@ const stringTypes = require('./constants/stringTypes') const deferrables = require('./constants/deferrables') const basicDataTypes = basicTypes.reduce((acc, elem) => { - acc[elem] = noop + acc[elem] = Noop return acc }, {}) diff --git a/src/types/noop.js b/src/types/noop.js deleted file mode 100644 index c8df74f..0000000 --- a/src/types/noop.js +++ /dev/null @@ -1,3 +0,0 @@ -const noop = () => {} - -module.exports = noop diff --git a/test/unit/dataTypes.test.js b/test/unit/dataTypes.test.js index ca97212..bbb6571 100644 --- a/test/unit/dataTypes.test.js +++ b/test/unit/dataTypes.test.js @@ -1,7 +1,7 @@ const { expect } = require('chai') const dataTypes = require('../../src/dataTypes') -const noop = require('../../src/types/noop') +const Noop = require('../../src/types/Noop') const NumericType = require('../../src/types/NumericType') const StringType = require('../../src/types/StringType') @@ -69,7 +69,7 @@ describe('dataTypes', () => { it('has basicTypes', () => { basicTypes.forEach(type => { - expect(dataTypes).to.have.property(type, noop) + expect(dataTypes).to.have.property(type, Noop) }) }) diff --git a/test/unit/types/noop.test.js b/test/unit/types/noop.test.js deleted file mode 100644 index aba6119..0000000 --- a/test/unit/types/noop.test.js +++ /dev/null @@ -1,12 +0,0 @@ -const { expect } = require('chai') -const noop = require('../../../src/types/noop') - -describe('src/types/noop', () => { - it('is a function', () => { - expect(noop).to.be.a('function') - }) - - it('does nothing', () => { - expect(noop()).to.be.undefined - }) -}) From 96a6df119458745326265dd22ebb496aca849d46 Mon Sep 17 00:00:00 2001 From: Dave Sag Date: Sun, 27 Sep 2020 06:11:26 +1000 Subject: [PATCH 2/2] #161 rename noop to Noop and make it an instatiatable function that returns itself --- src/types/Noop.js | 5 +++++ test/unit/types/Noop.test.js | 12 ++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 src/types/Noop.js create mode 100644 test/unit/types/Noop.test.js diff --git a/src/types/Noop.js b/src/types/Noop.js new file mode 100644 index 0000000..03c1646 --- /dev/null +++ b/src/types/Noop.js @@ -0,0 +1,5 @@ +function Noop() { + return Noop +} + +module.exports = Noop diff --git a/test/unit/types/Noop.test.js b/test/unit/types/Noop.test.js new file mode 100644 index 0000000..914b538 --- /dev/null +++ b/test/unit/types/Noop.test.js @@ -0,0 +1,12 @@ +const { expect } = require('chai') +const Noop = require('../../../src/types/Noop') + +describe('src/types/Noop', () => { + it('is a function', () => { + expect(Noop).to.be.a('function') + }) + + it('returns itself', () => { + expect(Noop()).to.equal(Noop) + }) +})