Socket
Socket
Sign inDemoInstall

iconv-lite

Package Overview
Dependencies
0
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.10 to 0.2.11

29

index.js

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

var RE_SPACEDASH = /[- ]/g;
// Module exports

@@ -9,2 +10,7 @@ var iconv = module.exports = {

},
encodingExists: function(enc) {
loadEncodings();
enc = enc.replace(RE_SPACEDASH, "").toLowerCase();
return (iconv.encodings[enc] !== undefined);
},

@@ -18,8 +24,3 @@ defaultCharUnicode: '�',

getCodec: function(encoding) {
if (!iconv.encodingsLoaded) {
applyEncodings(require('./encodings/singlebyte'));
applyEncodings(require('./encodings/gbk'));
applyEncodings(require('./encodings/big5'));
iconv.encodingsLoaded = true;
}
loadEncodings();
var enc = encoding || "utf8";

@@ -29,3 +30,3 @@ var codecOptions = undefined;

if (getType(enc) === "String")
enc = enc.replace(/[- ]/g, "").toLowerCase();
enc = enc.replace(RE_SPACEDASH, "").toLowerCase();
var codec = iconv.encodings[enc];

@@ -201,5 +202,13 @@ var type = getType(codec);

// Load other encodings manually from files in /encodings dir.
function applyEncodings(encodings) {
for (var key in encodings)
iconv.encodings[key] = encodings[key]
function loadEncodings() {
if (!iconv.encodingsLoaded) {
[ require('./encodings/singlebyte'),
require('./encodings/gbk'),
require('./encodings/big5')
].forEach(function(encodings) {
for (var key in encodings)
iconv.encodings[key] = encodings[key]
});
iconv.encodingsLoaded = true;
}
}

@@ -206,0 +215,0 @@

{
"name": "iconv-lite",
"description": "Convert character encodings in pure javascript.",
"version": "0.2.10",
"version": "0.2.11",
"license": "MIT",

@@ -18,3 +18,4 @@

"ChangZhuo Chen (https://github.com/czchen)",
"Lee Treveil (https://github.com/leetreveil)"
"Lee Treveil (https://github.com/leetreveil)",
"Brian White (https://github.com/mscdex)"
],

@@ -21,0 +22,0 @@

@@ -23,2 +23,6 @@ iconv-lite - pure javascript character encoding conversion

// Check if encoding is supported
iconv.encodingExists("us-ascii")
## Supported encodings

@@ -25,0 +29,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc