Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

utf-8-validate

Package Overview
Dependencies
Maintainers
4
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

utf-8-validate - npm Package Compare versions

Comparing version 5.0.4 to 5.0.5

prebuilds/linux-arm64/node.napi.armv8.node

24

fallback.js

@@ -12,8 +12,8 @@ 'use strict';

*/
const isValidUTF8 = (buf) => {
var len = buf.length;
var i = 0;
function isValidUTF8(buf) {
const len = buf.length;
let i = 0;
while (i < len) {
if (buf[i] < 0x80) { // 0xxxxxxx
if ((buf[i] & 0x80) === 0x00) { // 0xxxxxxx
i++;

@@ -27,5 +27,5 @@ } else if ((buf[i] & 0xe0) === 0xc0) { // 110xxxxx 10xxxxxx

return false;
} else {
i += 2;
}
i += 2;
} else if ((buf[i] & 0xf0) === 0xe0) { // 1110xxxx 10xxxxxx 10xxxxxx

@@ -37,8 +37,8 @@ if (

buf[i] === 0xe0 && (buf[i + 1] & 0xe0) === 0x80 || // overlong
buf[i] === 0xed && (buf[i + 1] & 0xe0) === 0xa0 // surrogate (U+D800 - U+DFFF)
buf[i] === 0xed && (buf[i + 1] & 0xe0) === 0xa0 // surrogate (U+D800 - U+DFFF)
) {
return false;
} else {
i += 3;
}
i += 3;
} else if ((buf[i] & 0xf8) === 0xf0) { // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx

@@ -54,5 +54,5 @@ if (

return false;
} else {
i += 4;
}
i += 4;
} else {

@@ -64,4 +64,4 @@ return false;

return true;
};
}
module.exports = isValidUTF8;
{
"name": "utf-8-validate",
"version": "5.0.4",
"version": "5.0.5",
"description": "Check if a buffer contains valid UTF-8",

@@ -9,3 +9,4 @@ "main": "index.js",

"prebuild": "prebuildify --napi --strip",
"prebuild-linux-arm": "prebuildify-cross -i linux-armv6 -i linux-armv7 --napi --strip",
"prebuild-ia32": "prebuildify --arch=ia32 --napi --strip",
"prebuild-linux-arm": "prebuildify-cross -i linux-armv6 -i linux-armv7 -i linux-arm64 --napi --strip",
"test": "mocha"

@@ -12,0 +13,0 @@ },

# utf-8-validate
[![Version npm](https://img.shields.io/npm/v/utf-8-validate.svg)](https://www.npmjs.com/package/utf-8-validate)
[![Build Status](https://travis-ci.com/websockets/utf-8-validate.svg?branch=master)](https://travis-ci.com/websockets/utf-8-validate)
[![Windows Build](https://ci.appveyor.com/api/projects/status/github/websockets/utf-8-validate?branch=master&svg=true)](https://ci.appveyor.com/project/lpinca/utf-8-validate)
[![Build Status](https://img.shields.io/github/workflow/status/websockets/utf-8-validate/CI/master?label=build)](https://github.com/websockets/utf-8-validate/actions?query=workflow%3ACI+branch%3Amaster)
[![Windows x86 Build](https://ci.appveyor.com/api/projects/status/github/websockets/utf-8-validate?branch=master&svg=true)](https://ci.appveyor.com/project/lpinca/utf-8-validate)

@@ -7,0 +7,0 @@ Check if a buffer contains valid UTF-8 encoded text.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc