* calcLengthLength - calculate the length of the remaining * length field * * @api private
(length)
| 1899 | * @api private |
| 1900 | */ |
| 1901 | function calcLengthLength(length) { |
| 1902 | if (length >= 0 && length < 128) { |
| 1903 | return 1 |
| 1904 | } else if (length >= 128 && length < 16384) { |
| 1905 | return 2 |
| 1906 | } else if (length >= 16384 && length < 2097152) { |
| 1907 | return 3 |
| 1908 | } else if (length >= 2097152 && length < 268435456) { |
| 1909 | return 4 |
| 1910 | } else { |
| 1911 | return 0 |
| 1912 | } |
| 1913 | } |
| 1914 | |
| 1915 | /** |
| 1916 | * writeLength - write an MQTT style length field to the buffer |
no outgoing calls
no test coverage detected