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

@polkadot/x-textencoder

Package Overview
Dependencies
Maintainers
2
Versions
733
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polkadot/x-textencoder - npm Package Compare versions

Comparing version 10.1.11 to 10.1.12

1

browser.js
// Copyright 2017-2022 @polkadot/x-textencoder authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { extractGlobal } from '@polkadot/x-global';

@@ -4,0 +5,0 @@ import { TextEncoder as Fallback } from "./fallback.js";

5

cjs/browser.js

@@ -13,12 +13,9 @@ "use strict";

});
var _xGlobal = require("@polkadot/x-global");
var _fallback = require("./fallback");
var _packageInfo = require("./packageInfo");
// Copyright 2017-2022 @polkadot/x-textencoder authors & contributors
// SPDX-License-Identifier: Apache-2.0
const TextEncoder = (0, _xGlobal.extractGlobal)('TextEncoder', _fallback.TextEncoder);
exports.TextEncoder = TextEncoder;

@@ -7,5 +7,5 @@ "use strict";

exports.TextEncoder = void 0;
// Copyright 2017-2022 @polkadot/x-textencoder authors & contributors
// SPDX-License-Identifier: Apache-2.0
// This is very limited, only handling Ascii values

@@ -15,12 +15,8 @@ class TextEncoder {

const u8a = new Uint8Array(value.length);
for (let i = 0; i < value.length; i++) {
u8a[i] = value.charCodeAt(i);
}
return u8a;
}
}
exports.TextEncoder = TextEncoder;
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -15,26 +14,20 @@ value: true

});
var _util = _interopRequireDefault(require("util"));
var _xGlobal = require("@polkadot/x-global");
var _packageInfo = require("./packageInfo");
// Copyright 2017-2022 @polkadot/x-textencoder authors & contributors
// SPDX-License-Identifier: Apache-2.0
class Fallback {
#encoder;
constructor() {
this.#encoder = new _util.default.TextEncoder();
} // For a Jest 26.0.1 environment, Buffer !== Uint8Array
}
// For a Jest 26.0.1 environment, Buffer !== Uint8Array
encode(value) {
return Uint8Array.from(this.#encoder.encode(value));
}
}
const TextEncoder = (0, _xGlobal.extractGlobal)('TextEncoder', Fallback);
exports.TextEncoder = TextEncoder;

@@ -9,3 +9,5 @@ "use strict";

// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
const packageInfo = {

@@ -15,4 +17,4 @@ name: '@polkadot/x-textencoder',

type: 'cjs',
version: '10.1.11'
version: '10.1.12'
};
exports.packageInfo = packageInfo;

@@ -18,3 +18,2 @@ "use strict";

});
var _browser = require("./browser");
"use strict";
var _xGlobal = require("@polkadot/x-global");
var _xTextencoder = require("@polkadot/x-textencoder");
// Copyright 2017-2022 @polkadot/x-textencoder authors & contributors
// SPDX-License-Identifier: Apache-2.0
(0, _xGlobal.exposeGlobal)('TextEncoder', _xTextencoder.TextEncoder);
"use strict";
var _browser = require("./browser");
var _node = require("./node");
// Copyright 2017-2022 @polkadot/x-textencoder authors & contributors
// SPDX-License-Identifier: Apache-2.0
console.log(new _browser.TextEncoder().encode('abc'));
console.log(new _node.TextEncoder().encode('abc'));
// Copyright 2017-2022 @polkadot/x-textencoder authors & contributors
// SPDX-License-Identifier: Apache-2.0
// This is very limited, only handling Ascii values

@@ -7,10 +8,7 @@ export class TextEncoder {

const u8a = new Uint8Array(value.length);
for (let i = 0; i < value.length; i++) {
u8a[i] = value.charCodeAt(i);
}
return u8a;
}
}
// Copyright 2017-2022 @polkadot/x-textencoder authors & contributors
// SPDX-License-Identifier: Apache-2.0
import util from 'util';
import { extractGlobal } from '@polkadot/x-global';
export { packageInfo } from "./packageInfo.js";
class Fallback {
#encoder;
constructor() {
this.#encoder = new util.TextEncoder();
} // For a Jest 26.0.1 environment, Buffer !== Uint8Array
}
// For a Jest 26.0.1 environment, Buffer !== Uint8Array
encode(value) {
return Uint8Array.from(this.#encoder.encode(value));
}
}
export const TextEncoder = extractGlobal('TextEncoder', Fallback);

@@ -20,3 +20,3 @@ {

"type": "module",
"version": "10.1.11",
"version": "10.1.12",
"main": "./cjs/node.js",

@@ -93,8 +93,8 @@ "module": "./node.js",

"dependencies": {
"@babel/runtime": "^7.19.4",
"@polkadot/x-global": "10.1.11"
"@babel/runtime": "^7.20.1",
"@polkadot/x-global": "10.1.12"
},
"denoDependencies": {
"util": "std@0.148.0/node/util.ts"
"util": "std@0.161.0/node/util.ts"
}
}
// Copyright 2017-2022 @polkadot/x-textencoder authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = {

@@ -8,3 +10,3 @@ name: '@polkadot/x-textencoder',

type: 'esm',
version: '10.1.11'
version: '10.1.12'
};
// Copyright 2017-2022 @polkadot/x-textencoder authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { TextEncoder, packageInfo } from "./browser.js";
// Copyright 2017-2022 @polkadot/x-textencoder authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { exposeGlobal } from '@polkadot/x-global';
import { TextEncoder } from '@polkadot/x-textencoder';
exposeGlobal('TextEncoder', TextEncoder);
// Copyright 2017-2022 @polkadot/x-textencoder authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { TextEncoder as BrowserTE } from "./browser.js";

@@ -4,0 +5,0 @@ import { TextEncoder as NodeTE } from "./node.js";

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