diff --git a/benchmark/mime/parse-type-and-subtype.js b/benchmark/mime/parse-type-and-subtype.js deleted file mode 100644 index 4b91dc1db6ab24..00000000000000 --- a/benchmark/mime/parse-type-and-subtype.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict'; - -const common = require('../common'); -const assert = require('assert'); - -const bench = common.createBenchmark(main, { - n: [1e7], - value: [ - 'application/ecmascript; ', - 'text/html;charset=gbk', - // eslint-disable-next-line max-len - 'text/html;0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789=x;charset=gbk', - ], -}, { - flags: ['--expose-internals'], -}); - -function main({ n, value }) { - - const parseTypeAndSubtype = require('internal/mime').parseTypeAndSubtype; - // Warm up. - const length = 1024; - const array = []; - let errCase = false; - - for (let i = 0; i < length; ++i) { - try { - array.push(parseTypeAndSubtype(value)); - } catch (e) { - errCase = true; - array.push(e); - } - } - - // console.log(`errCase: ${errCase}`); - bench.start(); - for (let i = 0; i < n; ++i) { - const index = i % length; - try { - array[index] = parseTypeAndSubtype(value); - } catch (e) { - array[index] = e; - } - } - - bench.end(n); - - // Verify the entries to prevent dead code elimination from making - // the benchmark invalid. - for (let i = 0; i < length; ++i) { - assert.strictEqual(typeof array[i], errCase ? 'object' : 'object'); - } -} diff --git a/benchmark/mime/to-ascii-lower.js b/benchmark/mime/to-ascii-lower.js deleted file mode 100644 index 93a4a14dc6d96b..00000000000000 --- a/benchmark/mime/to-ascii-lower.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict'; - -const common = require('../common'); -const assert = require('assert'); - -const bench = common.createBenchmark(main, { - n: [1e7], - value: [ - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', - 'UPPERCASE', - 'lowercase', - 'mixedCase', - ], -}, { - flags: ['--expose-internals'], -}); - -function main({ n, value }) { - - const toASCIILower = require('internal/mime').toASCIILower; - // Warm up. - const length = 1024; - const array = []; - let errCase = false; - - for (let i = 0; i < length; ++i) { - try { - array.push(toASCIILower(value)); - } catch (e) { - errCase = true; - array.push(e); - } - } - - // console.log(`errCase: ${errCase}`); - bench.start(); - - for (let i = 0; i < n; ++i) { - const index = i % length; - try { - array[index] = toASCIILower(value); - } catch (e) { - array[index] = e; - } - } - - bench.end(n); - - // Verify the entries to prevent dead code elimination from making - // the benchmark invalid. - for (let i = 0; i < length; ++i) { - assert.strictEqual(typeof array[i], errCase ? 'object' : 'string'); - } -} diff --git a/lib/internal/mime.js b/lib/internal/mime.js index 332ed8b5368c84..0a1d8e7e67916b 100644 --- a/lib/internal/mime.js +++ b/lib/internal/mime.js @@ -384,8 +384,6 @@ ObjectDefineProperty(MIMEType.prototype, 'toJSON', { }); module.exports = { - toASCIILower, - parseTypeAndSubtype, MIMEParams, MIMEType, }; diff --git a/test/parallel/test-mime-api.js b/test/parallel/test-mime-api.js index 0fabd1a4cce35f..30272e5aa64df5 100644 --- a/test/parallel/test-mime-api.js +++ b/test/parallel/test-mime-api.js @@ -4,8 +4,6 @@ require('../common'); const assert = require('assert'); const { MIMEType, MIMEParams } = require('util'); -const { toASCIILower } = require('internal/mime'); - const WHITESPACES = '\t\n\f\r '; const NOT_HTTP_TOKEN_CODE_POINT = ','; @@ -160,8 +158,3 @@ assert.throws(() => params.set(`x${NOT_HTTP_TOKEN_CODE_POINT}`, 'x'), /parameter assert.throws(() => params.set('x', `${NOT_HTTP_QUOTED_STRING_CODE_POINT};`), /parameter value/i); assert.throws(() => params.set('x', `${NOT_HTTP_QUOTED_STRING_CODE_POINT}x`), /parameter value/i); assert.throws(() => params.set('x', `x${NOT_HTTP_QUOTED_STRING_CODE_POINT}`), /parameter value/i); - -assert.strictEqual(toASCIILower('someThing'), 'something'); -assert.strictEqual(toASCIILower('SomeThing'), 'something'); -assert.strictEqual(toASCIILower('SomeThing3'), 'something3'); -assert.strictEqual(toASCIILower('ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 'abcdefghijklmnopqrstuvwxyz');