e22m4u 1 месяц назад
Родитель
Сommit
c31984a482

+ 8 - 8
dist/cjs/index.cjs

@@ -133,12 +133,12 @@ var import_js_format = require("@e22m4u/js-format");
 function createError(errorCtor, message, ...args) {
   if (typeof errorCtor !== "function")
     throw new import_js_format.Errorf(
-      'The first argument of "createError" should be a constructor, but %v was given.',
+      'The first parameter of "createError" should be a constructor, but %v was given.',
       errorCtor
     );
   if (message != null && typeof message !== "string")
     throw new import_js_format.Errorf(
-      'The second argument of "createError" should be a String, but %v was given.',
+      'The second parameter of "createError" should be a String, but %v was given.',
       message
     );
   if (message == null) return new errorCtor();
@@ -152,7 +152,7 @@ var import_js_format2 = require("@e22m4u/js-format");
 function toCamelCase(input) {
   if (typeof input !== "string")
     throw new import_js_format2.Errorf(
-      'The first argument of "toCamelCase" should be a String, but %v was given.',
+      'The first parameter of "toCamelCase" should be a String, but %v was given.',
       input
     );
   return input.replace(/(^\w|[A-Z]|\b\w)/g, (c) => c.toUpperCase()).replace(/\W+/g, "").replace(/(^\w)/g, (c) => c.toLowerCase());
@@ -164,7 +164,7 @@ var import_js_format3 = require("@e22m4u/js-format");
 function isResponseSent(response) {
   if (!response || typeof response !== "object" || Array.isArray(response) || typeof response.headersSent !== "boolean") {
     throw new import_js_format3.Errorf(
-      'The first argument of "isResponseSent" should be an instance of ServerResponse, but %v was given.',
+      'The first parameter of "isResponseSent" should be an instance of ServerResponse, but %v was given.',
       response
     );
   }
@@ -315,7 +315,7 @@ var import_js_format6 = require("@e22m4u/js-format");
 function parseCookieString(input) {
   if (typeof input !== "string")
     throw new import_js_format6.Errorf(
-      "The first parameter of `parseCookieString` must be a String, but %v was given.",
+      'The first parameter of "parseCookieString" must be a String, but %v was given.',
       input
     );
   return input.split(";").filter((v) => v !== "").map((v) => v.split("=")).reduce((cookies, tuple) => {
@@ -339,7 +339,7 @@ var import_js_format7 = require("@e22m4u/js-format");
 function createCookieString(data) {
   if (!data || typeof data !== "object" || Array.isArray(data))
     throw new import_js_format7.Errorf(
-      "The first parameter of `createCookieString` should be an Object, but %v was given.",
+      'The first parameter of "createCookieString" should be an Object, but %v was given.',
       data
     );
   let cookies = "";
@@ -670,7 +670,7 @@ var import_js_format9 = require("@e22m4u/js-format");
 function getRequestPathname(request) {
   if (!request || typeof request !== "object" || Array.isArray(request) || typeof request.url !== "string") {
     throw new import_js_format9.Errorf(
-      'The first argument of "getRequestPathname" should be an instance of IncomingMessage, but %v was given.',
+      'The first parameter of "getRequestPathname" should be an instance of IncomingMessage, but %v was given.',
       request
     );
   }
@@ -1230,7 +1230,7 @@ var _RequestParser = class _RequestParser extends DebuggableService {
   parse(request) {
     if (!(request instanceof import_http3.IncomingMessage))
       throw new import_js_format15.Errorf(
-        "The first argument of RequestParser.parse should be an instance of IncomingMessage, but %v was given.",
+        "The first parameter of RequestParser.parse should be an instance of IncomingMessage, but %v was given.",
         request
       );
     const data = {};

+ 1 - 1
src/parsers/request-parser.js

@@ -19,7 +19,7 @@ export class RequestParser extends DebuggableService {
   parse(request) {
     if (!(request instanceof IncomingMessage))
       throw new Errorf(
-        'The first argument of RequestParser.parse should be ' +
+        'The first parameter of RequestParser.parse should be ' +
           'an instance of IncomingMessage, but %v was given.',
         request,
       );

+ 2 - 2
src/parsers/request-parser.spec.js

@@ -6,12 +6,12 @@ import {createRequestMock} from '../utils/index.js';
 
 describe('RequestParser', function () {
   describe('parse', function () {
-    it('requires the first argument to be an instance of IncomingMessage', function () {
+    it('requires the first parameter to be an instance of IncomingMessage', function () {
       const s = new RequestParser();
       const throwable = v => () => s.parse(v);
       const error = v =>
         format(
-          'The first argument of RequestParser.parse should be ' +
+          'The first parameter of RequestParser.parse should be ' +
             'an instance of IncomingMessage, but %s was given.',
           v,
         );

+ 1 - 1
src/utils/create-cookie-string.js

@@ -9,7 +9,7 @@ import {Errorf} from '@e22m4u/js-format';
 export function createCookieString(data) {
   if (!data || typeof data !== 'object' || Array.isArray(data))
     throw new Errorf(
-      'The first parameter of `createCookieString` should be ' +
+      'The first parameter of "createCookieString" should be ' +
         'an Object, but %v was given.',
       data,
     );

+ 2 - 2
src/utils/create-cookie-string.spec.js

@@ -3,11 +3,11 @@ import {format} from '@e22m4u/js-format';
 import {createCookieString} from './create-cookie-string.js';
 
 describe('createCookieString', function () {
-  it('requires the first argument to be an object', function () {
+  it('requires the first parameter to be an object', function () {
     const throwable = v => () => createCookieString(v);
     const error = v =>
       format(
-        'The first parameter of `createCookieString` should be ' +
+        'The first parameter of "createCookieString" should be ' +
           'an Object, but %s was given.',
         v,
       );

+ 2 - 2
src/utils/create-error.js

@@ -11,13 +11,13 @@ import {format, Errorf} from '@e22m4u/js-format';
 export function createError(errorCtor, message, ...args) {
   if (typeof errorCtor !== 'function')
     throw new Errorf(
-      'The first argument of "createError" should be ' +
+      'The first parameter of "createError" should be ' +
         'a constructor, but %v was given.',
       errorCtor,
     );
   if (message != null && typeof message !== 'string')
     throw new Errorf(
-      'The second argument of "createError" should be ' +
+      'The second parameter of "createError" should be ' +
         'a String, but %v was given.',
       message,
     );

+ 2 - 2
src/utils/create-error.spec.js

@@ -7,7 +7,7 @@ describe('createError', function () {
     const throwable = v => () => createError(v);
     const error = v =>
       format(
-        'The first argument of "createError" should be ' +
+        'The first parameter of "createError" should be ' +
           'a constructor, but %s was given.',
         v,
       );
@@ -28,7 +28,7 @@ describe('createError', function () {
     const throwable = v => () => createError(Error, v);
     const error = v =>
       format(
-        'The second argument of "createError" should be ' +
+        'The second parameter of "createError" should be ' +
           'a String, but %s was given.',
         v,
       );

+ 1 - 1
src/utils/create-request-mock.spec.js

@@ -7,7 +7,7 @@ import {createRequestMock} from './create-request-mock.js';
 import {CHARACTER_ENCODING_LIST} from './fetch-request-body.js';
 
 describe('createRequestMock', function () {
-  it('requires the first argument to be an Object', function () {
+  it('requires the first parameter to be an Object', function () {
     const throwable = v => () => createRequestMock(v);
     const error = v =>
       format(

+ 1 - 1
src/utils/get-request-pathname.js

@@ -14,7 +14,7 @@ export function getRequestPathname(request) {
     typeof request.url !== 'string'
   ) {
     throw new Errorf(
-      'The first argument of "getRequestPathname" should be ' +
+      'The first parameter of "getRequestPathname" should be ' +
         'an instance of IncomingMessage, but %v was given.',
       request,
     );

+ 2 - 2
src/utils/get-request-pathname.spec.js

@@ -3,11 +3,11 @@ import {format} from '@e22m4u/js-format';
 import {getRequestPathname} from './get-request-pathname.js';
 
 describe('getRequestPathname', function () {
-  it('requires the argument to be an Object with "url" property', function () {
+  it('requires the first parameter to be an Object with "url" property', function () {
     const throwable = v => () => getRequestPathname(v);
     const error = v =>
       format(
-        'The first argument of "getRequestPathname" should be ' +
+        'The first parameter of "getRequestPathname" should be ' +
           'an instance of IncomingMessage, but %s was given.',
         v,
       );

+ 1 - 1
src/utils/is-response-sent.js

@@ -14,7 +14,7 @@ export function isResponseSent(response) {
     typeof response.headersSent !== 'boolean'
   ) {
     throw new Errorf(
-      'The first argument of "isResponseSent" should be ' +
+      'The first parameter of "isResponseSent" should be ' +
         'an instance of ServerResponse, but %v was given.',
       response,
     );

+ 2 - 2
src/utils/is-response-sent.spec.js

@@ -3,11 +3,11 @@ import {format} from '@e22m4u/js-format';
 import {isResponseSent} from './is-response-sent.js';
 
 describe('isResponseSent', function () {
-  it('requires the argument to be an Object with "headersSent" property', function () {
+  it('requires the first parameter to be an Object with "headersSent" property', function () {
     const throwable = v => () => isResponseSent(v);
     const error = v =>
       format(
-        'The first argument of "isResponseSent" should be ' +
+        'The first parameter of "isResponseSent" should be ' +
           'an instance of ServerResponse, but %s was given.',
         v,
       );

+ 1 - 1
src/utils/parse-cookie-string.js

@@ -15,7 +15,7 @@ import {Errorf} from '@e22m4u/js-format';
 export function parseCookieString(input) {
   if (typeof input !== 'string')
     throw new Errorf(
-      'The first parameter of `parseCookieString` must be a String, ' +
+      'The first parameter of "parseCookieString" must be a String, ' +
         'but %v was given.',
       input,
     );

+ 1 - 1
src/utils/parse-cookie-string.spec.js

@@ -7,7 +7,7 @@ describe('parseCookieString', function () {
     const throwable = v => () => parseCookieString(v);
     const error = v =>
       format(
-        'The first parameter of `parseCookieString` must be a String, ' +
+        'The first parameter of "parseCookieString" must be a String, ' +
           'but %s was given.',
         v,
       );

+ 1 - 1
src/utils/to-camel-case.js

@@ -9,7 +9,7 @@ import {Errorf} from '@e22m4u/js-format';
 export function toCamelCase(input) {
   if (typeof input !== 'string')
     throw new Errorf(
-      'The first argument of "toCamelCase" ' +
+      'The first parameter of "toCamelCase" ' +
         'should be a String, but %v was given.',
       input,
     );

+ 1 - 1
src/utils/to-camel-case.spec.js

@@ -7,7 +7,7 @@ describe('toCamelCase', function () {
     const throwable = v => () => toCamelCase(v);
     const error = v =>
       format(
-        'The first argument of "toCamelCase" ' +
+        'The first parameter of "toCamelCase" ' +
           'should be a String, but %s was given.',
         v,
       );