source: trip-planner-front/node_modules/ws/lib/validation.js@ bdd6491

Last change on this file since bdd6491 was e29cc2e, checked in by Ema <ema_spirova@…>, 3 years ago

primeNG components

  • Property mode set to 100644
File size: 695 bytes
RevLine 
[6a3a178]1'use strict';
2
[e29cc2e]3try {
4 const isValidUTF8 = require('utf-8-validate');
5
6 exports.isValidUTF8 =
7 typeof isValidUTF8 === 'object'
8 ? isValidUTF8.Validation.isValidUTF8 // utf-8-validate@<3.0.0
9 : isValidUTF8;
10} catch (e) /* istanbul ignore next */ {
11 exports.isValidUTF8 = () => true;
12}
13
[6a3a178]14/**
15 * Checks if a status code is allowed in a close frame.
16 *
17 * @param {Number} code The status code
18 * @return {Boolean} `true` if the status code is valid, else `false`
19 * @public
20 */
[e29cc2e]21exports.isValidStatusCode = (code) => {
[6a3a178]22 return (
23 (code >= 1000 &&
[e29cc2e]24 code <= 1013 &&
[6a3a178]25 code !== 1004 &&
26 code !== 1005 &&
27 code !== 1006) ||
28 (code >= 3000 && code <= 4999)
29 );
[e29cc2e]30};
Note: See TracBrowser for help on using the repository browser.