Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring / Cleaning. #414

Merged
merged 7 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module.exports = {
es6: true,
node: true
},
parser: "babel-eslint",
rules: {
// These rules assume eslint recommended, if the rules is accepted from
// eslint:recommended settings it is commented out and noted to the right of
Expand Down
1 change: 1 addition & 0 deletions cypressWebpack/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module.exports = (on, config) => {
resolve: {
fallback: {
"fs": false,
"process/browser": require.resolve("process/browser")
},
}
}
Expand Down
181 changes: 129 additions & 52 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,9 @@
},
"homepage": "https://github.com/cassproject/cass-npm#readme",
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.4",
"@cypress/browserify-preprocessor": "^3.0.2",
"@cypress/vite-dev-server": "^5.2.0",
"@cypress/webpack-preprocessor": "^6.0.2",
"babel-eslint": "^10.1.0",
"babel-plugin-transform-remove-strict-mode": "^0.0.2",
"chai": "4.5.0",
"concurrently": "^9.0.1",
"convert-hrtime": "^5.0.0",
Expand All @@ -166,10 +162,10 @@
"node-polyfill-webpack-plugin": "^4.0.0",
"nodemon": "^3.1.7",
"nyc": "^17.1.0",
"sinon": "^19.0.2",
"url-polyfill": "^1.1.12",
"wait-on": "^8.0.1",
"webpack": "^5.94.0",
"webpack-cli": "^5.1.4",
"wtfnode": "^0.9.3"
"webpack-cli": "^5.1.4"
}
}
27 changes: 10 additions & 17 deletions src/com/eduworks/ec/array/EcArray.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,17 @@ module.exports = class EcArray {
* @memberOf EcArray
*/
static has = function (a, o) {
if (a.includes(o))
return true;
if (EcObject.isObject(o))
for (let i = 0; i < a.length; i++) {
if (a[i] === o) return true;
for (let b of a) {
try {
if (a[i].equals(o)) return true;
if (b.equals != null)
if (b.equals(o)) return true;
} catch (e) {
// eat quietly
}
}
else
for (let i = 0; i < a.length; i++) {
if (a[i] === o) {
return true;
}
}
return false;
};
/**
Expand All @@ -97,21 +93,18 @@ module.exports = class EcArray {
* @memberOf EcArray
*/
static indexOf = function (a, o) {
let index = a.indexOf(o);
if (index != -1)
return index;
if (EcObject.isObject(o))
for (let i = 0; i < a.length; i++) {
if (a[i] === o) return i;
try {
if (a[i].equals(o)) return i;
if (a[i].equals != null)
if (a[i].equals(o)) return i;
} catch (e) {
// eat quietly
}
}
else
for (let i = 0; i < a.length; i++) {
if (a[i] === o) {
return i;
}
}
return -1;
};
};
2 changes: 1 addition & 1 deletion src/com/eduworks/ec/crypto/EcAes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let forge = require("node-forge");
const forge = require("node-forge");
/**
* AES encryption tasks common across all variants of AES.
* @class EcAes
Expand Down
8 changes: 4 additions & 4 deletions src/com/eduworks/ec/crypto/EcAesCtr.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let forge = require("node-forge");
let EcCrypto = require("./EcCrypto.js");
const forge = require("node-forge");
const EcCrypto = require("./EcCrypto.js");
/**
* Encrypts data synchronously using AES-256-CTR. Requires secret and iv to be 32 bytes.
* Output is encoded in base64 for easier handling.
Expand All @@ -23,7 +23,7 @@ module.exports = class EcAesCtr {
* @deprecated For backup use only. Instead, use await on EcAesCtrAsync.
*/
static encrypt(plaintext, secret, iv) {
if (EcCrypto.deprecationNotice == false)
if (!EcCrypto.deprecationNotice)
console.trace(
"This method is deprecated. Please use await on EcAesCtrAsync."
);
Expand Down Expand Up @@ -58,7 +58,7 @@ module.exports = class EcAesCtr {
* @deprecated For backup use only. Instead, use await on EcAesCtrAsync.
*/
static decrypt(ciphertext, secret, iv) {
if (EcCrypto.deprecationNotice == false)
if (!EcCrypto.deprecationNotice)
console.trace(
"This method is deprecated. Please use await on EcAesCtrAsync."
);
Expand Down
Loading