From ad518cb34f0ef3f8dc9f52147857aa819163cd91 Mon Sep 17 00:00:00 2001 From: Danil Date: Thu, 19 May 2022 17:08:48 +0300 Subject: [PATCH 1/8] minor es6 fixes --- murmurhash.js | 12 ++++++------ package.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/murmurhash.js b/murmurhash.js index 6a73210..1705d2e 100644 --- a/murmurhash.js +++ b/murmurhash.js @@ -1,5 +1,5 @@ (function(){ - var _global = this; + const _global = this; const createBuffer = (val) => new TextEncoder().encode(val) @@ -17,7 +17,7 @@ */ function MurmurHashV2(str, seed) { if (typeof str === 'string') str = createBuffer(str); - var + let l = str.length, h = seed ^ l, i = 0, @@ -54,7 +54,7 @@ return h >>> 0; }; - /** + /* * JS Implementation of MurmurHash3 (r136) (as of May 20, 2011) * * @author Gary Court @@ -69,7 +69,7 @@ function MurmurHashV3(key, seed) { if (typeof key === 'string') key = createBuffer(key); - var remainder, bytes, h1, h1b, c1, c1b, c2, c2b, k1, i; + let remainder, bytes, h1, h1b, c1, c1b, c2, c2b, k1, i; remainder = key.length & 3; // key.length % 4 bytes = key.length - remainder; @@ -120,14 +120,14 @@ return h1 >>> 0; } - var murmur = MurmurHashV3; + const murmur = MurmurHashV3; murmur.v2 = MurmurHashV2; murmur.v3 = MurmurHashV3; if (typeof(module) != 'undefined') { module.exports = murmur; } else { - var _previousRoot = _global.murmur; + const _previousRoot = _global.murmur; murmur.noConflict = function() { _global.murmur = _previousRoot; return murmur; diff --git a/package.json b/package.json index abcff74..2ad0eff 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name" : "murmurhash", "version" : "1.0.0", "description" : "A Node.js module for the optimized JavaScript implementation of the MurmurHash algorithms.", - "author": { + "authors": { "Gary Court": "gary.court@gmail.com", "Derek Perez": "derek@derekperez.com" }, From 52433e5719b555e0ba1612584b02543059f34397 Mon Sep 17 00:00:00 2001 From: Danil Date: Thu, 19 May 2022 17:15:20 +0300 Subject: [PATCH 2/8] node js test yml, add github actions and tests if u want to --- .github/node.js.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .github/node.js.yml diff --git a/.github/node.js.yml b/.github/node.js.yml new file mode 100644 index 0000000..e69de29 From 756e15ee428f8ca5961320d2d8de129fc9a29633 Mon Sep 17 00:00:00 2001 From: Danil Date: Fri, 9 Feb 2024 18:54:40 +0200 Subject: [PATCH 3/8] added ci/cd and reconfigured test file + mode node version testin --- .github/node.js.yml | 31 +++++++++++++++++++++++++++++++ README.md | 5 +++++ test.js | 2 +- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/.github/node.js.yml b/.github/node.js.yml index e69de29..5f6c339 100644 --- a/.github/node.js.yml +++ b/.github/node.js.yml @@ -0,0 +1,31 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Node.js CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x, 14.x, 16.x, 18.x, 20.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: node ./test.js + # - run: npm run build --if-present + # - run: npm run test \ No newline at end of file diff --git a/README.md b/README.md index 80fc346..3997c75 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,11 @@ npm install murmurhash ```js murmurhash = require('murmurhash') ``` +or + +```js +import murmurhash from 'murmurhash' +``` Both version 2 and 3 of the MurmurHash algorithm are supported: diff --git a/test.js b/test.js index bda6baf..e4672fb 100644 --- a/test.js +++ b/test.js @@ -10,4 +10,4 @@ if ( fromStr !== 3017643002 ) { throw new Error(`Wrong output`); -} +} else console.dir('Test ended with cought 0 errors'); From 577b17171740b68b809e24605eddb3f7647c925b Mon Sep 17 00:00:00 2001 From: Danil Dynikov Date: Fri, 9 Feb 2024 18:56:27 +0200 Subject: [PATCH 4/8] Create node.js.yml --- .github/workflows/node.js.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..f054280 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,31 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Node.js CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x, 14.x, 16.x, 18.x, 20.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: node ./test.js + # - run: npm run build --if-present + # - run: npm run test From 834b097be1ac9bdb47b7d410887024ecf6879939 Mon Sep 17 00:00:00 2001 From: Danil Date: Fri, 9 Feb 2024 18:57:15 +0200 Subject: [PATCH 5/8] README upd --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3997c75..f15b9ee 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,12 @@ npm install murmurhash ``` ```js -murmurhash = require('murmurhash') +const murmurhash = require('murmurhash'); ``` or ```js -import murmurhash from 'murmurhash' +import murmurhash from 'murmurhash'; ``` Both version 2 and 3 of the MurmurHash algorithm are supported: From 9c8544d80788639a2d3e8ef760ecb0b25e7afdf5 Mon Sep 17 00:00:00 2001 From: Danil Dynikov Date: Fri, 9 Feb 2024 18:58:29 +0200 Subject: [PATCH 6/8] Update node.js.yml --- .github/workflows/node.js.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index f054280..2b71472 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -1,13 +1,14 @@ # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs name: Node.js CI on: push: - branches: [ main ] + branches: [ "master" ] pull_request: - branches: [ main ] + branches: [ "master" ] + jobs: build: @@ -19,13 +20,12 @@ jobs: # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} cache: 'npm' - run: npm ci + - run: npm run build --if-present - run: node ./test.js - # - run: npm run build --if-present - # - run: npm run test From 9f95255734ead8ce842009cd06b6e31ba0692831 Mon Sep 17 00:00:00 2001 From: Danil Date: Fri, 9 Feb 2024 18:59:46 +0200 Subject: [PATCH 7/8] fixing ci problem --- package-lock.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..2b41109 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "murmurhash", + "version": "2.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "murmurhash", + "version": "2.0.1", + "license": "MIT" + } + } +} From aa66475e8cb1111c4a70af73ff94a1830d860a6d Mon Sep 17 00:00:00 2001 From: Danil Date: Fri, 9 Feb 2024 19:01:36 +0200 Subject: [PATCH 8/8] finally fixing cd\cd --- .github/workflows/node.js.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 2b71472..aa13ca9 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: - node-version: [12.x, 14.x, 16.x, 18.x, 20.x] + node-version: [14.x, 16.x, 18.x, 20.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: