Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sindresorhus/hasha
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.1.0
Choose a base ref
...
head repository: sindresorhus/hasha
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.2.0
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Feb 16, 2020

  1. Verified

    This commit was signed with the committer’s verified signature.
    ssbarnea Sorin Sbarnea
    Copy the full SHA
    9774aaa View commit details
  2. 5.2.0

    sindresorhus committed Feb 16, 2020

    Verified

    This commit was signed with the committer’s verified signature.
    ssbarnea Sorin Sbarnea
    Copy the full SHA
    c93f823 View commit details
Showing with 5 additions and 7 deletions.
  1. +4 −6 index.js
  2. +1 −1 package.json
10 changes: 4 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -4,15 +4,13 @@ const path = require('path');
const crypto = require('crypto');
const isStream = require('is-stream');

const requireOptional = (name, defaultValue) => {
const {Worker} = (() => {
try {
return require(name);
return require('worker_threads');
} catch (_) {
return defaultValue;
return {};
}
};

const {Worker} = requireOptional('worker_threads', {});
})();

let worker; // Lazy
let taskIdCounter = 0;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hasha",
"version": "5.1.0",
"version": "5.2.0",
"description": "Hashing made simple. Get the hash of a buffer/string/stream/file.",
"license": "MIT",
"repository": "sindresorhus/hasha",