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

extra-compatible

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extra-compatible - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

3

lib/sha256.browser.d.ts

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

export declare function sha256(text: string): Promise<string>;
import { TypedArray } from '@blackglory/prelude';
export declare function sha256(input: string | DataView | TypedArray): Promise<string>;

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

const buffer_to_hex_1 = require("./utils/buffer-to-hex");
async function sha256(text) {
const encoder = new TextEncoder();
const buffer = encoder.encode(text);
const hashBuffer = await crypto.subtle.digest('SHA-256', buffer);
const prelude_1 = require("@blackglory/prelude");
async function sha256(input) {
const hashBuffer = await crypto.subtle.digest('SHA-256', toArrayBufferView(input));
return (0, buffer_to_hex_1.bufferToHex)(hashBuffer);
}
exports.sha256 = sha256;
function toArrayBufferView(input) {
if ((0, prelude_1.isString)(input)) {
const encoder = new TextEncoder();
return encoder.encode(input);
}
else if (input instanceof DataView) {
return input;
}
else {
return new DataView(input);
}
}
//# sourceMappingURL=sha256.browser.js.map

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

export declare function sha256(text: string): Promise<string>;
import { TypedArray } from '@blackglory/prelude';
export declare function sha256(input: string | DataView | TypedArray): Promise<string>;

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

const crypto = require("crypto");
async function sha256(text) {
async function sha256(input) {
return crypto.createHash('sha256')
.update(text)
.update(input)
.digest('hex');

@@ -10,0 +10,0 @@ }

{
"name": "extra-compatible",
"version": "0.1.3",
"version": "0.1.4",
"description": "",

@@ -38,3 +38,2 @@ "keywords": [],

"devDependencies": {
"@blackglory/prelude": "^0.1.7",
"@commitlint/cli": "^17.2.0",

@@ -57,3 +56,6 @@ "@commitlint/config-conventional": "^17.2.0",

},
"dependencies": {}
"dependencies": {
"@blackglory/prelude": "^0.1.7",
"iterable-operator": "^2.1.0"
}
}

@@ -22,3 +22,3 @@ # extra-compatible

```ts
function sha256(text: string): Promise<string>
function sha256(input: string | DataView | TypedArray): Promise<string>
```

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