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

encode-utf8

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

encode-utf8 - npm Package Compare versions

Comparing version 1.0.3 to 2.0.0

.github/workflows/test.yml

4

index.d.ts

@@ -1,2 +0,2 @@

declare function encodeUtf8 (input: string): ArrayBuffer
export = encodeUtf8
/** @returns an ArrayBuffer with the `input` string represented as UTF8 encoded data */
export default function encodeUtf8 (input: string): ArrayBuffer

@@ -1,12 +0,10 @@

'use strict'
export default function encodeUtf8 (input) {
const result = []
const size = input.length
module.exports = function encodeUtf8 (input) {
var result = []
var size = input.length
for (let index = 0; index < size; index++) {
let point = input.charCodeAt(index)
for (var index = 0; index < size; index++) {
var point = input.charCodeAt(index)
if (point >= 0xD800 && point <= 0xDBFF && size > index + 1) {
var second = input.charCodeAt(index + 1)
const second = input.charCodeAt(index + 1)

@@ -13,0 +11,0 @@ if (second >= 0xDC00 && second <= 0xDFFF) {

{
"name": "encode-utf8",
"version": "1.0.3",
"version": "2.0.0",
"license": "MIT",
"repository": "LinusU/encode-utf8",
"type": "module",
"exports": "./index.js",
"scripts": {
"test": "standard && mocha"
"test": "standard && mocha && ts-readme-generator --check"
},
"devDependencies": {
"mocha": "^6.2.2",
"standard": "^14.3.1"
"mocha": "^9.0.2",
"standard": "^16.0.3",
"ts-readme-generator": "^0.5.1"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
}
}

@@ -8,3 +8,3 @@ # Encode UTF8

```js
npm install --save encode-uf8
npm install --save encode-utf8
```

@@ -15,3 +15,3 @@

```js
const encodeUtf8 = require('encode-utf8')
import encodeUtf8 from 'encode-utf8'

@@ -27,4 +27,5 @@ console.log(encodeUtf8('Hello, World!'))

### `encodeUtf8(input: string): ArrayBuffer`
### `encodeUtf8(input)`
Returns an ArrayBuffer with the string represented as UTF8 encoded data.
- `input` (`string`, required)
- returns `ArrayBuffer` - an ArrayBuffer with the `input` string represented as UTF8 encoded data
/* eslint-env mocha */
'use strict'
import assert from 'node:assert'
import encodeUtf8 from './index.js'
const assert = require('assert')
const encodeUtf8 = require('./')
const testCases = [

@@ -9,0 +7,0 @@ '゚・✿ヾ╲(。◕‿◕。)╱✿・゚',

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