Skip to content

Commit cbe7e0c

Browse files
committed
Comply with ESM syntax.
1 parent 5a290c3 commit cbe7e0c

16 files changed

+50
-62
lines changed

Conversions/DateDayDifference.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ const DateDayDifference = (date1, date2) => {
3838

3939
// Example : DateDayDifference('17/08/2002', '10/10/2020') => 6630
4040

41-
module.exports = DateDayDifference
41+
export { DateDayDifference }

Conversions/DateToDay.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ const DateToDay = (date) => {
6161

6262
// Example : DateToDay("18/12/2020") => Friday
6363

64-
module.exports = DateToDay
64+
export { DateToDay }

Conversions/LowerCaseConversion.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ const LowerCaseConversion = (inputString) => {
3232
return newString.join('')
3333
}
3434

35-
module.exports = LowerCaseConversion
35+
export { LowerCaseConversion }

Conversions/RailwayTimeConversion.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ const RailwayTimeConversion = (timeString) => {
3232
}
3333
}
3434

35-
module.exports = RailwayTimeConversion
35+
export { RailwayTimeConversion }

Data-Structures/Tree/AVLTree.js

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -234,39 +234,39 @@ const AVLTree = (function () {
234234
/**
235235
* A Code for Testing the AVLTree
236236
*/
237-
(function test () {
238-
const newAVL = new AVLTree()
239-
const size = Math.floor(Math.random() * 1000000)
240-
let uniques = 0
241-
let i, temp, j
242-
const array = []
243-
for (i = 0; i < size; i++) {
244-
temp = Math.floor(Math.random() * Number.MAX_VALUE)
245-
if (newAVL.add(temp)) {
246-
uniques++
247-
array.push(temp)
248-
}
249-
}
250-
if (newAVL.size !== uniques) {
251-
throw new Error('elements not inserted properly')
252-
}
253-
const findTestSize = Math.floor(Math.random() * uniques)
254-
for (i = 0; i < findTestSize; i++) {
255-
j = Math.floor(Math.random() * uniques)
256-
if (!newAVL.find(array[j])) {
257-
throw new Error('inserted elements not found')
258-
}
259-
}
260-
const deleteTestSize = Math.floor(uniques * Math.random())
261-
for (i = 0; i < deleteTestSize; i++) {
262-
j = Math.floor(Math.random() * uniques)
263-
temp = array[j]
264-
if (newAVL.find(temp)) {
265-
if (!newAVL.remove(temp)) {
266-
throw new Error('delete not working properly')
267-
}
268-
}
269-
}
270-
})()
237+
// (function test () {
238+
// const newAVL = new AVLTree()
239+
// const size = Math.floor(Math.random() * 1000000)
240+
// let uniques = 0
241+
// let i, temp, j
242+
// const array = []
243+
// for (i = 0; i < size; i++) {
244+
// temp = Math.floor(Math.random() * Number.MAX_VALUE)
245+
// if (newAVL.add(temp)) {
246+
// uniques++
247+
// array.push(temp)
248+
// }
249+
// }
250+
// if (newAVL.size !== uniques) {
251+
// throw new Error('elements not inserted properly')
252+
// }
253+
// const findTestSize = Math.floor(Math.random() * uniques)
254+
// for (i = 0; i < findTestSize; i++) {
255+
// j = Math.floor(Math.random() * uniques)
256+
// if (!newAVL.find(array[j])) {
257+
// throw new Error('inserted elements not found')
258+
// }
259+
// }
260+
// const deleteTestSize = Math.floor(uniques * Math.random())
261+
// for (i = 0; i < deleteTestSize; i++) {
262+
// j = Math.floor(Math.random() * uniques)
263+
// temp = array[j]
264+
// if (newAVL.find(temp)) {
265+
// if (!newAVL.remove(temp)) {
266+
// throw new Error('delete not working properly')
267+
// }
268+
// }
269+
// }
270+
// })()
271271

272-
module.exports = AVLTree
272+
export { AVLTree }

Hashes/SHA1.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,5 @@ function SHA1 (message) {
170170
return HH
171171
}
172172

173-
console.log(SHA1('A Test'))
174-
console.log(SHA1('A Test'))
175-
176173
// export SHA1 function
177-
module.exports = SHA1
174+
export { SHA1 }

Hashes/SHA256.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,4 @@ function SHA256 (message) {
185185
}
186186

187187
// export SHA256 function
188-
module.exports = SHA256
188+
export { SHA256 }

Maths/CheckKishnamurthyNumber.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ const CheckKishnamurthyNumber = (number) => {
4141
return sumOfAllDigitFactorial === number
4242
}
4343

44-
module.exports = CheckKishnamurthyNumber
44+
export { CheckKishnamurthyNumber }

Maths/CoPrimeCheck.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ const CoPrimeCheck = (firstNumber, secondNumber) => {
3737
return GetEuclidGCD(firstNumber, secondNumber) === 1
3838
}
3939

40-
module.exports = CoPrimeCheck
40+
export { CoPrimeCheck }

Maths/GetEuclidGCD.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ const GetEuclidGCD = (arg1, arg2) => {
2929
return (less)
3030
}
3131

32-
module.exports = GetEuclidGCD
32+
export { GetEuclidGCD }

0 commit comments

Comments
 (0)