From 0c427580f160323201d492bd7422a4b073cb1f2e Mon Sep 17 00:00:00 2001 From: lionel-rowe Date: Thu, 23 Feb 2023 22:34:47 +0800 Subject: [PATCH 001/122] Make ArbitraryBase Unicode-aware (#1299) * Make ArbitraryBase Unicode-aware https://mathiasbynens.be/notes/javascript-unicode#counting-symbols * Fix performance bug and add Unicode test * Add BigInt version and push output chars to array --- Conversions/ArbitraryBase.js | 87 ++++++++++++++++++++------ Conversions/test/ArbitraryBase.test.js | 22 ++++++- 2 files changed, 89 insertions(+), 20 deletions(-) diff --git a/Conversions/ArbitraryBase.js b/Conversions/ArbitraryBase.js index 99e6c1bd57..33c88d5c1b 100644 --- a/Conversions/ArbitraryBase.js +++ b/Conversions/ArbitraryBase.js @@ -1,20 +1,36 @@ /** -* Converts a string from one base to other +* Divide two numbers and get the result of floor division and remainder +* @param {number} dividend +* @param {number} divisor +* @returns {[result: number, remainder: number]} +*/ +const floorDiv = (dividend, divisor) => { + const remainder = dividend % divisor + const result = Math.floor(dividend / divisor) + + return [result, remainder] +} + +/** +* Converts a string from one base to other. Loses accuracy above the value of `Number.MAX_SAFE_INTEGER`. * @param {string} stringInBaseOne String in input base * @param {string} baseOneCharacters Character set for the input base * @param {string} baseTwoCharacters Character set for the output base * @returns {string} */ -const convertArbitraryBase = (stringInBaseOne, baseOneCharacters, baseTwoCharacters) => { - if ([stringInBaseOne, baseOneCharacters, baseTwoCharacters].map(arg => typeof arg).some(type => type !== 'string')) { +const convertArbitraryBase = (stringInBaseOne, baseOneCharacterString, baseTwoCharacterString) => { + if ([stringInBaseOne, baseOneCharacterString, baseTwoCharacterString].map(arg => typeof arg).some(type => type !== 'string')) { throw new TypeError('Only string arguments are allowed') } - [baseOneCharacters, baseTwoCharacters].forEach(baseString => { - const charactersInBase = [...baseString] + + const baseOneCharacters = [...baseOneCharacterString] + const baseTwoCharacters = [...baseTwoCharacterString] + + for (const charactersInBase of [baseOneCharacters, baseTwoCharacters]) { if (charactersInBase.length !== new Set(charactersInBase).size) { throw new TypeError('Duplicate characters in character set are not allowed') } - }) + } const reversedStringOneChars = [...stringInBaseOne].reverse() const stringOneBase = baseOneCharacters.length let value = 0 @@ -27,24 +43,57 @@ const convertArbitraryBase = (stringInBaseOne, baseOneCharacters, baseTwoCharact value += (digitNumber * placeValue) placeValue *= stringOneBase } - let stringInBaseTwo = '' + const outputChars = [] const stringTwoBase = baseTwoCharacters.length while (value > 0) { - const remainder = value % stringTwoBase - stringInBaseTwo = baseTwoCharacters.charAt(remainder) + stringInBaseTwo - value /= stringTwoBase + const [divisionResult, remainder] = floorDiv(value, stringTwoBase) + outputChars.push(baseTwoCharacters[remainder]) + value = divisionResult } - const baseTwoZero = baseTwoCharacters.charAt(0) - return stringInBaseTwo.replace(new RegExp(`^${baseTwoZero}+`), '') + return outputChars.reverse().join('') || baseTwoCharacters[0] } -export { convertArbitraryBase } +/** +* Converts a arbitrary-length string from one base to other. Doesn't lose accuracy. +* @param {string} stringInBaseOne String in input base +* @param {string} baseOneCharacters Character set for the input base +* @param {string} baseTwoCharacters Character set for the output base +* @returns {string} +*/ +const convertArbitraryBaseBigIntVersion = (stringInBaseOne, baseOneCharacterString, baseTwoCharacterString) => { + if ([stringInBaseOne, baseOneCharacterString, baseTwoCharacterString].map(arg => typeof arg).some(type => type !== 'string')) { + throw new TypeError('Only string arguments are allowed') + } -// > convertArbitraryBase('98', '0123456789', '01234567') -// '142' + const baseOneCharacters = [...baseOneCharacterString] + const baseTwoCharacters = [...baseTwoCharacterString] -// > convertArbitraryBase('98', '0123456789', 'abcdefgh') -// 'bec' + for (const charactersInBase of [baseOneCharacters, baseTwoCharacters]) { + if (charactersInBase.length !== new Set(charactersInBase).size) { + throw new TypeError('Duplicate characters in character set are not allowed') + } + } + const reversedStringOneChars = [...stringInBaseOne].reverse() + const stringOneBase = BigInt(baseOneCharacters.length) + let value = 0n + let placeValue = 1n + for (const digit of reversedStringOneChars) { + const digitNumber = BigInt(baseOneCharacters.indexOf(digit)) + if (digitNumber === -1n) { + throw new TypeError(`Not a valid character: ${digit}`) + } + value += (digitNumber * placeValue) + placeValue *= stringOneBase + } + const outputChars = [] + const stringTwoBase = BigInt(baseTwoCharacters.length) + while (value > 0n) { + const divisionResult = value / stringTwoBase + const remainder = value % stringTwoBase + outputChars.push(baseTwoCharacters[remainder]) + value = divisionResult + } + return outputChars.reverse().join('') || baseTwoCharacters[0] +} -// > convertArbitraryBase('129', '0123456789', '01234567') -// '201' +export { convertArbitraryBase, convertArbitraryBaseBigIntVersion } diff --git a/Conversions/test/ArbitraryBase.test.js b/Conversions/test/ArbitraryBase.test.js index e552a6fc6a..c6e835eb5a 100644 --- a/Conversions/test/ArbitraryBase.test.js +++ b/Conversions/test/ArbitraryBase.test.js @@ -1,4 +1,4 @@ -import { convertArbitraryBase } from '../ArbitraryBase' +import { convertArbitraryBase, convertArbitraryBaseBigIntVersion } from '../ArbitraryBase' test('Check the answer of convertArbitraryBase(98, 0123456789, 01234567) is 142', () => { const res = convertArbitraryBase('98', '0123456789', '01234567') @@ -34,3 +34,23 @@ test('Check the answer of convertArbitraryBase(111, 0123456789, abcdefgh) is bfh const res = convertArbitraryBase('111', '0123456789', 'abcdefgh') expect(res).toBe('bfh') }) + +test('Unicode awareness', () => { + const res = convertArbitraryBase('98', '0123456789', '💝🎸🦄') + expect(res).toBe('🎸💝🎸🦄🦄') +}) + +test('zero', () => { + const res = convertArbitraryBase('0', '0123456789', 'abc') + expect(res).toBe('a') +}) + +test('BigInt version with input string of arbitrary length', () => { + const resBigIntVersion = convertArbitraryBaseBigIntVersion( + String(10n ** 100n), + '0123456789', + '0123456789abcdefghijklmnopqrstuvwxyz' + ) + + expect(resBigIntVersion).toBe((10n ** 100n).toString(36)) +}) From 566d9103cd84cee37e8339a407eeadfc15a13481 Mon Sep 17 00:00:00 2001 From: paulinegarelli <74154787+paulinegarelli@users.noreply.github.com> Date: Thu, 23 Feb 2023 15:35:45 +0100 Subject: [PATCH 002/122] fix: refactor PrimMST and fix bug in PriorityQueue (#1300) * ref: KeyPriorityQueue in separate file #1298 * feat: add tests for KeyPriorityQueue #1298 * fix: _shiftDown refactored and corrected #1298 * fix: use KeyPriorityQueue in PrimMST #1298 * feat: add test for PrimMST #1298 * fix: format files #1298 * fix: minor coding style changes * fix: use map for keys and priorities #1298 --- Data-Structures/Heap/KeyPriorityQueue.js | 153 +++++++++++++++++ .../Heap/test/KeyPriorityQueue.test.js | 126 ++++++++++++++ Graphs/PrimMST.js | 156 +----------------- Graphs/test/PrimMST.test.js | 20 +++ 4 files changed, 301 insertions(+), 154 deletions(-) create mode 100644 Data-Structures/Heap/KeyPriorityQueue.js create mode 100644 Data-Structures/Heap/test/KeyPriorityQueue.test.js create mode 100644 Graphs/test/PrimMST.test.js diff --git a/Data-Structures/Heap/KeyPriorityQueue.js b/Data-Structures/Heap/KeyPriorityQueue.js new file mode 100644 index 0000000000..e7bbede45e --- /dev/null +++ b/Data-Structures/Heap/KeyPriorityQueue.js @@ -0,0 +1,153 @@ +/** + * KeyPriorityQueue is a priority queue based on a Minimum Binary Heap. + * + * Minimum Binary Heaps are binary trees which are filled level by level + * and then from left to right inside a depth level. + * Their main property is that any parent node has a smaller or equal priority to all of its children, + * hence the root of the tree always has the smallest priority of all nodes. + * + * This implementation of the Minimum Binary Heap allows for nodes to be associated to both a key, + * which can be any datatype, and a priority. + * + * The heap is represented by an array with nodes ordered + * from root-to-leaf, left-to-right. + * Therefore, the parent-child node relationship is such that + * * the children nodes positions relative to their parent are: (parentPos * 2 + 1) and (parentPos * 2 + 2) + * * the parent node position relative to either of its children is: Math.floor((childPos - 1) / 2) + * + * More information and visuals on Binary Heaps can be found here: https://www.geeksforgeeks.org/binary-heap/ + */ + +// Priority Queue Helper functions +const getParentPosition = position => Math.floor((position - 1) / 2) +const getChildrenPositions = position => [2 * position + 1, 2 * position + 2] + +class KeyPriorityQueue { + // Priority Queue class using Minimum Binary Heap + constructor () { + this._heap = [] + this.priorities = new Map() + } + + /** + * Checks if the heap is empty + * @returns boolean + */ + isEmpty () { + return this._heap.length === 0 + } + + /** + * Adds an element to the queue + * @param {*} key + * @param {number} priority + */ + push (key, priority) { + this._heap.push(key) + this.priorities.set(key, priority) + this._shiftUp(this._heap.length - 1) + } + + /** + * Removes the element with least priority + * @returns the key of the element with least priority + */ + pop () { + this._swap(0, this._heap.length - 1) + const key = this._heap.pop() + this.priorities.delete(key) + this._shiftDown(0) + return key + } + + /** + * Checks whether a given key is present in the queue + * @param {*} key + * @returns boolean + */ + contains (key) { + return this.priorities.has(key) + } + + /** + * Updates the priority of the given element. + * Adds the element if it is not in the queue. + * @param {*} key the element to change + * @param {number} priority new priority of the element + */ + update (key, priority) { + const currPos = this._heap.indexOf(key) + // if the key does not exist yet, add it + if (currPos === -1) return this.push(key, priority) + // else update priority + this.priorities.set(key, priority) + const parentPos = getParentPosition(currPos) + const currPriority = this._getPriorityOrInfinite(currPos) + const parentPriority = this._getPriorityOrInfinite(parentPos) + const [child1Pos, child2Pos] = getChildrenPositions(currPos) + const child1Priority = this._getPriorityOrInfinite(child1Pos) + const child2Priority = this._getPriorityOrInfinite(child2Pos) + + if (parentPos >= 0 && parentPriority > currPriority) { + this._shiftUp(currPos) + } else if (child1Priority < currPriority || child2Priority < currPriority) { + this._shiftDown(currPos) + } + } + + _getPriorityOrInfinite (position) { + // Helper function, returns priority of the node, or Infinite if no node corresponds to this position + if (position >= 0 && position < this._heap.length) return this.priorities.get(this._heap[position]) + else return Infinity + } + + _shiftUp (position) { + // Helper function to shift up a node to proper position (equivalent to bubbleUp) + let currPos = position + let parentPos = getParentPosition(currPos) + let currPriority = this._getPriorityOrInfinite(currPos) + let parentPriority = this._getPriorityOrInfinite(parentPos) + + while (parentPos >= 0 && parentPriority > currPriority) { + this._swap(currPos, parentPos) + currPos = parentPos + parentPos = getParentPosition(currPos) + currPriority = this._getPriorityOrInfinite(currPos) + parentPriority = this._getPriorityOrInfinite(parentPos) + } + } + + _shiftDown (position) { + // Helper function to shift down a node to proper position (equivalent to bubbleDown) + let currPos = position + let [child1Pos, child2Pos] = getChildrenPositions(currPos) + let child1Priority = this._getPriorityOrInfinite(child1Pos) + let child2Priority = this._getPriorityOrInfinite(child2Pos) + let currPriority = this._getPriorityOrInfinite(currPos) + + if (currPriority === Infinity) { + return + } + + while (child1Priority < currPriority || child2Priority < currPriority) { + if (child1Priority < currPriority && child1Priority < child2Priority) { + this._swap(child1Pos, currPos) + currPos = child1Pos + } else { + this._swap(child2Pos, currPos) + currPos = child2Pos + } + [child1Pos, child2Pos] = getChildrenPositions(currPos) + child1Priority = this._getPriorityOrInfinite(child1Pos) + child2Priority = this._getPriorityOrInfinite(child2Pos) + currPriority = this._getPriorityOrInfinite(currPos) + } + } + + _swap (position1, position2) { + // Helper function to swap 2 nodes + [this._heap[position1], this._heap[position2]] = [this._heap[position2], this._heap[position1]] + } +} + +export { KeyPriorityQueue } diff --git a/Data-Structures/Heap/test/KeyPriorityQueue.test.js b/Data-Structures/Heap/test/KeyPriorityQueue.test.js new file mode 100644 index 0000000000..b9e9ea6202 --- /dev/null +++ b/Data-Structures/Heap/test/KeyPriorityQueue.test.js @@ -0,0 +1,126 @@ +import { KeyPriorityQueue } from '../KeyPriorityQueue.js' + +describe('Key Priority Queue', () => { + describe('Method isEmpty', () => { + test('Check heap is empty', () => { + const queue = new KeyPriorityQueue() + const res = queue.isEmpty() + expect(res).toEqual(true) + }) + + test('Check heap is not empty', () => { + const queue = new KeyPriorityQueue() + queue.push(0, 2) + const res = queue.isEmpty() + expect(res).toEqual(false) + }) + }) + + describe('Methods push and pop', () => { + test('Test Case 1', () => { + // create queue + const queue = new KeyPriorityQueue() + queue.push(0, 3) + queue.push(1, 7) + queue.push(2, 9) + queue.push(3, 13) + // create expected queue + const expectedQueue = new KeyPriorityQueue() + expectedQueue.push(1, 7) + expectedQueue.push(3, 13) + expectedQueue.push(2, 9) + // result from popping element from the queue + queue.pop() + expect(queue).toEqual(expectedQueue) + }) + + test('Test Case 2', () => { + // create queue + const queue = new KeyPriorityQueue() + queue.push(0, 3) + queue.push(1, 9) + queue.push(2, 7) + queue.push(3, 13) + // create expected queue + const expectedQueue = new KeyPriorityQueue() + expectedQueue.push(2, 7) + expectedQueue.push(1, 9) + expectedQueue.push(3, 13) + // result from popping element from the queue + queue.pop() + expect(queue).toEqual(expectedQueue) + }) + + test('Test Case 3', () => { + // create queue + const queue = new KeyPriorityQueue() + queue.push(0, 3) + queue.push(1, 7) + queue.push(2, 9) + queue.push(3, 12) + queue.push(4, 13) + // create expected queue + const expectedQueue = new KeyPriorityQueue() + expectedQueue.push(1, 7) + expectedQueue.push(3, 12) + expectedQueue.push(2, 9) + expectedQueue.push(4, 13) + // result from popping element from the queue + queue.pop() + expect(queue).toEqual(expectedQueue) + }) + }) + + describe('Method contains', () => { + test('Check heap does not contain element', () => { + const queue = new KeyPriorityQueue() + const res = queue.contains(0) + expect(res).toEqual(false) + }) + + test('Check heap contains element', () => { + const queue = new KeyPriorityQueue() + queue.push(0, 2) + const res = queue.contains(0) + expect(res).toEqual(true) + }) + }) + + describe('Method update', () => { + test('Update without change in position', () => { + // create queue + const queue = new KeyPriorityQueue() + queue.push(0, 3) + queue.push(1, 5) + queue.push(2, 7) + queue.push(3, 11) + // create expected queue + const expectedQueue = new KeyPriorityQueue() + expectedQueue.push(0, 2) + expectedQueue.push(1, 5) + expectedQueue.push(2, 7) + expectedQueue.push(3, 11) + // result from updating to similar priority + queue.update(0, 2) + expect(queue).toEqual(expectedQueue) + }) + + test('Update with change in position', () => { + // create queue + const queue = new KeyPriorityQueue() + queue.push(0, 3) + queue.push(1, 5) + queue.push(2, 7) + queue.push(3, 11) + // create expected queue + const expectedQueue = new KeyPriorityQueue() + expectedQueue.push(1, 5) + expectedQueue.push(3, 11) + expectedQueue.push(2, 7) + expectedQueue.push(0, 9) + // result from updating to similar priority + queue.update(0, 9) + expect(queue).toEqual(expectedQueue) + }) + }) +}) diff --git a/Graphs/PrimMST.js b/Graphs/PrimMST.js index 17d68efb90..c658845874 100644 --- a/Graphs/PrimMST.js +++ b/Graphs/PrimMST.js @@ -1,148 +1,4 @@ -// Priority Queue Helper functions -function getParentPosition (position) { - // Get the parent node of the current node - return Math.floor((position - 1) / 2) -} -function getChildrenPosition (position) { - // Get the children nodes of the current node - return [2 * position + 1, 2 * position + 2] -} - -class PriorityQueue { - // Priority Queue class using Minimum Binary Heap - constructor () { - this._heap = [] - this.keys = {} - } - - isEmpty () { - // Checking if the heap is empty - return this._heap.length === 0 - } - - push (key, priority) { - // Adding element to the queue (equivalent to add) - this._heap.push([key, priority]) - this.keys[key] = this._heap.length - 1 - this._shiftUp(this.keys[key]) - } - - pop () { - // Removing the element with least priority (equivalent to extractMin) - this._swap(0, this._heap.length - 1) - const [key] = this._heap.pop() - delete this.keys[key] - this._shiftDown(0) - return key - } - - contains (key) { - // Check if a given key is present in the queue - return (key in this.keys) - } - - update (key, priority) { - // Update the priority of the given element (equivalent to decreaseKey) - const currPos = this.keys[key] - this._heap[currPos][1] = priority - const parentPos = getParentPosition(currPos) - const currPriority = this._heap[currPos][1] - let parentPriority = Infinity - if (parentPos >= 0) { - parentPriority = this._heap[parentPos][1] - } - const [child1Pos, child2Pos] = getChildrenPosition(currPos) - let [child1Priority, child2Priority] = [Infinity, Infinity] - if (child1Pos < this._heap.length) { - child1Priority = this._heap[child1Pos][1] - } - if (child2Pos < this._heap.length) { - child2Priority = this._heap[child2Pos][1] - } - - if (parentPos >= 0 && parentPriority > currPriority) { - this._shiftUp(currPos) - } else if (child2Pos < this._heap.length && - (child1Priority < currPriority || child2Priority < currPriority)) { - this._shiftDown(currPos) - } - } - - _shiftUp (position) { - // Helper function to shift up a node to proper position (equivalent to bubbleUp) - let currPos = position - let parentPos = getParentPosition(currPos) - let currPriority = this._heap[currPos][1] - let parentPriority = Infinity - if (parentPos >= 0) { - parentPriority = this._heap[parentPos][1] - } - - while (parentPos >= 0 && parentPriority > currPriority) { - this._swap(currPos, parentPos) - currPos = parentPos - parentPos = getParentPosition(currPos) - currPriority = this._heap[currPos][1] - try { - parentPriority = this._heap[parentPos][1] - } catch (error) { - parentPriority = Infinity - } - } - this.keys[this._heap[currPos][0]] = currPos - } - - _shiftDown (position) { - // Helper function to shift down a node to proper position (equivalent to bubbleDown) - let currPos = position - let [child1Pos, child2Pos] = getChildrenPosition(currPos) - let [child1Priority, child2Priority] = [Infinity, Infinity] - if (child1Pos < this._heap.length) { - child1Priority = this._heap[child1Pos][1] - } - if (child2Pos < this._heap.length) { - child2Priority = this._heap[child2Pos][1] - } - let currPriority - try { - currPriority = this._heap[currPos][1] - } catch { - return - } - - while (child2Pos < this._heap.length && - (child1Priority < currPriority || child2Priority < currPriority)) { - if (child1Priority < currPriority && child1Priority < child2Priority) { - this._swap(child1Pos, currPos) - currPos = child1Pos - } else { - this._swap(child2Pos, currPos) - currPos = child2Pos - } - [child1Pos, child2Pos] = getChildrenPosition(currPos) - try { - [child1Priority, child2Priority] = [this._heap[child1Pos][1], this._heap[child2Pos][1]] - } catch (error) { - [child1Priority, child2Priority] = [Infinity, Infinity] - } - - currPriority = this._heap[currPos][1] - } - this.keys[this._heap[currPos][0]] = currPos - if (child1Pos < this._heap.length && child1Priority < currPriority) { - this._swap(child1Pos, currPos) - this.keys[this._heap[child1Pos][0]] = child1Pos - } - } - - _swap (position1, position2) { - // Helper function to swap 2 nodes - [this._heap[position1], this._heap[position2]] = [this._heap[position2], this._heap[position1]] - this.keys[this._heap[position1][0]] = position1 - this.keys[this._heap[position2][0]] = position2 - } -} - +import { KeyPriorityQueue } from '../Data-Structures/Heap/KeyPriorityQueue' class GraphWeightedUndirectedAdjacencyList { // Weighted Undirected Graph class constructor () { @@ -167,7 +23,7 @@ class GraphWeightedUndirectedAdjacencyList { // Details: https://en.wikipedia.org/wiki/Prim%27s_algorithm const distance = {} const parent = {} - const priorityQueue = new PriorityQueue() + const priorityQueue = new KeyPriorityQueue() // Initialization for (const node in this.connections) { distance[node] = (node === start.toString() ? 0 : Infinity) @@ -198,11 +54,3 @@ class GraphWeightedUndirectedAdjacencyList { } export { GraphWeightedUndirectedAdjacencyList } - -// const graph = new GraphWeightedUndirectedAdjacencyList() -// graph.addEdge(1, 2, 1) -// graph.addEdge(2, 3, 2) -// graph.addEdge(3, 4, 1) -// graph.addEdge(3, 5, 100) // Removed in MST -// graph.addEdge(4, 5, 5) -// graph.PrimMST(1) diff --git a/Graphs/test/PrimMST.test.js b/Graphs/test/PrimMST.test.js new file mode 100644 index 0000000000..82f3c033f1 --- /dev/null +++ b/Graphs/test/PrimMST.test.js @@ -0,0 +1,20 @@ +import { GraphWeightedUndirectedAdjacencyList } from '../PrimMST.js' + +test('Test Case PrimMST 1', () => { + // create graph to compute MST on + const graph = new GraphWeightedUndirectedAdjacencyList() + graph.addEdge(1, 2, 1) + graph.addEdge(2, 3, 2) + graph.addEdge(3, 4, 1) + graph.addEdge(3, 5, 100) // Removed in MST + graph.addEdge(4, 5, 5) + // create expected graph + const expectedGraph = new GraphWeightedUndirectedAdjacencyList() + expectedGraph.addEdge(1, 2, 1) + expectedGraph.addEdge(2, 3, 2) + expectedGraph.addEdge(3, 4, 1) + expectedGraph.addEdge(4, 5, 5) + // result from MST + const res = graph.PrimMST(1) + expect(res).toEqual(expectedGraph) +}) From fc06690672a726d08508f1980865c3a5f225e761 Mon Sep 17 00:00:00 2001 From: Ranganathan7 <51285736+Ranganathan7@users.noreply.github.com> Date: Thu, 2 Mar 2023 00:03:24 +0530 Subject: [PATCH 003/122] fixes: #1280 and test: added tests for DFS algorithm (#1303) * fix: fixed error in DepthFirstSearch algorithm and test: added tests for DepthFirstSearch algorithm. * changed traverseDFS function parameters in DepthFirstSearch.js file --- Trees/DepthFirstSearch.js | 35 ++++++++++------------ Trees/test/DepthFirstSearch.test.js | 46 +++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 19 deletions(-) create mode 100644 Trees/test/DepthFirstSearch.test.js diff --git a/Trees/DepthFirstSearch.js b/Trees/DepthFirstSearch.js index 0833d9d1de..4c0c43db41 100644 --- a/Trees/DepthFirstSearch.js +++ b/Trees/DepthFirstSearch.js @@ -4,35 +4,32 @@ * DFS Algorithm for traversing or searching graph data structures. */ -function traverseDFS (root) { - const stack = [root] +// traverses a give tree from specified root's value +function traverseDFS (tree, rootValue) { + const stack = [] const res = [] - + stack.push(searchDFS(tree, rootValue)) + // if root is not present in the tree, returning empty array + if (!stack[0]) return res while (stack.length) { const curr = stack.pop() - res.push(curr.key) - - if (curr.right) { - stack.push(curr.right) - } - + res.push(curr.value) if (curr.left) { - stack.push(curr.left) + stack.push(tree[curr.left]) + } + if (curr.right) { + stack.push(tree[curr.right]) } } - return res.reverse() } function searchDFS (tree, value) { const stack = [] - stack.push(tree[0]) - while (stack.length !== 0) { for (let i = 0; i < stack.length; i++) { const node = stack.pop() - if (node.value === value) { return node } @@ -59,11 +56,10 @@ const tree = [ { value: 10, left: null, right: null }, { value: 1, left: null, right: null } ] - -searchDFS(tree, 9) -searchDFS(tree, 10) - -traverseDFS(6) +searchDFS(tree, 9) // { value: 9, left: 7, right: 8 } +searchDFS(tree, 200) // null +traverseDFS(tree, 6) // [ 1, 2, 3, 4, 5, 8, 10, 9, 7, 6 ] +traverseDFS(tree, 200) // [] // 6 // / \ @@ -74,3 +70,4 @@ traverseDFS(6) // 2 8 10 // / // 1 +export { searchDFS, traverseDFS } diff --git a/Trees/test/DepthFirstSearch.test.js b/Trees/test/DepthFirstSearch.test.js new file mode 100644 index 0000000000..6c76fbb3d6 --- /dev/null +++ b/Trees/test/DepthFirstSearch.test.js @@ -0,0 +1,46 @@ +import { searchDFS, traverseDFS } from '../DepthFirstSearch' + +describe('Depth First Tree Traversal', () => { + const tree = [ + { value: 6, left: 1, right: 2 }, + { value: 5, left: 3, right: 4 }, + { value: 7, left: null, right: 5 }, + { value: 3, left: 6, right: null }, + { value: 4, left: null, right: null }, + { value: 9, left: 7, right: 8 }, + { value: 2, left: 9, right: null }, + { value: 8, left: null, right: null }, + { value: 10, left: null, right: null }, + { value: 1, left: null, right: null } + ] + + // 6 + // / \ + // 5 7 + // / \ \ + // 3 4 9 + // / / \ + // 2 8 10 + // / + // 1 + + it('should be null if given value is not present in the tree - DF Search', () => { + const res = searchDFS(tree, 200) + expect(res).toStrictEqual(null) + }) + + it('should return the node if given value is present in the tree - DF Search', () => { + const res = searchDFS(tree, 9) + expect(res).toStrictEqual({ value: 9, left: 7, right: 8 }) + }) + + it('should return empty array if given root is not present in the tree - DF Traversal', () => { + const traversal = traverseDFS(tree, 200) + expect(traversal).toStrictEqual([]) + }) + + it('should return DFT array of given tree from specified root if given root is present in the tree - DF Traversal', () => { + const traversal = traverseDFS(tree, 6) + expect(traversal).toStrictEqual([1, 2, 3, 4, 5, 8, 10, 9, 7, 6]) + }) +}) From 327e18f450c48dffddca34a446649edd2b11a083 Mon Sep 17 00:00:00 2001 From: Jacoby Johnson Date: Fri, 3 Mar 2023 23:07:51 -0600 Subject: [PATCH 004/122] Elementary cellular automata (#1302) * feat: Added Elementary Cellular Automata Algorithm w/ explanation, examples, and further reading * test: Added tests for Elementary Cellular Automata Algorithm * chore: add Wikipedia link to Elementary Cellular Automata Algorithm * Used | Bitwise OR and ^= (Bitwise XOR) operators in calculating next Elementary Generation over Addition + and Subtraction -= --- Cellular-Automata/Elementary.js | 105 ++++++++++++++++++++++ Cellular-Automata/test/Elementary.test.js | 93 +++++++++++++++++++ 2 files changed, 198 insertions(+) create mode 100644 Cellular-Automata/Elementary.js create mode 100644 Cellular-Automata/test/Elementary.test.js diff --git a/Cellular-Automata/Elementary.js b/Cellular-Automata/Elementary.js new file mode 100644 index 0000000000..7fd3e59962 --- /dev/null +++ b/Cellular-Automata/Elementary.js @@ -0,0 +1,105 @@ +/** + * Author: Jacoby Johnson (cobyj33) + * + * Generates generations of Elementary 1D cellular automata + * + * Wikipedia: https://en.wikipedia.org/wiki/Elementary_cellular_automaton + * See all 255 possible rules and find another explanation here: https://mathworld.wolfram.com/ElementaryCellularAutomaton.html + * + * My personal take on the explanation of Elementary Cellular Automata: + * + * Elementary 1D cellular automata defines the growth and decay of populations of "cells" according to a specific rule, where the population is a line (array) and each cell is in either an "alive" (1) or a "dead" (0) state. + * + * The next generation of for a cell in the simulation ONLY depends on the state of its neighborhood (the state of the cell itself as well as the states of the cells to the immediate right and the immediate left) + * Therefore, since each neighborhood consists of 3 cells each with 2 states there are 2^3 possibilities that determine a cell's next state, where each possible neighborhood could be represented in binary as + * + * 111 + * 110 + * 101 + * 100 + * 011 + * 010 + * 001 + * 000 + * + * Where "1" represents the cell being alive and "0" represents the cell being dead. The leftmost bit represents the left neighbor of the currently analyzed cell, the middle bit represents the currently analyzed cell, and the rightmost bit represents the right neighbor of the currently analyzed cell. + * + * Rules are represented between 0 and 255 (0 and 255 inclusive), or more conceptually is seen as an 8 bit binary number. Each bit represents whether a cell should survive according to one of the 8 states of a cell's neighborhood. In this way, the number can act like an array of data of length 8. + * The most significant bit (ex: ->10100100 ) represents the output for the "all on" state while the least significant bit (ex: 10100100<- ) represents the output for the "all off" state + * In other words, all of the 8 possible neighborhood configurations map toward the 8 bits in a rule's output values + * + * Therefore, to find whether the a cell is born, survives, or dies, one could convert the state of a cell and it's neighbors into a binary number, then use the numerical value of that binary number as an index to find the corresponding rule's output, which is what has been implemented below + * This analysis of a cell's neighborhood is performed on each cell in a generation until a new generation is created and returned. + * + * Rules are usually demonstrated visually by how a single cell grows independently according to that rule + * + * Example: First generations of Rule 94 First Generations of Rule 126 + * 000000000000000000000000001000000000000000000000000 000000000000000000000000001000000000000000000000000 + * 000000000000000000000000011100000000000000000000000 000000000000000000000000011100000000000000000000000 + * 000000000000000000000000110110000000000000000000000 000000000000000000000000110110000000000000000000000 + * 000000000000000000000001110111000000000000000000000 000000000000000000000001111111000000000000000000000 + * 000000000000000000000011010101100000000000000000000 000000000000000000000011000001100000000000000000000 + * 000000000000000000000111010101110000000000000000000 000000000000000000000111100011110000000000000000000 + * 000000000000000000001101010101011000000000000000000 000000000000000000001100110110011000000000000000000 + * 000000000000000000011101010101011100000000000000000 000000000000000000011111111111111100000000000000000 + * 000000000000000000110101010101010110000000000000000 000000000000000000110000000000000110000000000000000 + * 000000000000000001110101010101010111000000000000000 000000000000000001111000000000001111000000000000000 + * 000000000000000011010101010101010101100000000000000 000000000000000011001100000000011001100000000000000 + * 000000000000000111010101010101010101110000000000000 000000000000000111111110000000111111110000000000000 + * 000000000000001101010101010101010101011000000000000 000000000000001100000011000001100000011000000000000 + * 000000000000011101010101010101010101011100000000000 000000000000011110000111100011110000111100000000000 + * 000000000000110101010101010101010101010110000000000 000000000000110011001100110110011001100110000000000 + * 000000000001110101010101010101010101010111000000000 000000000001111111111111111111111111111111000000000 + * 000000000011010101010101010101010101010101100000000 000000000011000000000000000000000000000001100000000 + * 000000000111010101010101010101010101010101110000000 000000000111100000000000000000000000000011110000000 + * 000000001101010101010101010101010101010101011000000 000000001100110000000000000000000000000110011000000 + * 000000011101010101010101010101010101010101011100000 000000011111111000000000000000000000001111111100000 + * + * DEV NOTE: This implementation assumes that cells on the edge (who only have 1 neighbor) have 1 neighbor and a permanently "dead" neighbor, which is technically correct in a finite space. However, most diagrams of these elementary cellular automata rules assume a infinite line of cells. Therefore, the edges of the array may not evolve perfectly in line with pictured diagrams which assume infinite space. + */ + +/** + * Find the next Elementary Cell Automata Generation given the previous generation and the rule [0-255] to follow + * @param {(0 | 1)[]} generation The current generation of the Elementary Cellular Automata simulation + * @param {number} rule The current rule of the Elementary Cellular Automata simulation. Must be an integer between 0 and 255 inclusive + * @returns {(0 | 1)[]} The next generation according to the inputted rule + */ +export function getNextElementaryGeneration (generation, rule) { + const NUM_ELEMENTARY_NEIGHBORHOOD_STATES = 8 + const MIN_RULE = 0 + const MAX_RULE = 255 + + if (!Number.isInteger(rule)) { + throw new Error(`Rule must be an integer between the values 0 and 255 (got ${rule})`) + } + if (rule < MIN_RULE || rule > MAX_RULE) { + throw new RangeError(`Rule must be an integer between the values 0 and 255 (got ${rule})`) + } + + const binaryRule = rule.toString(2).padStart(NUM_ELEMENTARY_NEIGHBORHOOD_STATES, '0') + const ruleData = binaryRule.split('').map(bit => Number.parseInt(bit)) // note that ruleData[0] represents "all alive" while ruleData[7] represents "all dead" + const output = new Array(generation.length) + const LEFT_DEAD = 4 // 100 in binary + const MIDDLE_DEAD = 2 // 010 in binary + const RIGHT_DEAD = 1 // 001 in binary + + for (let i = 0; i < generation.length; i++) { + let neighborhoodValue = LEFT_DEAD | MIDDLE_DEAD | RIGHT_DEAD + + if (i - 1 > 0 && generation[i - 1] === 1) { + neighborhoodValue ^= LEFT_DEAD + } + + if (generation[i] === 1) { + neighborhoodValue ^= MIDDLE_DEAD + } + + if (i + 1 < generation.length && generation[i + 1] === 1) { + neighborhoodValue ^= RIGHT_DEAD + } + + output[i] = ruleData[neighborhoodValue] + } + + return output +} diff --git a/Cellular-Automata/test/Elementary.test.js b/Cellular-Automata/test/Elementary.test.js new file mode 100644 index 0000000000..7f868584b9 --- /dev/null +++ b/Cellular-Automata/test/Elementary.test.js @@ -0,0 +1,93 @@ +import { getNextElementaryGeneration } from '../Elementary' + +describe('Elementary Cellular Automata', () => { + describe('Rule Errors', () => { + it('Correct', () => { + expect(() => getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 128)).not.toThrow() + }) + + it('Less than 0', () => { + expect(() => getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], -1)).toThrow() + }) + + it('Greater than 255', () => { + expect(() => getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 256)).toThrow() + }) + + it('Decimal', () => { + expect(() => getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 100.4)).toThrow() + }) + }) + + describe('Rule 54 Iterations', () => { + it('Generation 1', () => { + expect(getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 54)).toEqual([0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0]) + }) + it('Generation 2', () => { + expect(getNextElementaryGeneration([0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], 54)).toEqual([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]) + }) + it('Generation 3', () => { + expect(getNextElementaryGeneration([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], 54)).toEqual([0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0]) + }) + it('Generation 4', () => { + expect(getNextElementaryGeneration([0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0], 54)).toEqual([0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0]) + }) + }) + + describe('Rule 222 Iterations', () => { + it('Generation 1', () => { + expect(getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 222)).toEqual([0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0]) + }) + it('Generation 2', () => { + expect(getNextElementaryGeneration([0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], 222)).toEqual([0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0]) + }) + it('Generation 3', () => { + expect(getNextElementaryGeneration([0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0], 222)).toEqual([0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0]) + }) + it('Generation 4', () => { + expect(getNextElementaryGeneration([0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0], 222)).toEqual([0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]) + }) + }) + + describe('Rule 60 Iterations', () => { + it('Generation 1', () => { + expect(getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 60)).toEqual([0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0]) + }) + it('Generation 2', () => { + expect(getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0], 60)).toEqual([0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0]) + }) + it('Generation 3', () => { + expect(getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0], 60)).toEqual([0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0]) + }) + it('Generation 4', () => { + expect(getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0], 60)).toEqual([0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0]) + }) + }) + + describe('Rule 90 Iterations', () => { + it('Generation 1', () => { + expect(getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 90)).toEqual([0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0]) + }) + it('Generation 2', () => { + expect(getNextElementaryGeneration([0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], 90)).toEqual([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]) + }) + it('Generation 3', () => { + expect(getNextElementaryGeneration([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], 90)).toEqual([0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0]) + }) + it('Generation 4', () => { + expect(getNextElementaryGeneration([0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0], 90)).toEqual([0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0]) + }) + }) + + describe('Rule 30 Iterations', () => { + it('Generation 1', () => { + expect(getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 30)).toEqual([0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0]) + }) + it('Generation 2', () => { + expect(getNextElementaryGeneration([0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], 30)).toEqual([0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0]) + }) + it('Generation 3', () => { + expect(getNextElementaryGeneration([0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0], 30)).toEqual([0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0]) + }) + }) +}) From 1381ed0c17c497f61f1217972d58863cf9224dab Mon Sep 17 00:00:00 2001 From: Roman <1992roman@list.ru> Date: Sat, 4 Mar 2023 07:09:21 +0200 Subject: [PATCH 005/122] feat: add dutchNationalFlagSort implementation (#1305) * feat: add dutchNationalFlagSort implementation * fix: add test, fit code style * fix: add link to directory.md --- DIRECTORY.md | 1 + Sorts/DutchNationalFlagSort.js | 33 ++++++++++++++++++++++++ Sorts/test/DutchNationalFlagSort.test.js | 9 +++++++ 3 files changed, 43 insertions(+) create mode 100644 Sorts/DutchNationalFlagSort.js create mode 100644 Sorts/test/DutchNationalFlagSort.test.js diff --git a/DIRECTORY.md b/DIRECTORY.md index ca30d65825..ec2b8f5dad 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -303,6 +303,7 @@ * [CombSort](Sorts/CombSort.js) * [CountingSort](Sorts/CountingSort.js) * [CycleSort](Sorts/CycleSort.js) + * [DutchNationalFlagSort](Sorts/DutchNationalFlagSort.js) * [FindSecondLargestElement](Sorts/FindSecondLargestElement.js) * [FisherYatesShuffle](Sorts/FisherYatesShuffle.js) * [FlashSort](Sorts/FlashSort.js) diff --git a/Sorts/DutchNationalFlagSort.js b/Sorts/DutchNationalFlagSort.js new file mode 100644 index 0000000000..d816d718c3 --- /dev/null +++ b/Sorts/DutchNationalFlagSort.js @@ -0,0 +1,33 @@ +/** + * @function dutchNationalFlagSort + * @description Dutch National Flag Sort is an algorithm to sort an array containing 0s, 1s, and 2s in linear time. + Time complexity of Dutch National Flag Sort Algorithm is O(n). + Auxiliary Space required for Dutch National Flag Sort Algorithm is O(1). + * @param {Integer[]} nums - Array of integers containing 0s, 1s, and 2s. + * @return {Integer[]} - Array of integers sorted in non-decreasing order. + * @see [Dutch National Flag Sort](https://en.wikipedia.org/wiki/Dutch_national_flag_problem) + */ +export function dutchNationalFlagSort (nums) { + let low = 0 + let mid = 0 + let high = nums.length - 1 + + while (mid <= high) { + switch (nums[mid]) { + case 0: + [nums[low], nums[mid]] = [nums[mid], nums[low]] + low++ + mid++ + break + case 1: + mid++ + break + case 2: + [nums[mid], nums[high]] = [nums[high], nums[mid]] + high-- + break + } + } + + return nums +} diff --git a/Sorts/test/DutchNationalFlagSort.test.js b/Sorts/test/DutchNationalFlagSort.test.js new file mode 100644 index 0000000000..ddb35c6171 --- /dev/null +++ b/Sorts/test/DutchNationalFlagSort.test.js @@ -0,0 +1,9 @@ +import { dutchNationalFlagSort } from '../DutchNationalFlagSort' + +describe('DutchNationalFlagSort', () => { + it('should sort arrays correctly', () => { + expect(dutchNationalFlagSort([2, 0, 2, 1, 1, 0])).toEqual([0, 0, 1, 1, 2, 2]) + expect(dutchNationalFlagSort([2, 1, 0])).toEqual([0, 1, 2]) + expect(dutchNationalFlagSort([1, 0, 0, 0, 1])).toEqual([0, 0, 0, 1, 1]) + }) +}) From 84b01aeb61506ece8f41457a6108f9cfb6e8e89a Mon Sep 17 00:00:00 2001 From: Htin Zaw <106032566+htinz@users.noreply.github.com> Date: Thu, 23 Mar 2023 03:35:36 +0000 Subject: [PATCH 006/122] fixed: to correct grammatical mistakes (#1307) Corrected grammatical mistakes --- .github/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index a755dabcd1..bcb4e6bbaa 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -15,5 +15,5 @@ - [ ] All new JavaScript files are placed inside an existing directory. - [ ] All filenames should use the UpperCamelCase (PascalCase) style. There should be no spaces in filenames. **Example:**`UserProfile.js` is allowed but `userprofile.js`,`Userprofile.js`,`user-Profile.js`,`userProfile.js` are not -- [ ] All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation. +- [ ] All new algorithms have a URL in their comments that points to Wikipedia or another similar explanation. - [ ] If this pull request resolves one or more open issues then the commit message contains `Fixes: #{$ISSUE_NO}`. From e6df6ebad64f4af75670e14ba87e39efdfa67940 Mon Sep 17 00:00:00 2001 From: Arnold Zhou <104749673+mrmagic2020@users.noreply.github.com> Date: Mon, 1 May 2023 16:16:48 +1000 Subject: [PATCH 007/122] New Algorithm: Parity Outlier (#1314) * [feat] New algorithm * [test] Add new test for ParityOutlier.js * [fix] Reset indentation * [fix] Reset indentation * [fix] Style changes * fix: improve code efficiency and a glitch * test: adds a new possible test case * fix: style fix * fix: delete redundant comments and else statements * [fix] style fix --- Maths/ParityOutlier.js | 33 ++++++++++++++++++++++++++++++++ Maths/test/ParityOutlier.test.js | 30 +++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 Maths/ParityOutlier.js create mode 100644 Maths/test/ParityOutlier.test.js diff --git a/Maths/ParityOutlier.js b/Maths/ParityOutlier.js new file mode 100644 index 0000000000..7642541ffb --- /dev/null +++ b/Maths/ParityOutlier.js @@ -0,0 +1,33 @@ +/** + * @author mrmagic2020 + * @description The function will find the parity outlier from an array of integers. + * @see https://en.wikipedia.org/wiki/Parity_(mathematics) + * @param {number[]} integers - An array of integers. + * @returns {number} - The parity outlier. + * @example parityOutlier([1, 3, 5, 8, 9]) = 8 + */ +const parityOutlier = (integers) => { + let oddsCount = 0 // define counter for odd number(s) + let evensCount = 0 // define counter for even number(s) + let odd, even + + for (const e of integers) { + if (!Number.isInteger(e)) { // detect non-integer elements + return null + } + if (e % 2 === 0) { // an even number + even = e + evensCount++ + } else { // an odd number + odd = e + oddsCount++ + } + } + + if (oddsCount === 0 || evensCount === 0) return null // array has only odd/even number(s) + if (oddsCount > 1 && evensCount > 1) return null // array has more than one even and odd number + + return oddsCount === 1 ? odd : even +} + +export { parityOutlier } diff --git a/Maths/test/ParityOutlier.test.js b/Maths/test/ParityOutlier.test.js new file mode 100644 index 0000000000..ed3307dcd0 --- /dev/null +++ b/Maths/test/ParityOutlier.test.js @@ -0,0 +1,30 @@ +import { parityOutlier } from '../ParityOutlier' + +describe('Testing parityOutlier function', () => { + it('should return the odd number in an array of even numbers', () => { + expect(parityOutlier([1, 2, 16, -8848, 5126])).toBe(1) + }) + + it('should return the even number in an array of odd numbers', () => { + expect(parityOutlier([177, 5, 76, 1919])).toBe(76) + }) + + it('should, if the given array has only one integer element, return the integer itself', () => { + expect(parityOutlier([83])).toBe(83) + expect(parityOutlier([54])).toBe(54) + }) + + it('should, if the given array has only an odd and an even number, return the odd outlier', () => { + expect(parityOutlier([1, 2])).toBe(1) + expect(parityOutlier([4, 3])).toBe(3) + }) + + it('should return null if the given array is empty, contains only one integer, contains non-interger elements or does not have a parity outlier', () => { + expect(parityOutlier([])).toBe(null) + expect(parityOutlier([2])).toBe(null) + expect(parityOutlier([2, {}, 5, 'GitHub'])).toBe(null) + expect(parityOutlier([1, 3, 5, 7, 9])).toBe(null) + expect(parityOutlier([0, 2, 4, 6, 8])).toBe(null) + expect(parityOutlier([1, 3, 5, 7, 2, 4, 6, 8])).toBe(null) + }) +}) From 331a4d26cf76174de02924150ac1e3c8e9e32c5a Mon Sep 17 00:00:00 2001 From: Arnold Zhou <104749673+mrmagic2020@users.noreply.github.com> Date: Mon, 1 May 2023 16:17:47 +1000 Subject: [PATCH 008/122] feat: Ciphers/MorseCode Algorithm (#1315) * [feat] New algorithm * [test] Add new test for ParityOutlier.js * [fix] Reset indentation * [fix] Reset indentation * [fix] Style changes * fix: improve code efficiency and a glitch * test: adds a new possible test case * fix: style fix * fix: delete redundant comments and else statements * [fix] style fix * feat: New algorithm * fix: fixed custom code symbols * test: add test for MorseCode * test: add case with custom code symbols * delete files from main branch * fix: style fix * fix: style fix * fix: delete unnecessary quotes --- Ciphers/MorseCode.js | 85 ++++++++++++++++++++++++++++++++++ Ciphers/test/MorseCode.test.js | 16 +++++++ 2 files changed, 101 insertions(+) create mode 100644 Ciphers/MorseCode.js create mode 100644 Ciphers/test/MorseCode.test.js diff --git a/Ciphers/MorseCode.js b/Ciphers/MorseCode.js new file mode 100644 index 0000000000..9c64a39a25 --- /dev/null +++ b/Ciphers/MorseCode.js @@ -0,0 +1,85 @@ +/** + * @author mrmagic2020 + * @description Enciphers a combination of letters, numbers and symbols into morse code. + * @see https://en.wikipedia.org/wiki/Morse_code + * @param {string} msg The message to be enciphered. + * @param {string} dot Symbol representing the dots. + * @param {string} dash Symbol representing the dash. + * @returns {string} Enciphered morse code. + * @example morse('Hello World!') = '**** * *-** *-** --- *-- --- *-* *-** -** -*-*--' + */ +const morse = (msg, dot = '*', dash = '-') => { + const key = { + A: '*-', + B: '-***', + C: '-*-*', + D: '-**', + E: '*', + F: '**-*', + G: '--*', + H: '****', + I: '**', + J: '*---', + K: '-*-', + L: '*-**', + M: '--', + N: '-*', + O: '---', + P: '*--*', + Q: '--*-', + R: '*-*', + S: '***', + T: '-', + U: '**-', + V: '***-', + W: '*--', + X: '-**-', + Y: '-*--', + Z: '--**', + 1: '*----', + 2: '**---', + 3: '***--', + 4: '****-', + 5: '*****', + 6: '-****', + 7: '--***', + 8: '---**', + 9: '----*', + 0: '-----', + '.': '*-*-*-', + ',': '--**--', + '?': '**--**', + '!': '-*-*--', + '\'': '*----*', + '"': '*-**-*', + '(': '-*--*', + ')': '-*--*-', + '&': '*-***', + ':': '---***', + ';': '-*-*-*', + '/': '-**-*', + _: '**--*-', + '=': '-***-', + '+': '*-*-*', + '-': '-****-', + $: '***-**-', + '@': '*--*-*' + } + + let newMsg = '' + + msg.toString().split('').forEach((e) => { + if (/[a-zA-Z]/.test(e)) { + newMsg += key[e.toUpperCase()].replaceAll('*', dot).replaceAll('-', dash) + } else if (Object.keys(key).includes(e)) { + newMsg += key[e].replaceAll('*', dot).replaceAll('-', dash) + } else { + newMsg += e + } + newMsg += ' ' + }) + + return newMsg.trim() +} + +export { morse } diff --git a/Ciphers/test/MorseCode.test.js b/Ciphers/test/MorseCode.test.js new file mode 100644 index 0000000000..5dd4e07959 --- /dev/null +++ b/Ciphers/test/MorseCode.test.js @@ -0,0 +1,16 @@ +import { morse } from '../MorseCode' + +describe('Testing morse function', () => { + it('should return an enciphered string with a given input string', () => { + expect(morse('Hello World!')).toBe('**** * *-** *-** --- *-- --- *-* *-** -** -*-*--') + expect(morse('1+1=2')).toBe('*---- *-*-* *---- -***- **---') + }) + + it('should leave symbols that does not have its corresponding morse representation', () => { + expect(morse('© 2023 GitHub, Inc.')).toBe('© **--- ----- **--- ***-- --* ** - **** **- -*** --**-- ** -* -*-* *-*-*-') + }) + + it('should be able to accept custom morse code symbols', () => { + expect(morse('Nodejs', '.', '|')).toBe('|. ||| |.. . .||| ...') + }) +}) From 1666c3a0be27d18e31b8721029357b285898a1a8 Mon Sep 17 00:00:00 2001 From: BekzodIsakov <71423825+BekzodIsakov@users.noreply.github.com> Date: Mon, 15 May 2023 13:05:09 +0500 Subject: [PATCH 009/122] fix error in SinglyLinkedList head method (#1322) * fix error in SinglyLinkedList head method * test: update check head test for SinglyLinkedList * fix: code style error * fix: remove extra semicolons --------- Co-authored-by: Bekzod --- Data-Structures/Linked-List/SinglyLinkedList.js | 4 ++-- Data-Structures/Linked-List/test/SinglyLinkedList.test.js | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Data-Structures/Linked-List/SinglyLinkedList.js b/Data-Structures/Linked-List/SinglyLinkedList.js index ec0e31f5fc..b093d4bde6 100644 --- a/Data-Structures/Linked-List/SinglyLinkedList.js +++ b/Data-Structures/Linked-List/SinglyLinkedList.js @@ -40,12 +40,12 @@ class LinkedList { // Returns the head head () { - return this.headNode?.data || null + return this.headNode?.data ?? null } // Returns the tail tail () { - return this.tailNode?.data || null + return this.tailNode?.data ?? null } // Return if the list is empty diff --git a/Data-Structures/Linked-List/test/SinglyLinkedList.test.js b/Data-Structures/Linked-List/test/SinglyLinkedList.test.js index 5435553437..53be70884d 100644 --- a/Data-Structures/Linked-List/test/SinglyLinkedList.test.js +++ b/Data-Structures/Linked-List/test/SinglyLinkedList.test.js @@ -148,6 +148,10 @@ describe('SinglyLinkedList', () => { list.addFirst(30) expect(list.head()).toBe(30) + + // check for a falsy head data + list.addFirst(false) + expect(list.head()).toBe(false) }) it('Check tail', () => { @@ -162,6 +166,10 @@ describe('SinglyLinkedList', () => { list.addFirst(30) expect(list.tail()).toBe(20) + + // check for a falsy tail data + list.addLast(false) + expect(list.tail()).toBe(false) }) it('Check size', () => { From 6debd5c1a20fcdffe435c35b5b901e7a1e61971e Mon Sep 17 00:00:00 2001 From: Umesh Patidar <50135590+umeshdangrecha@users.noreply.github.com> Date: Sat, 17 Jun 2023 01:49:21 +0530 Subject: [PATCH 010/122] =?UTF-8?q?chore:=20=F0=9F=A4=96=20remove=20extra?= =?UTF-8?q?=20lines=20(#1330)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I ran the command yarn style and that got failed, so I fixed that --- Data-Structures/Heap/MinPriorityQueue.js | 1 - Dynamic-Programming/SudokuSolver.js | 1 - Dynamic-Programming/UniquePaths.js | 1 - Project-Euler/Problem011.js | 1 - Recursive/BinarySearch.js | 1 - Recursive/FibonacciNumberRecursive.js | 1 - Sorts/TopologicalSort.js | 1 - 7 files changed, 7 deletions(-) diff --git a/Data-Structures/Heap/MinPriorityQueue.js b/Data-Structures/Heap/MinPriorityQueue.js index bc4f26f786..5b543ce94f 100644 --- a/Data-Structures/Heap/MinPriorityQueue.js +++ b/Data-Structures/Heap/MinPriorityQueue.js @@ -1,4 +1,3 @@ - /* Minimum Priority Queue * It is a part of heap data structure * A heap is a specific tree based data structure diff --git a/Dynamic-Programming/SudokuSolver.js b/Dynamic-Programming/SudokuSolver.js index 75f174a318..b077f6ec18 100644 --- a/Dynamic-Programming/SudokuSolver.js +++ b/Dynamic-Programming/SudokuSolver.js @@ -1,4 +1,3 @@ - const isValid = (board, row, col, k) => { for (let i = 0; i < 9; i++) { const m = 3 * Math.floor(row / 3) + Math.floor(i / 3) diff --git a/Dynamic-Programming/UniquePaths.js b/Dynamic-Programming/UniquePaths.js index 4b3d67a1a3..a37049b2f4 100644 --- a/Dynamic-Programming/UniquePaths.js +++ b/Dynamic-Programming/UniquePaths.js @@ -1,4 +1,3 @@ - /* * * Unique Paths diff --git a/Project-Euler/Problem011.js b/Project-Euler/Problem011.js index 4135702c8e..190295c8ae 100644 --- a/Project-Euler/Problem011.js +++ b/Project-Euler/Problem011.js @@ -1,4 +1,3 @@ - /* * * In the 20×20 grid below, four numbers along a diagonal line have been marked in red. diff --git a/Recursive/BinarySearch.js b/Recursive/BinarySearch.js index 4c9a2d78a7..ba622daaa1 100644 --- a/Recursive/BinarySearch.js +++ b/Recursive/BinarySearch.js @@ -1,4 +1,3 @@ - /** * @function BinarySearch * @description Search the integer inside the sorted integers array using Binary Search Algorithm. diff --git a/Recursive/FibonacciNumberRecursive.js b/Recursive/FibonacciNumberRecursive.js index 4b32e9cb43..911d078e91 100644 --- a/Recursive/FibonacciNumberRecursive.js +++ b/Recursive/FibonacciNumberRecursive.js @@ -1,4 +1,3 @@ - /** * @function Fibonacci * @description Function to return the N-th Fibonacci number. diff --git a/Sorts/TopologicalSort.js b/Sorts/TopologicalSort.js index 5890449533..72487615ba 100644 --- a/Sorts/TopologicalSort.js +++ b/Sorts/TopologicalSort.js @@ -1,4 +1,3 @@ - export function TopologicalSorter () { const graph = {} let isVisitedNode From ecac786da7f93d817eadc01ab479bfe7b3719f79 Mon Sep 17 00:00:00 2001 From: 0-harshit-0 Date: Fri, 14 Jul 2023 18:39:12 +0530 Subject: [PATCH 011/122] Remove URL validation (#1335) * Update ValidateUrl.js Used JS URL API to check if URL is valid. If valid it will return the url else false; * Update ValidateUrl.js Fixed for #1183 * Update ValidateUrl.js fixed code style test. Fixed for #1183 * Delete ValidateUrl.js Fixes: #1183 --- String/ValidateUrl.js | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 String/ValidateUrl.js diff --git a/String/ValidateUrl.js b/String/ValidateUrl.js deleted file mode 100644 index cfcbd43666..0000000000 --- a/String/ValidateUrl.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @function ValidateURL - * @description validate the URL. - * @param {String} url - The input URL string - * @return {Boolean} - */ -const validateURL = (url) => { - const URL_PATTERN = /^(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})$/gi - - return URL_PATTERN.test(url) -} - -export { validateURL } From 53b1f667eeadbc1af929a9bf7fddb651aec2b49d Mon Sep 17 00:00:00 2001 From: Praneeth Jain Date: Sat, 12 Aug 2023 19:48:14 +0530 Subject: [PATCH 012/122] Project Euler 021 (#1347) * feat: Project Euler Problem 21 * test: Project Euler 21 * fix: test description in Project Euler 21 --- Project-Euler/Problem021.js | 33 +++++++++++++++++++++++++++ Project-Euler/test/Problem021.test.js | 14 ++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 Project-Euler/Problem021.js create mode 100644 Project-Euler/test/Problem021.test.js diff --git a/Project-Euler/Problem021.js b/Project-Euler/Problem021.js new file mode 100644 index 0000000000..34a5517bdf --- /dev/null +++ b/Project-Euler/Problem021.js @@ -0,0 +1,33 @@ +import { aliquotSum } from '../Maths/AliquotSum.js' + +/** + * Problem 21 - Amicable numbers + * + * @see {@link https://projecteuler.net/problem=21} + * + * Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). + * If d(a) = b and d(b) = a, where a != b, then a and b are an amicable pair and each of a and b are called amicable numbers. + * For example, the proper divisors of 220 are 1,2,4,5,10,11,20,22,44,55 and 110; therefore d(220) = 284. + * The proper divisors of 284 are 1,2,4,71 and 142; so d(284) = 220. + * Evaluate the sum of all amicable numbers under 10000 + * + * @author PraneethJain + */ + +function problem21 (n) { + if (n < 2) { + throw new Error('Invalid Input') + } + + let result = 0 + for (let a = 2; a < n; ++a) { + const b = aliquotSum(a) // Sum of all proper divisors of a + // Check if b > a to ensure each pair isn't counted twice, and check if sum of proper divisors of b is equal to a + if (b > a && aliquotSum(b) === a) { + result += a + b + } + } + return result +} + +export { problem21 } diff --git a/Project-Euler/test/Problem021.test.js b/Project-Euler/test/Problem021.test.js new file mode 100644 index 0000000000..411f6da0d2 --- /dev/null +++ b/Project-Euler/test/Problem021.test.js @@ -0,0 +1,14 @@ +import { problem21 } from '../Problem021.js' + +describe('check sum of amicable numbers under n', () => { + test('should be invalid input if number is negative', () => { + expect(() => problem21(-1)).toThrowError('Invalid Input') + }) + test('should be invalid input if number is 0', () => { + expect(() => problem21(0)).toThrowError('Invalid Input') + }) + // Project Euler Condition Check + test('if the number is greater or equal to 1', () => { + expect(problem21(10000)).toBe(31626) + }) +}) From 9b32db29d880f689d9cafa9c258d29e30bf39294 Mon Sep 17 00:00:00 2001 From: Chetan Nada <83969719+chetannada@users.noreply.github.com> Date: Tue, 15 Aug 2023 01:24:00 +0530 Subject: [PATCH 013/122] Update: Added Unary Operator in SumOfDigits algorithm (#1348) * Update: Added Unary Operator in SumOfDigits algorithm * Update: Added Unary Operator in SumOfDigits algorithm --- Maths/SumOfDigits.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Maths/SumOfDigits.js b/Maths/SumOfDigits.js index e076be7a56..4b1d7264bc 100644 --- a/Maths/SumOfDigits.js +++ b/Maths/SumOfDigits.js @@ -8,12 +8,11 @@ /* The given input is converted to a string, split into an array of characters. This array is reduced to a number using the method .reduce - NOTE: The final parseInt is just there in cases where 1 digit numbers are given, since without that it would result in a String output. */ function sumOfDigitsUsingString (number) { if (number < 0) number = -number - return Number.parseInt(number.toString().split('').reduce((a, b) => Number(a) + Number(b))) + return +(number.toString().split('').reduce((a, b) => (+a) + (+b))) } /* From 00e40e6f0602cd12aae69b6001f66f809ee11048 Mon Sep 17 00:00:00 2001 From: Carlos Rafael Date: Mon, 21 Aug 2023 15:06:43 -0300 Subject: [PATCH 014/122] Fix/code smells (#1338) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ♻️ refactor: improving and fixing some code * Updated Documentation in README.md * ♻️ refactor: improving isLeapYear * 🐛 chore: back changes * 🐛 fix: using reduce instead forEach * 🐛 fix: using reduce instead forEach * 🐛 fix: removing duplicated code * 🐛 chore: removing .js --------- Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> --- Bit-Manipulation/IsPowerOfTwo.js | 5 +- Cellular-Automata/ConwaysGameOfLife.js | 11 ++-- Conversions/DateDayDifference.js | 2 +- DIRECTORY.md | 9 ++- Data-Structures/Graph/test/Graph2.test.js | 6 +- Data-Structures/Heap/MinPriorityQueue.js | 3 +- Data-Structures/Tree/Trie.js | 4 +- Dynamic-Programming/FindMonthCalendar.js | 14 ++--- Graphs/DijkstraSmallestPath.js | 67 ----------------------- Maths/LeapYear.js | 6 +- Maths/MatrixMultiplication.js | 9 +-- Maths/MidpointIntegration.js | 3 +- Maths/SimpsonIntegration.js | 3 +- String/CheckRearrangePalindrome.js | 2 +- 14 files changed, 33 insertions(+), 111 deletions(-) diff --git a/Bit-Manipulation/IsPowerOfTwo.js b/Bit-Manipulation/IsPowerOfTwo.js index ec5bbcd170..ee466519ea 100644 --- a/Bit-Manipulation/IsPowerOfTwo.js +++ b/Bit-Manipulation/IsPowerOfTwo.js @@ -23,8 +23,5 @@ */ export const IsPowerOfTwo = (n) => { - if (n > 0 && (n & (n - 1)) === 0) { - return true - } - return false + return n > 0 && (n & (n - 1)) === 0 } diff --git a/Cellular-Automata/ConwaysGameOfLife.js b/Cellular-Automata/ConwaysGameOfLife.js index a4c6a9c901..6ce4474783 100644 --- a/Cellular-Automata/ConwaysGameOfLife.js +++ b/Cellular-Automata/ConwaysGameOfLife.js @@ -29,11 +29,12 @@ export function newGeneration (cells) { // Decide whether the cell is alive or dead const alive = cells[i][j] === 1 - if ((alive && neighbourCount >= 2 && neighbourCount <= 3) || (!alive && neighbourCount === 3)) { - nextGenerationRow.push(1) - } else { - nextGenerationRow.push(0) - } + + const cellIsAlive = + (alive && neighbourCount >= 2 && neighbourCount <= 3) || + (!alive && neighbourCount === 3) + + nextGenerationRow.push(cellIsAlive ? 1 : 0) } nextGeneration.push(nextGenerationRow) } diff --git a/Conversions/DateDayDifference.js b/Conversions/DateDayDifference.js index b9d45e6dc2..b2dfc45ebd 100644 --- a/Conversions/DateDayDifference.js +++ b/Conversions/DateDayDifference.js @@ -19,7 +19,7 @@ const DateToDay = (dd, mm, yyyy) => { const DateDayDifference = (date1, date2) => { // firstly, check that both input are string or not. - if (typeof date1 !== 'string' && typeof date2 !== 'string') { + if (typeof date1 !== 'string' || typeof date2 !== 'string') { return new TypeError('Argument is not a string.') } // extract the first date diff --git a/DIRECTORY.md b/DIRECTORY.md index ec2b8f5dad..4f1c033352 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -1,5 +1,6 @@ * **Backtracking** * [AllCombinationsOfSizeK](Backtracking/AllCombinationsOfSizeK.js) + * [generateParentheses](Backtracking/generateParentheses.js) * [GeneratePermutations](Backtracking/GeneratePermutations.js) * [KnightTour](Backtracking/KnightTour.js) * [NQueens](Backtracking/NQueens.js) @@ -18,12 +19,14 @@ * [Memoize](Cache/Memoize.js) * **Cellular-Automata** * [ConwaysGameOfLife](Cellular-Automata/ConwaysGameOfLife.js) + * [Elementary](Cellular-Automata/Elementary.js) * **Ciphers** * [AffineCipher](Ciphers/AffineCipher.js) * [Atbash](Ciphers/Atbash.js) * [CaesarCipher](Ciphers/CaesarCipher.js) * [KeyFinder](Ciphers/KeyFinder.js) * [KeywordShiftedAlphabet](Ciphers/KeywordShiftedAlphabet.js) + * [MorseCode](Ciphers/MorseCode.js) * [ROT13](Ciphers/ROT13.js) * [VigenereCipher](Ciphers/VigenereCipher.js) * [XORCipher](Ciphers/XORCipher.js) @@ -66,6 +69,7 @@ * [Graph2](Data-Structures/Graph/Graph2.js) * [Graph3](Data-Structures/Graph/Graph3.js) * **Heap** + * [KeyPriorityQueue](Data-Structures/Heap/KeyPriorityQueue.js) * [MaxHeap](Data-Structures/Heap/MaxHeap.js) * [MinHeap](Data-Structures/Heap/MinHeap.js) * [MinPriorityQueue](Data-Structures/Heap/MinPriorityQueue.js) @@ -112,7 +116,10 @@ * [Shuf](Dynamic-Programming/Shuf.js) * [SieveOfEratosthenes](Dynamic-Programming/SieveOfEratosthenes.js) * **Sliding-Window** + * [HouseRobber](Dynamic-Programming/Sliding-Window/HouseRobber.js) * [LongestSubstringWithoutRepeatingCharacters](Dynamic-Programming/Sliding-Window/LongestSubstringWithoutRepeatingCharacters.js) + * [MaxConsecutiveOnes](Dynamic-Programming/Sliding-Window/MaxConsecutiveOnes.js) + * [MaxConsecutiveOnesIII](Dynamic-Programming/Sliding-Window/MaxConsecutiveOnesIII.js) * [PermutationinString](Dynamic-Programming/Sliding-Window/PermutationinString.js) * [SudokuSolver](Dynamic-Programming/SudokuSolver.js) * [TrappingRainWater](Dynamic-Programming/TrappingRainWater.js) @@ -212,6 +219,7 @@ * [ModularBinaryExponentiationRecursive](Maths/ModularBinaryExponentiationRecursive.js) * [NumberOfDigits](Maths/NumberOfDigits.js) * [Palindrome](Maths/Palindrome.js) + * [ParityOutlier](Maths/ParityOutlier.js) * [PascalTriangle](Maths/PascalTriangle.js) * [PerfectCube](Maths/PerfectCube.js) * [PerfectNumber](Maths/PerfectNumber.js) @@ -365,7 +373,6 @@ * [Upper](String/Upper.js) * [ValidateCreditCard](String/ValidateCreditCard.js) * [ValidateEmail](String/ValidateEmail.js) - * [ValidateUrl](String/ValidateUrl.js) * [ZFunction](String/ZFunction.js) * **Timing-Functions** * [GetMonthDays](Timing-Functions/GetMonthDays.js) diff --git a/Data-Structures/Graph/test/Graph2.test.js b/Data-Structures/Graph/test/Graph2.test.js index 91473214ee..6d6816a8dc 100644 --- a/Data-Structures/Graph/test/Graph2.test.js +++ b/Data-Structures/Graph/test/Graph2.test.js @@ -5,9 +5,7 @@ describe('Test Graph2', () => { const graph = new Graph(vertices.length) // adding vertices - for (let i = 0; i < vertices.length; i++) { - graph.addVertex(vertices[i]) - } + vertices.forEach((vertice) => graph.addVertex(vertice)) // adding edges graph.addEdge('A', 'B') @@ -27,7 +25,7 @@ describe('Test Graph2', () => { expect(mockFn.mock.calls.length).toBe(vertices.length) // Collect adjacency lists from output (call args) - const adjListArr = mockFn.mock.calls.map(v => v[0]) + const adjListArr = mockFn.mock.calls.map((v) => v[0]) expect(adjListArr).toEqual([ 'A -> B D E ', diff --git a/Data-Structures/Heap/MinPriorityQueue.js b/Data-Structures/Heap/MinPriorityQueue.js index 5b543ce94f..1c420b6c71 100644 --- a/Data-Structures/Heap/MinPriorityQueue.js +++ b/Data-Structures/Heap/MinPriorityQueue.js @@ -47,8 +47,7 @@ class MinPriorityQueue { // returns boolean value whether the heap is full or not isFull () { - if (this.size === this.capacity) return true - return false + return this.size === this.capacity } // prints the heap diff --git a/Data-Structures/Tree/Trie.js b/Data-Structures/Tree/Trie.js index 90d7944f6b..69ae48a076 100644 --- a/Data-Structures/Tree/Trie.js +++ b/Data-Structures/Tree/Trie.js @@ -106,8 +106,8 @@ Trie.prototype.contains = function (word) { // find the node with given prefix const node = this.findPrefix(word) // No such word exists - if (node === null || node.count === 0) return false - return true + + return node !== null && node.count !== 0 } Trie.prototype.findOccurrences = function (word) { diff --git a/Dynamic-Programming/FindMonthCalendar.js b/Dynamic-Programming/FindMonthCalendar.js index 16d847c06f..6070cb11db 100644 --- a/Dynamic-Programming/FindMonthCalendar.js +++ b/Dynamic-Programming/FindMonthCalendar.js @@ -3,6 +3,7 @@ * And prints out the month's calendar. * It uses an epoch of 1/1/1900, Monday. */ +import { isLeapYear } from '../Maths/LeapYear' class Month { constructor () { @@ -51,11 +52,6 @@ class Month { return dateOb } - isLeapYear (year) { - if (((year % 400) === 0) || (((year % 100) !== 0) && ((year % 4) === 0))) return true - return false - } - isGreater (startDate, endDate) { if (startDate.year > endDate.year) { return true @@ -79,16 +75,16 @@ class Month { } let diff = 0 while (startDate.year !== endDate.year) { - diff += (this.isLeapYear(startDate.year)) ? 366 : 365 + diff += (isLeapYear(startDate.year)) ? 366 : 365 startDate.year = startDate.year + 1 } while (startDate.month !== endDate.month) { if (startDate.month < endDate.month) { - if (this.isLeapYear(startDate.year)) diff += this.monthDaysLeap[startDate.month] + if (isLeapYear(startDate.year)) diff += this.monthDaysLeap[startDate.month] else diff += this.monthDays[startDate.month] startDate.month = startDate.month + 1 } else { - if (this.isLeapYear(startDate.year)) diff -= this.monthDaysLeap[startDate.month - 1] + if (isLeapYear(startDate.year)) diff -= this.monthDaysLeap[startDate.month - 1] else diff -= this.monthDays[startDate.month - 1] startDate.month = startDate.month - 1 } @@ -103,7 +99,7 @@ class Month { let Month2 = this.parseDate(date) day = (this.isGreater(Month2, this.epoch)) ? this.Days[difference] : this.BDays[difference] Month2 = this.parseDate(date) - if (this.isLeapYear(Month2.year)) this.printCal(this.monthDaysLeap[Month2.month], day) + if (isLeapYear(Month2.year)) this.printCal(this.monthDaysLeap[Month2.month], day) else this.printCal(this.monthDays[Month2.month], day) } } diff --git a/Graphs/DijkstraSmallestPath.js b/Graphs/DijkstraSmallestPath.js index 81ee9767f3..10ada1f236 100644 --- a/Graphs/DijkstraSmallestPath.js +++ b/Graphs/DijkstraSmallestPath.js @@ -41,70 +41,3 @@ function solve (graph, s) { } export { solve } - -// // create graph -// const graph = {} - -// const layout = { -// R: ['2'], -// 2: ['3', '4'], -// 3: ['4', '6', '13'], -// 4: ['5', '8'], -// 5: ['7', '11'], -// 6: ['13', '15'], -// 7: ['10'], -// 8: ['11', '13'], -// 9: ['14'], -// 10: [], -// 11: ['12'], -// 12: [], -// 13: ['14'], -// 14: [], -// 15: [] -// } - -// // convert uni-directional to bi-directional graph -// let graph = { -// a: {e:1, b:1, g:3}, -// b: {a:1, c:1}, -// c: {b:1, d:1}, -// d: {c:1, e:1}, -// e: {d:1, a:1}, -// f: {g:1, h:1}, -// g: {a:3, f:1}, -// h: {f:1} -// }; - -// for (const id in layout) { -// if (!graph[id]) { graph[id] = {} } -// layout[id].forEach(function (aid) { -// graph[id][aid] = 1 -// if (!graph[aid]) { graph[aid] = {} } -// graph[aid][id] = 1 -// }) -// } - -// // choose start node -// const start = '10' -// // get all solutions -// const solutions = solve(graph, start) - -// // for s in solutions.. -// ' -> ' + s + ': [' + solutions[s].join(', ') + '] (dist:' + solutions[s].dist + ')' - -// From '10' to -// -> 2: [7, 5, 4, 2] (dist:4) -// -> 3: [7, 5, 4, 3] (dist:4) -// -> 4: [7, 5, 4] (dist:3) -// -> 5: [7, 5] (dist:2) -// -> 6: [7, 5, 4, 3, 6] (dist:5) -// -> 7: [7] (dist:1) -// -> 8: [7, 5, 4, 8] (dist:4) -// -> 9: [7, 5, 4, 3, 13, 14, 9] (dist:7) -// -> 10: [] (dist:0) -// -> 11: [7, 5, 11] (dist:3) -// -> 12: [7, 5, 11, 12] (dist:4) -// -> 13: [7, 5, 4, 3, 13] (dist:5) -// -> 14: [7, 5, 4, 3, 13, 14] (dist:6) -// -> 15: [7, 5, 4, 3, 6, 15] (dist:6) -// -> R: [7, 5, 4, 2, R] (dist:5) diff --git a/Maths/LeapYear.js b/Maths/LeapYear.js index bddcea7afc..4aa94024e6 100644 --- a/Maths/LeapYear.js +++ b/Maths/LeapYear.js @@ -14,9 +14,5 @@ * @returns {boolean} true if this is a leap year, false otherwise. */ export const isLeapYear = (year) => { - if (year % 400 === 0) return true - if (year % 100 === 0) return false - if (year % 4 === 0) return true - - return false + return ((year % 400) === 0) || (((year % 100) !== 0) && ((year % 4) === 0)) } diff --git a/Maths/MatrixMultiplication.js b/Maths/MatrixMultiplication.js index 739b6b1988..bddb5b1ec4 100644 --- a/Maths/MatrixMultiplication.js +++ b/Maths/MatrixMultiplication.js @@ -20,12 +20,9 @@ const matrixCheck = (matrix) => { // tests to see if the matrices have a like side, i.e. the row length on the first matrix matches the column length on the second matrix, or vice versa. const twoMatricesCheck = (first, second) => { const [firstRowLength, secondRowLength, firstColLength, secondColLength] = [first.length, second.length, matrixCheck(first), matrixCheck(second)] - if (firstRowLength !== secondColLength || secondRowLength !== firstColLength) { - // These matrices do not have a common side - return false - } else { - return true - } + + // These matrices do not have a common side + return firstRowLength === secondColLength && secondRowLength === firstColLength } // returns an empty array that has the same number of rows as the left matrix being multiplied. diff --git a/Maths/MidpointIntegration.js b/Maths/MidpointIntegration.js index 175875a47e..8e3fa61eb2 100644 --- a/Maths/MidpointIntegration.js +++ b/Maths/MidpointIntegration.js @@ -41,8 +41,7 @@ function integralEvaluation (N, a, b, func) { // Calculate the integral let result = h - temp = 0 - for (let i = 0; i < pointsArray.length; i++) temp += pointsArray[i] + temp = pointsArray.reduce((acc, currValue) => acc + currValue, 0) result *= temp diff --git a/Maths/SimpsonIntegration.js b/Maths/SimpsonIntegration.js index b9aa5ade17..5ec41a89f3 100644 --- a/Maths/SimpsonIntegration.js +++ b/Maths/SimpsonIntegration.js @@ -54,8 +54,7 @@ function integralEvaluation (N, a, b, func) { // Calculate the integral let result = h / 3 - temp = 0 - for (let i = 0; i < pointsArray.length; i++) temp += pointsArray[i] + temp = pointsArray.reduce((acc, currValue) => acc + currValue, 0) result *= temp diff --git a/String/CheckRearrangePalindrome.js b/String/CheckRearrangePalindrome.js index 2f0e698ef2..f8ea2ccb23 100644 --- a/String/CheckRearrangePalindrome.js +++ b/String/CheckRearrangePalindrome.js @@ -12,7 +12,7 @@ export const palindromeRearranging = (str) => { return 'Not a string' } // Check if is a empty string - if (str.length === 0) { + if (!str) { return 'Empty string' } From 9757e2bee33f883b1098d4975464980526b41ca3 Mon Sep 17 00:00:00 2001 From: Nikhil k <83801330+nikhil18440@users.noreply.github.com> Date: Tue, 19 Sep 2023 16:40:32 +0530 Subject: [PATCH 015/122] fixed typo (#1363) Co-authored-by: unknown --- Backtracking/AllCombinationsOfSizeK.js | 2 +- Data-Structures/Array/LocalMaximomPoint.js | 2 +- Data-Structures/Graph/Graph2.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Backtracking/AllCombinationsOfSizeK.js b/Backtracking/AllCombinationsOfSizeK.js index c02288d1b6..77ddd54f86 100644 --- a/Backtracking/AllCombinationsOfSizeK.js +++ b/Backtracking/AllCombinationsOfSizeK.js @@ -2,7 +2,7 @@ Problem: Given two numbers, n and k, make all unique combinations of k numbers from 1 to n and in sorted order What is combinations? - - Combinations is selecting items from a collections without considering order of selection + - Combinations is selecting items from a collections without considering the order of selection Example: - We have an apple, a banana, and a jackfruit diff --git a/Data-Structures/Array/LocalMaximomPoint.js b/Data-Structures/Array/LocalMaximomPoint.js index de136c21f1..b51e809ce2 100644 --- a/Data-Structures/Array/LocalMaximomPoint.js +++ b/Data-Structures/Array/LocalMaximomPoint.js @@ -3,7 +3,7 @@ * * Notes: * - works by using divide and conquer - * - the function gets the array A with n Real numbers and returns the local max point index (if more than one exists return the first one) + * - the function gets the array A with n Real numbers and returns the index of local max point (if more than one exists return the first one) * * @complexity: O(log(n)) (on average ) * @complexity: O(log(n)) (worst case) diff --git a/Data-Structures/Graph/Graph2.js b/Data-Structures/Graph/Graph2.js index 9defc1438d..3c360f7a1d 100644 --- a/Data-Structures/Graph/Graph2.js +++ b/Data-Structures/Graph/Graph2.js @@ -42,7 +42,7 @@ class Graph { // iterate over the vertices for (const i of getKeys) { - // great the corresponding adjacency list + // get the corresponding adjacency list // for the vertex const getValues = this.AdjList.get(i) let conc = '' From 268796b0e8df235a53511dc593d3af47c2e1f1f1 Mon Sep 17 00:00:00 2001 From: Madhurendra Nath Tiwari <68775519+dev-madhurendra@users.noreply.github.com> Date: Tue, 19 Sep 2023 20:29:34 +0530 Subject: [PATCH 016/122] added fibonacci using formula along with test cases (#1358) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * added fibonacci using formula along with test cases * updated the changes * added jest's each in test cases * added jest's each for testing * returned inline value * removed redundant comment * hoisted the variables * Use shorthand * considered adding resource of the formula --------- Co-authored-by: madhuredra Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --- Maths/Fibonacci.js | 11 +++++++++++ Maths/test/Fibonacci.test.js | 10 +++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Maths/Fibonacci.js b/Maths/Fibonacci.js index fc8102ad2c..998c753027 100644 --- a/Maths/Fibonacci.js +++ b/Maths/Fibonacci.js @@ -187,9 +187,20 @@ const FibonacciMatrixExpo = (num) => { return F[0][0] * (isNeg ? (-ONE) ** (num + ONE) : ONE) } +/* + Resource : https://math.hmc.edu/funfacts/fibonacci-number-formula/ +*/ + +const sqrt5 = Math.sqrt(5) +const phi = (1 + sqrt5) / 2 +const psi = (1 - sqrt5) / 2 + +const FibonacciUsingFormula = n => Math.round((phi ** n - psi ** n) / sqrt5) + export { FibonacciDpWithoutRecursion } export { FibonacciIterative } export { FibonacciGenerator } export { FibonacciRecursive } export { FibonacciRecursiveDP } export { FibonacciMatrixExpo } +export { FibonacciUsingFormula } diff --git a/Maths/test/Fibonacci.test.js b/Maths/test/Fibonacci.test.js index f3dcb98fe7..f91aef73d2 100644 --- a/Maths/test/Fibonacci.test.js +++ b/Maths/test/Fibonacci.test.js @@ -4,7 +4,8 @@ import { FibonacciIterative, FibonacciGenerator, FibonacciRecursive, - FibonacciMatrixExpo + FibonacciMatrixExpo, + FibonacciUsingFormula } from '../Fibonacci' describe('Fibonacci', () => { @@ -95,4 +96,11 @@ describe('Fibonacci', () => { expect(FibonacciMatrixExpo(-5n)).toBe(5n) expect(FibonacciMatrixExpo(-6n)).toBe(-8n) }) + it.each([ + [0, 0], + [1, 1], + [15, 610] + ])('should calculate the correct Fibonacci number for n = %i', (n, expected) => { + expect(FibonacciUsingFormula(n)).toBe(expected) + }) }) From 6ad5b9c2b173ca503a8ecbc38070d5fab312a688 Mon Sep 17 00:00:00 2001 From: Madhurendra Nath Tiwari <68775519+dev-madhurendra@users.noreply.github.com> Date: Fri, 22 Sep 2023 13:49:13 +0530 Subject: [PATCH 017/122] added numberOfDigitsUsingLog method (#1364) * added numberOfDigitsUsingLog method * added JSDoc comment --------- Co-authored-by: madhuredra --- Maths/NumberOfDigits.js | 12 +++++++++++- Maths/test/NumberOfDigits.test.js | 11 ++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Maths/NumberOfDigits.js b/Maths/NumberOfDigits.js index 6414c65deb..f2ef656433 100644 --- a/Maths/NumberOfDigits.js +++ b/Maths/NumberOfDigits.js @@ -9,4 +9,14 @@ const numberOfDigit = (n) => Math.abs(n).toString().length -export { numberOfDigit } +/** + * Returns the number of digits of a given integer. + * + * @param {number} n - The integer for which to count digits. + * @returns {number} The number of digits in the integer. + * @see https://math.stackexchange.com/questions/2145480/how-does-the-logarithm-returns-the-number-of-digits-of-a-number + * @author dev-madhurendra + */ +const numberOfDigitsUsingLog = (n) => n === 0 ? 1 : Math.floor(Math.log10(Math.abs(n))) + 1 + +export { numberOfDigit, numberOfDigitsUsingLog } diff --git a/Maths/test/NumberOfDigits.test.js b/Maths/test/NumberOfDigits.test.js index 631e2cce36..bf832c8691 100644 --- a/Maths/test/NumberOfDigits.test.js +++ b/Maths/test/NumberOfDigits.test.js @@ -1,4 +1,4 @@ -import { numberOfDigit } from '../NumberOfDigits' +import { numberOfDigit, numberOfDigitsUsingLog } from '../NumberOfDigits' describe('NumberOfDigits', () => { it('should return the correct number of digits for an integer', () => { @@ -8,4 +8,13 @@ describe('NumberOfDigits', () => { it('should return the correct number of digits for a negative number', () => { expect(numberOfDigit(-2346243)).toBe(7) }) + + it.each([ + [0, 1], + [123423232, 9], + [-123423232, 9], + [9999, 4] + ])('should return the correct number of digits in an integer', (value, expected) => { + expect(numberOfDigitsUsingLog(value)).toBe(expected) + }) }) From 4fe8a67ea617d10655d02def01198187dac5fa0f Mon Sep 17 00:00:00 2001 From: Madhurendra Nath Tiwari <68775519+dev-madhurendra@users.noreply.github.com> Date: Fri, 22 Sep 2023 14:51:29 +0530 Subject: [PATCH 018/122] added algo for checking the number is power of four or not (#1360) * added algo for checking the number is power of four or not * Update IsPowerofFour.js * Update IsPowerofFour.js * fix code style * used proper JSDoc comment and fixed test issues * fixed test case issue --------- Co-authored-by: madhuredra --- Bit-Manipulation/IsPowerofFour.js | 17 +++++++++++++++++ Bit-Manipulation/test/IsPowerOfFour.test.js | 14 ++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 Bit-Manipulation/IsPowerofFour.js create mode 100644 Bit-Manipulation/test/IsPowerOfFour.test.js diff --git a/Bit-Manipulation/IsPowerofFour.js b/Bit-Manipulation/IsPowerofFour.js new file mode 100644 index 0000000000..38431f9242 --- /dev/null +++ b/Bit-Manipulation/IsPowerofFour.js @@ -0,0 +1,17 @@ +/** + * @author : dev-madhurendra + * Checks whether the given number is a power of four or not. + * + * A number is considered a power of four if and only if there is a single '1' bit in its binary representation, + * and that '1' bit is at the first position, followed by an even number of '0' bits. + * + * @param {number} n - The input number to check. + * @returns {boolean} True if the number is a power of four, false otherwise. + * + * @example + * const result = isPowerOfFour(16); // Returns true (16 is 4^2) + * const result2 = isPowerOfFour(5); // Returns false (5 is not a power of four) + */ +const isPowerOfFour = (n) => ((n > 0) && ((n & n - 1) === 0) && (n % 3 === 1)) + +export { isPowerOfFour } diff --git a/Bit-Manipulation/test/IsPowerOfFour.test.js b/Bit-Manipulation/test/IsPowerOfFour.test.js new file mode 100644 index 0000000000..5bd666fadd --- /dev/null +++ b/Bit-Manipulation/test/IsPowerOfFour.test.js @@ -0,0 +1,14 @@ +import { isPowerOfFour } from '../IsPowerofFour' + +describe('IsPowerOfFour', () => { + it.each([ + [0, false], + [4, true], + [16, true], + [12, false], + [64, true], + [-64, false] + ])('should return the number is power of four or not', (n, expected) => { + expect(isPowerOfFour(n)).toBe(expected) + }) +}) From f5188ddf16ae0e0e2cb300e3749ab37fbda042af Mon Sep 17 00:00:00 2001 From: Madhurendra Nath Tiwari <68775519+dev-madhurendra@users.noreply.github.com> Date: Fri, 22 Sep 2023 14:52:11 +0530 Subject: [PATCH 019/122] added an algo which finds unique element in an array (#1359) * added an algo which finds unique element in an array * fixed code style * updated changes and add some explanations * Delete package-lock.json * Delete package.json * added question link if anyone want to solve * updated changes * added package.json * used JSDoc comment --------- Co-authored-by: madhuredra --- Bit-Manipulation/UniqueElementInAnArray.js | 13 +++++++++++++ .../test/UniqueElementInAnArray.test.js | 10 ++++++++++ 2 files changed, 23 insertions(+) create mode 100644 Bit-Manipulation/UniqueElementInAnArray.js create mode 100644 Bit-Manipulation/test/UniqueElementInAnArray.test.js diff --git a/Bit-Manipulation/UniqueElementInAnArray.js b/Bit-Manipulation/UniqueElementInAnArray.js new file mode 100644 index 0000000000..74b5fe95a9 --- /dev/null +++ b/Bit-Manipulation/UniqueElementInAnArray.js @@ -0,0 +1,13 @@ +/** + * Finds the unique element in an array where all other elements are repeated twice. + * + * @param {number[]} arr - The input array of integers. + * @returns {number} The unique element. + * + * @example + * const arr = [1, 2, 1, 2, 3]; + * const uniqueElement = findUniqueElement(arr); // Returns 3 + */ +const findUniqueElement = (arr) => arr.reduce((acc, val) => acc ^ val, 0) + +export { findUniqueElement } diff --git a/Bit-Manipulation/test/UniqueElementInAnArray.test.js b/Bit-Manipulation/test/UniqueElementInAnArray.test.js new file mode 100644 index 0000000000..4aa66bc8b7 --- /dev/null +++ b/Bit-Manipulation/test/UniqueElementInAnArray.test.js @@ -0,0 +1,10 @@ +import { findUniqueElement } from '../UniqueElementInAnArray' + +describe('UniqueElementInAnArray', () => { + it.each([ + [[1, 2, 1, 3, 3], 2], + [[1, 2, 3, 4, 5, 4, 3, 2, 1], 5] + ])('should return an unique element from an array', (arr, expected) => { + expect(findUniqueElement(arr)).toBe(expected) + }) +}) From 6362cc967a43971c56299aa8515568d21939132b Mon Sep 17 00:00:00 2001 From: Madhurendra Nath Tiwari <68775519+dev-madhurendra@users.noreply.github.com> Date: Sat, 23 Sep 2023 21:30:10 +0530 Subject: [PATCH 020/122] added an algo for checking the string i palindrome or not (#1366) Co-authored-by: madhuredra --- Maths/Palindrome.js | 15 ++++++++++++++- Maths/test/Palindrome.test.js | 11 ++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Maths/Palindrome.js b/Maths/Palindrome.js index 34804d34fb..f31e6aab15 100644 --- a/Maths/Palindrome.js +++ b/Maths/Palindrome.js @@ -45,4 +45,17 @@ const PalindromeIterative = (string) => { return true } -export { PalindromeIterative, PalindromeRecursive } +/** + * + * Checks if a string is a palindrome. + * @author dev-madhurendra + * @param {string} str - The string to check. + * @returns {boolean} True if the string is a palindrome, false otherwise. + * + * @example + * const isPalindrome = checkPalindrome('racecar'); // Returns true + * const isNotPalindrome = checkPalindrome('hello'); // Returns false + */ +const checkPalindrome = (str) => str.replace(/\s/g, '') === str.replace(/\s/g, '').split('').reverse().join('') + +export { PalindromeIterative, PalindromeRecursive, checkPalindrome } diff --git a/Maths/test/Palindrome.test.js b/Maths/test/Palindrome.test.js index 53cb883955..a8310e0a26 100644 --- a/Maths/test/Palindrome.test.js +++ b/Maths/test/Palindrome.test.js @@ -1,4 +1,4 @@ -import { PalindromeRecursive, PalindromeIterative } from '../Palindrome' +import { PalindromeRecursive, PalindromeIterative, checkPalindrome } from '../Palindrome' describe('Palindrome', () => { it('should return true for a palindrome for PalindromeRecursive', () => { @@ -13,4 +13,13 @@ describe('Palindrome', () => { it('should return true for a non-palindrome for PalindromeIterative', () => { expect(PalindromeIterative('JavaScript')).toBeFalsy() }) + + it.each([ + ['radar', true], + ['hello', false], + ['r', true], + [' racecar ', true] + ])('should return value is palindrome or not', (value, expected) => { + expect(checkPalindrome(value)).toBe(expected) + }) }) From 394483bff741d41fc59531f87fafec32135023a0 Mon Sep 17 00:00:00 2001 From: Madhurendra Nath Tiwari <68775519+dev-madhurendra@users.noreply.github.com> Date: Sat, 23 Sep 2023 21:37:30 +0530 Subject: [PATCH 021/122] added contributor graph to the readme (#1367) Co-authored-by: madhuredra --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 758bb5a040..6db1c2266a 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,6 @@ JavaScript Repository of TheAlgorithms, which implements various algorithms and [![standard.js][standard-logo]][standard-js] [![Discord chat][chat]][discord-server] - --- @@ -47,7 +46,6 @@ many of the algorithms can be found in the [wiki][explanation]. [chat]: https://img.shields.io/discord/808045925556682782.svg?logo=discord&colorB=7289DA [welcome]: https://img.shields.io/static/v1.svg?label=Contributions&message=Welcome&color=0059b3 [checks]: https://img.shields.io/github/actions/workflow/status/TheAlgorithms/JavaScript/Ci.yml?branch=master&label=checks -[grade]: https://img.shields.io/lgtm/grade/javascript/g/TheAlgorithms/JavaScript.svg?logo=lgtm&logoWidth=18 [standard-js]: https://standardjs.com/ @@ -56,3 +54,9 @@ many of the algorithms can be found in the [wiki][explanation]. [explanation]: https://github.com/TheAlgorithms/JavaScript/wiki [repositories]: https://github.com/orgs/TheAlgorithms/repositories [help-wanted]: https://github.com/TheAlgorithms/JavaScript/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22 + +## Thanks to all the contributors ❤️ + + + + From 964ba049d7ab45f65f25923299af299894494a23 Mon Sep 17 00:00:00 2001 From: Ayush shah Date: Sat, 30 Sep 2023 17:35:27 +0530 Subject: [PATCH 022/122] fix: optimised armstrongNumber code (#1374) --- Maths/ArmstrongNumber.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Maths/ArmstrongNumber.js b/Maths/ArmstrongNumber.js index a3ab78299f..8f861d8c15 100644 --- a/Maths/ArmstrongNumber.js +++ b/Maths/ArmstrongNumber.js @@ -9,16 +9,13 @@ */ const armstrongNumber = (num) => { - if (num < 0 || typeof num !== 'number') return false - - let newSum = 0 - - const numArr = num.toString().split('') - numArr.forEach((num) => { - newSum += parseInt(num) ** numArr.length - }) - - return newSum === num + if (typeof num !== 'number' || num < 0) return false + const numStr = num.toString() + const sum = [...numStr].reduce( + (acc, digit) => acc + parseInt(digit) ** numStr.length, + 0 + ) + return sum === num } export { armstrongNumber } From 0604d06ac6539d641cb12bd094a5df9b7862f819 Mon Sep 17 00:00:00 2001 From: Ayush shah Date: Mon, 2 Oct 2023 12:34:43 +0530 Subject: [PATCH 023/122] fix: Average Median code cleanup (#1388) --- Maths/AverageMedian.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/Maths/AverageMedian.js b/Maths/AverageMedian.js index 3be6c551fc..f8f6c64b14 100644 --- a/Maths/AverageMedian.js +++ b/Maths/AverageMedian.js @@ -9,22 +9,14 @@ */ const averageMedian = (sourceArrayOfNumbers) => { - let numbers = [...sourceArrayOfNumbers] - let median = 0 + const numbers = [...sourceArrayOfNumbers].sort(sortNumbers) const numLength = numbers.length - numbers = numbers.sort(sortNumbers) - if (numLength % 2 === 0) { - median = (numbers[numLength / 2 - 1] + numbers[numLength / 2]) / 2 - } else { - median = numbers[(numLength - 1) / 2] - } - - return median + return numLength % 2 === 0 + ? (numbers[numLength / 2 - 1] + numbers[numLength / 2]) / 2 + : numbers[Math.floor(numLength / 2)] } -const sortNumbers = (num1, num2) => { - return num1 - num2 -} +const sortNumbers = (num1, num2) => num1 - num2 export { averageMedian } From 6291d4b6118cbb7e205b6b3816258dd1627dad10 Mon Sep 17 00:00:00 2001 From: Aakash Giri Date: Mon, 2 Oct 2023 12:35:39 +0530 Subject: [PATCH 024/122] feat: Add Length Conversion (#1390) --- Conversions/LengthConversion.js | 38 ++++++++++++++++ Conversions/test/LengthConversion.test.js | 53 +++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 Conversions/LengthConversion.js create mode 100644 Conversions/test/LengthConversion.test.js diff --git a/Conversions/LengthConversion.js b/Conversions/LengthConversion.js new file mode 100644 index 0000000000..36aedd416c --- /dev/null +++ b/Conversions/LengthConversion.js @@ -0,0 +1,38 @@ +/** + * Converts a length from one unit to another. + * + * @param {number} length - The length to convert. + * @param {string} fromUnit - The unit to convert from (e.g., "km", "m", "cm"). + * @param {string} toUnit - The unit to convert to (e.g., "km", "m", "cm"). + * @returns {number} The converted length. + * @throws {Error} If the units are invalid or not found in the conversion dictionary. + */ + +const lengthConversion = (length, fromUnit, toUnit) => { + // Define a dictionary to map units to meters + const meters = { + mm: 0.001, + cm: 0.01, + m: 1, + km: 1000, + inch: 0.0254, + ft: 0.3048, + yd: 0.9144, + mi: 1609.34 + } + + // Check if the units are in the dictionary, otherwise, throw an error + if (!(fromUnit in meters) || !(toUnit in meters)) { + throw new Error('Invalid units') + } + + // Perform the conversion + const metersFrom = length * meters[fromUnit] + const convertedLength = metersFrom / meters[toUnit] + + return convertedLength +} + +export { + lengthConversion +} diff --git a/Conversions/test/LengthConversion.test.js b/Conversions/test/LengthConversion.test.js new file mode 100644 index 0000000000..7618cb0b20 --- /dev/null +++ b/Conversions/test/LengthConversion.test.js @@ -0,0 +1,53 @@ +import { lengthConversion } from '../LengthConversion.js' + +describe('LengthConversion', () => { + it.each` + length | fromUnit | toUnit | expected + ${10} | ${'km'} | ${'m'} | ${10000} + ${100} | ${'m'} | ${'km'} | ${0.1} + ${5} | ${'cm'} | ${'mm'} | ${50} + ${12} | ${'ft'} | ${'inch'}| ${144.00000000000003} + `( + 'converts $length $fromUnit to $toUnit', + ({ length, fromUnit, toUnit, expected }) => { + try { + const result = lengthConversion(length, fromUnit, toUnit) + expect(result).toBe(expected) + } catch (error) { + expect(error).toBeUndefined() + } + } + ) + + it.each` + length | fromUnit | toUnit | expected + ${10} | ${'m'} | ${'km'} | ${0.01} + ${1000}| ${'mm'} | ${'cm'} | ${100} + ${1} | ${'inch'}| ${'ft'} | ${0.08333333333} + `( + 'converts $length $fromUnit to $toUnit (vice versa)', + ({ length, fromUnit, toUnit, expected }) => { + try { + const result = lengthConversion(length, fromUnit, toUnit) + expect(result).toBeCloseTo(expected, 10) // Close comparison due to floating-point precision + } catch (error) { + expect(error).toBeUndefined() + } + } + ) + + it.each` + length | fromUnit | toUnit | expectedError + ${10} | ${'km'} | ${'invalid'} | ${'Invalid units'} + ${5} | ${'invalid'} | ${'m'} | ${'Invalid units'} + `( + 'returns error message for invalid units: $fromUnit to $toUnit', + ({ length, fromUnit, toUnit, expectedError }) => { + try { + lengthConversion(length, fromUnit, toUnit) + } catch (error) { + expect(error.message).toBe(expectedError) + } + } + ) +}) From 7ff3e5e49ea44e97c3a020613222e69d5a5a57a1 Mon Sep 17 00:00:00 2001 From: Roland Hummel Date: Mon, 2 Oct 2023 09:08:14 +0200 Subject: [PATCH 025/122] test: skip test that's running way too long (#1393) * test: skip test that's running way too long It's good to have the test there, but there's no use having it running for ~30 minutes or so in the GitHub Action close #1193 * Updated Documentation in README.md --------- Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> --- DIRECTORY.md | 3 +++ Project-Euler/test/Problem044.test.js | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DIRECTORY.md b/DIRECTORY.md index 4f1c033352..2d70c5d6a2 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -9,10 +9,12 @@ * [SumOfSubset](Backtracking/SumOfSubset.js) * **Bit-Manipulation** * [BinaryCountSetBits](Bit-Manipulation/BinaryCountSetBits.js) + * [IsPowerofFour](Bit-Manipulation/IsPowerofFour.js) * [IsPowerOfTwo](Bit-Manipulation/IsPowerOfTwo.js) * [LogTwo](Bit-Manipulation/LogTwo.js) * [NextPowerOfTwo](Bit-Manipulation/NextPowerOfTwo.js) * [SetBit](Bit-Manipulation/SetBit.js) + * [UniqueElementInAnArray](Bit-Manipulation/UniqueElementInAnArray.js) * **Cache** * [LFUCache](Cache/LFUCache.js) * [LRUCache](Cache/LRUCache.js) @@ -270,6 +272,7 @@ * [Problem017](Project-Euler/Problem017.js) * [Problem018](Project-Euler/Problem018.js) * [Problem020](Project-Euler/Problem020.js) + * [Problem021](Project-Euler/Problem021.js) * [Problem023](Project-Euler/Problem023.js) * [Problem025](Project-Euler/Problem025.js) * [Problem028](Project-Euler/Problem028.js) diff --git a/Project-Euler/test/Problem044.test.js b/Project-Euler/test/Problem044.test.js index b542b3db6d..e1eeae0e6c 100644 --- a/Project-Euler/test/Problem044.test.js +++ b/Project-Euler/test/Problem044.test.js @@ -12,8 +12,8 @@ describe('checking nth prime number', () => { expect(problem44(1)).toBe(5482660) }) // Project Euler Second Value for Condition Check - // FIXME skip this test for now because it runs very long and clogs up the CI & pre-commit hook - test('if the number is greater or equal to 2167', () => { + // Skipping this by default as it makes CI runs take way too long + test.skip('if the number is greater or equal to 2167', () => { expect(problem44(2167)).toBe(8476206790) }) }) From f271a2cae01c5733b6cb67231157d25c38318527 Mon Sep 17 00:00:00 2001 From: Dibya12345 <48878439+Dibya12345@users.noreply.github.com> Date: Mon, 2 Oct 2023 12:42:39 +0530 Subject: [PATCH 026/122] Added QuadraticRoots to Math/QuadraticRoots.js (#1376) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added QuadraticRoots in the Math/QuadraticRoots * Fixed math/QyadraticRoots var to let * Added relevant links math/QyadraticRoots * Added relevant links math/QyadraticRoots and fixed let - const * Added the changes and @see notation in Math/QuadraticRoots.js * Added the changes Math/QuadraticRoots.js and return an empty [] * Readd describe block, remove redundant comments * Changed [1,1] to [1] --------- Co-authored-by: Dibya Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --- Maths/QuadraticRoots.js | 37 +++++++++++++++++++++++++++++++ Maths/test/QuadraticRoots.test.js | 13 +++++++++++ 2 files changed, 50 insertions(+) create mode 100644 Maths/QuadraticRoots.js create mode 100644 Maths/test/QuadraticRoots.test.js diff --git a/Maths/QuadraticRoots.js b/Maths/QuadraticRoots.js new file mode 100644 index 0000000000..a6b52cf1a9 --- /dev/null +++ b/Maths/QuadraticRoots.js @@ -0,0 +1,37 @@ +/** + * @see https://www.cuemath.com/algebra/roots-of-quadratic-equation/ + * @author Dibya Debayan Dash + * Calculates the roots of a quadratic equation of the form ax^2 + bx + c = 0. + * + * @param {number} a - Coefficient of x^2. + * @param {number} b - Coefficient of x. + * @param {number} c - Constant term. + * @returns {number[]} - An array containing the roots if they are real, + * or an empty array indicating no real roots. + * + * @example + * // Find the roots of the quadratic equation: 2x^2 - 4x + 2 = 0 + * const roots = quadraticRoots(2, -4, 2); + * // Expected output: [1] + */ +const quadraticRoots = (a, b, c) => { + // Calculate the discriminant + const discriminant = b * b - 4 * a * c + + // Check if roots are real + if (discriminant < 0) { + return [] + } else if (discriminant === 0) { + // One real root + return [-b / (2 * a)] + } else { + // Two real roots + const sqrtDiscriminant = Math.sqrt(discriminant) + return [ + (-b + sqrtDiscriminant) / (2 * a), + (-b - sqrtDiscriminant) / (2 * a) + ] + } +} + +export { quadraticRoots } diff --git a/Maths/test/QuadraticRoots.test.js b/Maths/test/QuadraticRoots.test.js new file mode 100644 index 0000000000..bd0db43c15 --- /dev/null +++ b/Maths/test/QuadraticRoots.test.js @@ -0,0 +1,13 @@ +import { quadraticRoots } from '../QuadraticRoots.js' + +describe('quadratic roots', () => { + it('returns an array with two real roots when the discriminant is positive', () => { + expect(quadraticRoots(1, -3, 2)).toEqual([2, 1]) + }) + it('returns an array with one real root when the discriminant is zero', () => { + expect(quadraticRoots(1, -2, 1)).toEqual([1]) + }) + it('returns an empty array indicating no real roots when the discriminant is negative', () => { + expect(quadraticRoots(1, 2, 5)).toEqual([]) + }) +}) From b7836122ffbc0e37fd3441125832d4c59d6f52cb Mon Sep 17 00:00:00 2001 From: Roland Hummel Date: Mon, 2 Oct 2023 09:13:37 +0200 Subject: [PATCH 027/122] fix: ValidateURL failing tests (#1394) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test: remove ValidateUrl.test.js The code was removed with ecac786d but the test was left here (and has been failing since then, obviously 🤣) * test: remove conflicting test case There is another test case that explicitly expects the `null` result when the input array only contains one element. * Updated Documentation in README.md --------- Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> --- Maths/test/ParityOutlier.test.js | 5 ----- String/test/ValidateUrl.test.js | 14 -------------- 2 files changed, 19 deletions(-) delete mode 100644 String/test/ValidateUrl.test.js diff --git a/Maths/test/ParityOutlier.test.js b/Maths/test/ParityOutlier.test.js index ed3307dcd0..f4de9162b1 100644 --- a/Maths/test/ParityOutlier.test.js +++ b/Maths/test/ParityOutlier.test.js @@ -9,11 +9,6 @@ describe('Testing parityOutlier function', () => { expect(parityOutlier([177, 5, 76, 1919])).toBe(76) }) - it('should, if the given array has only one integer element, return the integer itself', () => { - expect(parityOutlier([83])).toBe(83) - expect(parityOutlier([54])).toBe(54) - }) - it('should, if the given array has only an odd and an even number, return the odd outlier', () => { expect(parityOutlier([1, 2])).toBe(1) expect(parityOutlier([4, 3])).toBe(3) diff --git a/String/test/ValidateUrl.test.js b/String/test/ValidateUrl.test.js deleted file mode 100644 index e19e46e0f5..0000000000 --- a/String/test/ValidateUrl.test.js +++ /dev/null @@ -1,14 +0,0 @@ -import { validateURL } from '../ValidateUrl' - -describe('ValidateUrl', () => { - it('expects to return false', () => { - expect(validateURL('google')).toEqual(false) - expect(validateURL('link: https://www.google.com')).toEqual(false) - }) - - it('expects to return true', () => { - expect(validateURL('http://www.google.com')).toEqual(true) - expect(validateURL('https://www.google.com')).toEqual(true) - expect(validateURL('www.google.com')).toEqual(true) - }) -}) From 36dcff8c5d69938b4f5fa7d7210d0596406b8966 Mon Sep 17 00:00:00 2001 From: P ABHIJIT <138318457+Abhijit-033@users.noreply.github.com> Date: Mon, 2 Oct 2023 22:18:20 +0530 Subject: [PATCH 028/122] =?UTF-8?q?feat:=20New=20String=20Algorithm=20for?= =?UTF-8?q?=20LengthofLongestSubstringWithoutRepeati=E2=80=A6=20(#1389)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: New String Algorithm for LengthofLongestSubstringWithoutRepeatingCharacters * Fixed Errors and Mistakes in New Algorithm LengthofLongestSubstringWithoutRepetition * fix:#1389 Errors Fixed * fix:#1389 Syntax and Code Errors Fixed * fix:#1389 Errors FIxed * Fixed All new errors * fix:1389 Implemented suggestions and corrections * Use @see annotation --------- Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --- ...ngthofLongestSubstringWithoutRepetition.js | 27 +++++++++++++++++++ ...fLongestSubstringWithoutRepetition.test.js | 26 ++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 String/LengthofLongestSubstringWithoutRepetition.js create mode 100644 String/test/LengthofLongestSubstringWithoutRepetition.test.js diff --git a/String/LengthofLongestSubstringWithoutRepetition.js b/String/LengthofLongestSubstringWithoutRepetition.js new file mode 100644 index 0000000000..42b5894b7c --- /dev/null +++ b/String/LengthofLongestSubstringWithoutRepetition.js @@ -0,0 +1,27 @@ +/* + * @description : Given a string, the function finds the length of the longest substring without any repeating characters + * @param {String} str - The input string + * @returns {Number} The Length of the longest substring in a given string without repeating characters + * @example lengthOfLongestSubstring("abcabcbb") => 3 + * @example lengthOfLongestSubstring("bbbbb") => 1 + * @see https://leetcode.com/problems/longest-substring-without-repeating-characters/ + */ + +const lengthOfLongestSubstring = (s) => { + if (typeof s !== 'string') { + throw new TypeError('Invalid Input Type') + } + let maxLength = 0 + let start = 0 + const charMap = new Map() + for (let end = 0; end < s.length; end++) { + if (charMap.has(s[end])) { + start = Math.max(start, charMap.get(s[end]) + 1) + } + charMap.set(s[end], end) + maxLength = Math.max(maxLength, end - start + 1) + } + return maxLength +} + +export { lengthOfLongestSubstring } diff --git a/String/test/LengthofLongestSubstringWithoutRepetition.test.js b/String/test/LengthofLongestSubstringWithoutRepetition.test.js new file mode 100644 index 0000000000..81e475ced4 --- /dev/null +++ b/String/test/LengthofLongestSubstringWithoutRepetition.test.js @@ -0,0 +1,26 @@ +import { lengthOfLongestSubstring } from '../LengthofLongestSubstringWithoutRepetition' + +describe('LengthOfLongestSubstring', () => { + it('should throw error if parameter is not string', () => { + expect(() => lengthOfLongestSubstring(345)).toThrowError(TypeError) + expect(() => lengthOfLongestSubstring(true)).toThrowError(TypeError) + expect(() => lengthOfLongestSubstring(null)).toThrowError(TypeError) + }) + + it('should check substrings containing unique characters', () => { + expect(lengthOfLongestSubstring('abcabcbb')).toBe(3) + expect(lengthOfLongestSubstring('bbbbb')).toBe(1) + expect(lengthOfLongestSubstring('pwwkew')).toBe(3) + expect(lengthOfLongestSubstring(' ')).toBe(1) + expect(lengthOfLongestSubstring('abcdefghijklmnaaaaa')).toBe(13) + }) + + it('should give zero for empty strings', () => { + expect(lengthOfLongestSubstring('')).toBe(0) + }) + + it('should be case-sensitive', () => { + expect(lengthOfLongestSubstring('AaBbCc')).toBe(3) + expect(lengthOfLongestSubstring('AbCdEf')).toBe(6) + }) +}) From 0ca18c2b2c2562f6a8dbafd398c3c441d44a73c4 Mon Sep 17 00:00:00 2001 From: Madhurendra Nath Tiwari <68775519+dev-madhurendra@users.noreply.github.com> Date: Mon, 2 Oct 2023 23:06:45 +0530 Subject: [PATCH 029/122] fix: added reverse string inplace (#1406) Co-authored-by: madhuredra --- String/ReverseString.js | 25 +++++++++---------------- String/test/ReverseString.test.js | 31 +++++-------------------------- 2 files changed, 14 insertions(+), 42 deletions(-) diff --git a/String/ReverseString.js b/String/ReverseString.js index df4fa7ada4..17240e71d1 100644 --- a/String/ReverseString.js +++ b/String/ReverseString.js @@ -16,24 +16,17 @@ function ReverseStringIterative (string) { } /** - * JS disallows string mutation so we're actually a bit slower. * - * @complexity O(n) +* @author dev-madhurendra +* Reverses a number by converting it to a string. +* +* @param {string} str - The number to reverse. +* @returns {string} The reversed number. +* +* @example +* const reversed = reverseString("hello"); // Returns olleh */ -function ReverseStringIterativeInplace (string) { - if (typeof string !== 'string') { - throw new TypeError('The given value is not a string') - } - - const _string = string.split('') - for (let i = 0; i < Math.floor(_string.length / 2); i++) { - const first = _string[i] - _string[i] = _string[_string.length - 1 - i] - _string[_string.length - 1 - i] = first - } - - return _string.join('') -} +const ReverseStringIterativeInplace = (str) => [...str].reverse().join('') export { ReverseStringIterative, ReverseStringIterativeInplace } diff --git a/String/test/ReverseString.test.js b/String/test/ReverseString.test.js index b9f29a57bf..0b4478f2cb 100644 --- a/String/test/ReverseString.test.js +++ b/String/test/ReverseString.test.js @@ -35,31 +35,10 @@ describe('ReverseStringIterative', () => { }) describe('ReverseStringIterativeInplace', () => { - it('expects to reverse a simple string', () => { - expect(ReverseStringIterativeInplace('reverse')).toEqual('esrever') - expect(ReverseStringIterativeInplace('some')).toEqual('emos') - expect(ReverseStringIterativeInplace('string')).toEqual('gnirts') - expect(ReverseStringIterativeInplace('The Algorithms Javascript')).toEqual('tpircsavaJ smhtiroglA ehT') + it.each([ + ['hello', 'olleh'], + ['word', 'drow'] + ])('reverse of %s is %s', (value, expected) => { + expect(ReverseStringIterativeInplace(value)).toBe(expected) }) - - it('expects to reverse a simple string without capitalizing the first letter', () => { - expect(ReverseStringIterativeInplace('Javascript')).toEqual('tpircsavaJ') - }) - - it('expects to return an empty string given an empty string', () => { - expect(ReverseStringIterativeInplace('Javascript')).toEqual('tpircsavaJ') - }) - - it.each` - input - ${123456} - ${[1, 2, 3, 4, 5, 6]} - ${{ test: 'test' }} - ${null} - `( - 'expects to throw a type error given a value that is $input', - ({ input }) => { - expect(() => ReverseStringIterativeInplace(input)).toThrow('The given value is not a string') - } - ) }) From 86d333ee94d6ce3f71220d3bc90b56b50381ed7e Mon Sep 17 00:00:00 2001 From: Roland Hummel Date: Tue, 3 Oct 2023 23:08:19 +0200 Subject: [PATCH 030/122] feat: Test running overhaul, switch to Prettier & reformat everything (#1407) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Switch to Node 20 + Vitest * chore: migrate to vitest mock functions * chore: code style (switch to prettier) * test: re-enable long-running test Seems the switch to Node 20 and Vitest has vastly improved the code's and / or the test's runtime! see #1193 * chore: code style * chore: fix failing tests * Updated Documentation in README.md * Update contribution guidelines to state usage of Prettier * fix: set prettier printWidth back to 80 * chore: apply updated code style automatically * fix: set prettier line endings to lf again * chore: apply updated code style automatically --------- Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --- .github/workflows/Ci.yml | 7 +- ...UpdateDirectory.mjs => UpdateDirectory.js} | 2 +- .github/workflows/UpdateDirectory.yml | 5 +- .husky/pre-commit | 2 +- .prettierignore | 2 + Backtracking/AllCombinationsOfSizeK.js | 4 +- Backtracking/GeneratePermutations.js | 6 +- Backtracking/KnightTour.js | 18 +- Backtracking/NQueens.js | 12 +- Backtracking/RatInAMaze.js | 24 +- Backtracking/Sudoku.js | 25 +- .../tests/AllCombinationsOfSizeK.test.js | 15 +- .../tests/GenerateParentheses.test.js | 8 +- Backtracking/tests/NQueens.test.js | 4 +- Backtracking/tests/RatInAMaze.test.js | 27 +- Backtracking/tests/Sudoku.test.js | 4 +- Bit-Manipulation/BinaryCountSetBits.js | 2 +- Bit-Manipulation/IsPowerofFour.js | 2 +- CONTRIBUTING.md | 23 +- Cache/LFUCache.js | 110 +- Cache/LRUCache.js | 26 +- Cache/Memoize.js | 6 +- Cache/test/LFUCache.test.js | 6 +- Cache/test/Memoize.test.js | 6 +- Cache/test/cacheTest.js | 4 +- Cellular-Automata/ConwaysGameOfLife.js | 8 +- Cellular-Automata/Elementary.js | 16 +- .../test/ConwaysGameOfLife.test.js | 13 +- Cellular-Automata/test/Elementary.test.js | 92 +- Ciphers/AffineCipher.js | 14 +- Ciphers/KeyFinder.js | 25 +- Ciphers/KeywordShiftedAlphabet.js | 60 +- Ciphers/MorseCode.js | 27 +- Ciphers/ROT13.js | 2 +- Ciphers/VigenereCipher.js | 27 +- Ciphers/XORCipher.js | 4 +- Ciphers/test/CaesarCipher.test.js | 12 +- Ciphers/test/KeywordShiftedAlphabet.test.js | 26 +- Ciphers/test/MorseCode.test.js | 8 +- Ciphers/test/ROT13.test.js | 8 +- Ciphers/test/VigenereCipher.test.js | 26 +- Conversions/ArbitraryBase.js | 70 +- Conversions/ArrayBufferToBase64.js | 16 +- Conversions/Base64ToArrayBuffer.js | 5 +- Conversions/BinaryToDecimal.js | 4 +- Conversions/BinaryToHex.js | 48 +- Conversions/DateDayDifference.js | 37 +- Conversions/DateToDay.js | 19 +- Conversions/DecimalToBinary.js | 2 +- Conversions/DecimalToHex.js | 22 +- Conversions/DecimalToOctal.js | 4 +- Conversions/DecimalToRoman.js | 2 +- Conversions/HexToBinary.js | 42 +- Conversions/HexToDecimal.js | 29 +- Conversions/HexToRGB.js | 2 +- Conversions/LengthConversion.js | 4 +- Conversions/LowerCaseConversion.js | 2 +- Conversions/OctToDecimal.js | 4 +- Conversions/OuncesToKilograms.js | 2 +- Conversions/RGBToHex.js | 10 +- Conversions/RailwayTimeConversion.js | 17 +- Conversions/RgbHsvConversion.js | 17 +- Conversions/RomanToDecimal.js | 2 +- Conversions/TemperatureConversion.js | 215 +- Conversions/TitleCaseConversion.js | 27 +- Conversions/UpperCaseConversion.js | 2 +- Conversions/test/ArbitraryBase.test.js | 5 +- Conversions/test/BinaryToHex.test.js | 4 +- Conversions/test/HexToRGB.test.js | 32 +- Conversions/test/LengthConversion.test.js | 24 +- Conversions/test/RgbHsvConversion.test.js | 32 +- .../test/TemperatureConversion.test.js | 212 +- Conversions/test/TitleCaseConversion.test.js | 14 +- Conversions/test/UpperCaseConverstion.test.js | 10 +- DIRECTORY.md | 3 + Data-Structures/Array/LocalMaximomPoint.js | 31 +- .../Array/NumberOfLocalMaximumPoints.js | 7 +- Data-Structures/Array/QuickSelect.js | 15 +- Data-Structures/Array/test/Reverse.test.js | 19 +- Data-Structures/Graph/Graph.js | 22 +- Data-Structures/Graph/Graph2.js | 8 +- Data-Structures/Graph/Graph3.js | 18 +- Data-Structures/Graph/test/Graph2.test.js | 2 +- Data-Structures/Heap/KeyPriorityQueue.js | 34 +- Data-Structures/Heap/MaxHeap.js | 14 +- Data-Structures/Heap/MinHeap.js | 31 +- Data-Structures/Heap/MinPriorityQueue.js | 42 +- Data-Structures/Heap/test/MinHeap.test.js | 10 +- .../Heap/test/MinPriorityQueue.test.js | 6 +- Data-Structures/Linked-List/AddTwoNumbers.js | 6 +- Data-Structures/Linked-List/CycleDetection.js | 10 +- .../Linked-List/DoublyLinkedList.js | 38 +- .../Linked-List/ReverseSinglyLinkedList.js | 4 +- .../Linked-List/SinglyCircularLinkedList.js | 35 +- .../Linked-List/SinglyLinkedList.js | 50 +- .../test/SinglyCircularLinkedList.test.js | 294 +- Data-Structures/Queue/CircularQueue.js | 23 +- Data-Structures/Queue/Queue.js | 34 +- Data-Structures/Queue/QueueUsing2Stacks.js | 10 +- Data-Structures/Stack/Stack.js | 16 +- Data-Structures/Stack/StackES6.js | 14 +- Data-Structures/Tree/AVLTree.js | 36 +- Data-Structures/Tree/BinarySearchTree.js | 34 +- Data-Structures/Tree/SegmentTree.js | 8 +- Data-Structures/Tree/Trie.js | 18 +- Data-Structures/Tree/test/AVLTree.test.js | 8 +- Data-Structures/Vectors/Vector2.js | 29 +- Data-Structures/Vectors/test/Vector2.test.js | 115 +- Dynamic-Programming/EditDistance.js | 2 +- Dynamic-Programming/FindMonthCalendar.js | 51 +- Dynamic-Programming/KadaneAlgo.js | 2 +- Dynamic-Programming/LevenshteinDistance.js | 13 +- .../LongestCommonSubsequence.js | 7 +- .../LongestIncreasingSubsequence.js | 2 +- .../LongestPalindromicSubsequence.js | 4 +- Dynamic-Programming/MaxNonAdjacentSum.js | 10 +- Dynamic-Programming/MaxProductOfThree.js | 2 +- Dynamic-Programming/MinimumCostPath.js | 4 +- .../NumberOfSubsetEqualToGivenSum.js | 2 +- Dynamic-Programming/RodCutting.js | 12 +- Dynamic-Programming/Shuf.js | 10 +- Dynamic-Programming/SieveOfEratosthenes.js | 2 +- ...gestSubstringWithoutRepeatingCharacters.js | 2 +- .../Sliding-Window/PermutationinString.js | 6 +- Dynamic-Programming/SudokuSolver.js | 2 +- Dynamic-Programming/ZeroOneKnapsack.js | 9 +- .../tests/EditDistance.test.js | 44 +- .../tests/LongestCommonSubsequence.test.js | 8 +- .../tests/MaxProductOfThree.test.js | 26 +- .../tests/SieveOfEratosthenes.test.js | 4 +- .../tests/UniquePaths2.test.js | 32 +- .../tests/ZeroOneKnapsack.test.js | 29 +- Geometry/Circle.js | 2 +- Geometry/Cone.js | 11 +- Geometry/ConvexHullGraham.js | 30 +- Geometry/Pyramid.js | 10 +- Geometry/Sphere.js | 4 +- Geometry/Test/ConvexHullGraham.test.js | 70 +- Graphs/BellmanFord.js | 8 +- Graphs/BinaryLifting.js | 12 +- Graphs/BreadthFirstSearch.js | 74 +- Graphs/BreadthFirstShortestPath.js | 108 +- Graphs/ConnectedComponents.js | 26 +- Graphs/Density.js | 2 +- Graphs/DepthFirstSearchIterative.js | 20 +- Graphs/DepthFirstSearchRecursive.js | 24 +- Graphs/Dijkstra.js | 4 +- Graphs/DijkstraSmallestPath.js | 10 +- Graphs/Kosaraju.js | 16 +- Graphs/KruskalMST.js | 30 +- Graphs/LCABinaryLifting.js | 10 +- Graphs/NodeNeighbors.js | 10 +- Graphs/PrimMST.js | 31 +- Graphs/test/BellmanFord.test.js | 39 +- Graphs/test/BreadthFirstSearch.test.js | 15 +- Graphs/test/BreadthFirstShortestPath.test.js | 15 +- Hashes/SHA1.js | 42 +- Hashes/SHA256.js | 66 +- Maths/AliquotSum.js | 7 +- Maths/ArithmeticGeometricMean.js | 2 +- Maths/BinaryExponentiationRecursive.js | 40 +- Maths/BinomialCoefficient.js | 2 +- Maths/BisectionMethod.js | 16 +- Maths/CircularArc.js | 43 +- Maths/CoPrimeCheck.js | 4 +- Maths/CollatzSequence.js | 4 +- Maths/Coordinate.js | 2 +- Maths/CountNumbersDivisible.js | 10 +- Maths/DecimalExpansion.js | 2 +- Maths/EulerMethod.js | 66 +- Maths/ExponentialFunction.js | 14 +- Maths/ExtendedEuclideanGCD.js | 3 +- Maths/Factorial.js | 6 +- Maths/FareyApproximation.js | 63 +- Maths/Fibonacci.js | 41 +- Maths/FindLcm.js | 2 +- Maths/FindMaxRecursion.js | 84 +- Maths/FindMinIterator.js | 16 +- Maths/FriendlyNumbers.js | 12 +- Maths/GetEuclidGCD.js | 2 +- Maths/IsOdd.js | 2 +- Maths/JugglerSequence.js | 2 +- Maths/LeapYear.js | 2 +- Maths/LucasSeries.js | 5 +- Maths/Mandelbrot.js | 25 +- Maths/MatrixMultiplication.js | 11 +- Maths/MeanAbsoluteDeviation.js | 6 +- Maths/MidpointIntegration.js | 56 +- Maths/MobiusFunction.js | 6 +- Maths/ModularArithmetic.js | 4 +- Maths/ModularBinaryExponentiationRecursive.js | 44 +- Maths/NumberOfDigits.js | 3 +- Maths/Palindrome.js | 3 +- Maths/ParityOutlier.js | 9 +- Maths/PerfectCube.js | 3 +- Maths/PerfectSquare.js | 3 +- Maths/Polynomial.js | 12 +- Maths/Pow.js | 9 +- Maths/PrimeCheck.js | 50 +- Maths/PrimeFactors.js | 40 +- Maths/ShorsAlgorithm.js | 10 +- Maths/SieveOfEratosthenesIntArray.js | 8 +- Maths/Signum.js | 2 +- Maths/SimpsonIntegration.js | 66 +- Maths/Softmax.js | 2 +- Maths/SquareRoot.js | 22 +- Maths/SumOfDigits.js | 17 +- Maths/SumOfGeometricProgression.js | 10 +- Maths/TwinPrime.js | 4 +- Maths/Volume.js | 28 +- Maths/ZellersCongruenceAlgorithm.js | 15 +- Maths/isPalindromeIntegerNumber.js | 2 +- Maths/test/BinomialCoefficient.test.js | 16 +- Maths/test/BisectionMethod.test.js | 27 +- Maths/test/Coordinate.test.js | 14 +- Maths/test/CountNumbersDivisible.test.js | 25 +- Maths/test/EulerMethod.manual-test.js | 29 +- Maths/test/EulerMethod.test.js | 35 +- Maths/test/ExtendedEuclideanGCD.test.js | 16 +- Maths/test/Factorial.test.js | 12 +- Maths/test/Fibonacci.test.js | 9 +- Maths/test/FindLcm.test.js | 32 +- Maths/test/FindMaxRecursion.test.js | 116 +- Maths/test/FindMinIterator.test.js | 18 +- Maths/test/GetEuclidGCD.test.js | 2 +- Maths/test/HexagonalNumber.test.js | 22 +- Maths/test/IsDivisible.test.js | 22 +- Maths/test/IsPronic.test.js | 7 +- Maths/test/IsSquareFree.test.js | 121 +- Maths/test/LinearSieve.test.js | 5 +- Maths/test/LiouvilleFunction.test.js | 25 +- Maths/test/MidpointIntegration.test.js | 12 +- Maths/test/MobiusFunction.test.js | 25 +- Maths/test/NumberOfDigits.test.js | 9 +- Maths/test/Palindrome.test.js | 6 +- Maths/test/PermutationAndCombination.test.js | 6 +- .../test/SieveOfEratosthenesIntArray.test.js | 2 +- Maths/test/SimpsonIntegration.test.js | 12 +- Maths/test/SumOfDigits.test.js | 6 +- Maths/test/WhileLoopFactorial.test.js | 2 +- Maths/test/ZellersCongruenceAlgorithm.test.js | 2 +- Navigation/Haversine.js | 24 +- Navigation/test/Haversine.test.js | 6 +- Project-Euler/Problem002.js | 10 +- Project-Euler/Problem005.js | 4 +- Project-Euler/Problem006.js | 2 +- Project-Euler/Problem008.js | 2 +- Project-Euler/Problem009.js | 3 +- Project-Euler/Problem011.js | 6 +- Project-Euler/Problem012.js | 2 +- Project-Euler/Problem013.js | 10 +- Project-Euler/Problem014.js | 2 +- Project-Euler/Problem015.js | 2 +- Project-Euler/Problem017.js | 2 +- Project-Euler/Problem018.js | 5 +- Project-Euler/Problem021.js | 2 +- Project-Euler/Problem023.js | 127 +- Project-Euler/Problem025.js | 91 +- Project-Euler/Problem028.js | 38 +- Project-Euler/Problem035.js | 12 +- Project-Euler/Problem044.js | 11 +- Project-Euler/test/Problem001.test.js | 8 +- Project-Euler/test/Problem002.test.js | 4 +- Project-Euler/test/Problem011.test.js | 58 +- Project-Euler/test/Problem013.test.js | 3 +- Project-Euler/test/Problem017.test.js | 6 +- Project-Euler/test/Problem023.test.js | 46 +- Project-Euler/test/Problem025.test.js | 54 +- Project-Euler/test/Problem044.test.js | 3 +- README.md | 14 +- Recursive/EucledianGCD.js | 6 +- Recursive/FloodFill.js | 235 +- Recursive/KochSnowflake.js | 20 +- Recursive/KochSnowflake.manual-test.js | 9 +- Recursive/TowerOfHanoi.js | 2 +- Recursive/test/FloodFill.test.js | 17 +- Recursive/test/KochSnowflake.test.js | 30 +- Search/BinarySearch.js | 4 +- Search/ExponentialSearch.js | 4 +- Search/FibonacciSearch.js | 2 +- Search/InterpolationSearch.js | 2 +- Search/JumpSearch.js | 8 +- Search/LinearSearch.js | 8 +- Search/QuickSelectSearch.js | 2 +- Search/SlidingWindow.js | 34 +- Search/StringSearch.js | 4 +- Search/TernarySearch.js | 4 +- Search/UnionFind.js | 21 +- Search/test/ExponentialSearch.test.js | 30 +- Search/test/FibonacciSearch.test.js | 44 +- Search/test/InterpolationSearch.test.js | 30 +- Search/test/TernarySearch.test.js | 25 +- Search/test/jumpSearch.test.js | 38 +- Sorts/BeadSort.js | 6 +- Sorts/BinaryInsertionSort.js | 4 +- Sorts/BogoSort.js | 6 +- Sorts/BubbleSort.js | 36 +- Sorts/BucketSort.js | 2 +- Sorts/CocktailShakerSort.js | 6 +- Sorts/CombSort.js | 4 +- Sorts/CycleSort.js | 2 +- Sorts/DutchNationalFlagSort.js | 6 +- Sorts/FindSecondLargestElement.js | 18 +- Sorts/FlashSort.js | 19 +- Sorts/GnomeSort.js | 4 +- Sorts/HeapSort.js | 2 +- Sorts/HeapSortV2.js | 8 +- Sorts/InsertionSort.js | 6 +- Sorts/IntroSort.js | 16 +- Sorts/MergeSort.js | 4 +- Sorts/OddEvenSort.js | 4 +- Sorts/PancakeSort.js | 6 +- Sorts/PigeonHoleSort.js | 10 +- Sorts/QuickSort.js | 2 +- Sorts/QuickSortRecursive.js | 10 +- Sorts/RadixSort.js | 12 +- Sorts/SelectionSort.js | 8 +- Sorts/ShellSort.js | 2 +- Sorts/StoogeSort.js | 2 +- Sorts/SwapSort.js | 2 +- Sorts/TimSort.js | 24 +- Sorts/TopologicalSort.js | 13 +- Sorts/test/AlphaNumericalSort.test.js | 12 +- Sorts/test/BogoSort.test.js | 4 +- Sorts/test/BubbleSort.test.js | 8 +- Sorts/test/BucketSort.test.js | 24 +- Sorts/test/CocktailShakerSort.test.js | 4 +- Sorts/test/CombSort.test.js | 20 +- Sorts/test/CountingSort.test.js | 50 +- Sorts/test/CycleSort.test.js | 24 +- Sorts/test/DutchNationalFlagSort.test.js | 4 +- Sorts/test/FindSecondLargestElement.test.js | 26 +- Sorts/test/FlashSort.test.js | 50 +- Sorts/test/GnomeSort.test.js | 38 +- Sorts/test/HeapSort.test.js | 50 +- Sorts/test/HeapSortV2.test.js | 38 +- Sorts/test/InsertionSort.test.js | 12 +- Sorts/test/MergeSort.test.js | 4 +- Sorts/test/OddEvenSort.test.js | 50 +- Sorts/test/PigeonHoleSort.test.js | 38 +- Sorts/test/QuickSortRecursive.test.js | 20 +- Sorts/test/RadixSort.test.js | 38 +- Sorts/test/SecondLargestElement.test.js | 50 +- Sorts/test/SelectionSort.test.js | 4 +- Sorts/test/ShellSort.test.js | 50 +- Sorts/test/SimplifiedWiggleSort.test.js | 13 +- Sorts/test/TimSort.test.js | 50 +- String/AlphaNumericPalindrome.js | 5 +- String/AlternativeStringArrange.js | 5 +- String/CheckExceeding.js | 4 +- String/CheckPangram.js | 2 +- String/CheckRearrangePalindrome.js | 16 +- String/CheckWordOccurrence.js | 11 +- String/CreatePermutations.js | 6 +- String/DiceCoefficient.js | 6 +- String/FormatPhoneNumber.js | 2 +- String/GenerateGUID.js | 6 +- String/IsPalindrome.js | 2 +- String/Lower.js | 4 +- String/MaxCharacter.js | 3 +- String/MaxWord.js | 18 +- String/PermutateString.js | 16 +- String/ReverseString.js | 18 +- String/Upper.js | 4 +- String/ValidateCreditCard.js | 8 +- String/ZFunction.js | 2 +- String/test/AlternativeStringArrange.test.js | 44 +- String/test/CheckAnagram.test.js | 8 +- String/test/CheckExceeding.test.js | 4 +- String/test/CheckKebabCase.test.js | 26 +- String/test/CheckPangram.test.js | 16 +- String/test/CheckPascalCase.test.js | 38 +- String/test/CheckRearrangePalindrome.test.js | 50 +- String/test/CheckWordOcurrence.test.js | 23 +- String/test/FormatPhoneNumber.test.js | 4 +- ...fLongestSubstringWithoutRepetition.test.js | 4 +- String/test/MaxCharacter.test.js | 2 +- String/test/PermutateString.test.js | 20 +- String/test/ReverseString.test.js | 13 +- String/test/ReverseWords.test.js | 4 +- String/test/ValidateCreditCard.test.js | 48 +- String/test/ValidateEmail.test.js | 8 +- Timing-Functions/GetMonthDays.js | 16 +- Timing-Functions/IntervalTimer.js | 13 +- Timing-Functions/test/GetMonthDays.test.js | 4 +- Trees/BreadthFirstTreeTraversal.js | 12 +- Trees/DepthFirstSearch.js | 6 +- Trees/FenwickTree.js | 12 +- babel.config.cjs | 12 - package-lock.json | 15619 ++-------------- package.json | 30 +- vitest.config.ts | 8 + 392 files changed, 6350 insertions(+), 17123 deletions(-) rename .github/workflows/{UpdateDirectory.mjs => UpdateDirectory.js} (98%) create mode 100644 .prettierignore delete mode 100644 babel.config.cjs create mode 100644 vitest.config.ts diff --git a/.github/workflows/Ci.yml b/.github/workflows/Ci.yml index a783e0bb97..e08dcdb446 100644 --- a/.github/workflows/Ci.yml +++ b/.github/workflows/Ci.yml @@ -15,20 +15,15 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 20 cache: npm - name: 📦 Install dependencies run: npm ci - name: 🧪 Run all tests - if: ${{ github.event_name == 'push' }} run: npm run test - - name: 🧪 Run tests for changed files only - if: ${{ github.event_name == 'pull_request' }} - run: npm run test-changed - - name: 💄 Code style run: npm run style diff --git a/.github/workflows/UpdateDirectory.mjs b/.github/workflows/UpdateDirectory.js similarity index 98% rename from .github/workflows/UpdateDirectory.mjs rename to .github/workflows/UpdateDirectory.js index 0136f4bae4..925b92b781 100644 --- a/.github/workflows/UpdateDirectory.mjs +++ b/.github/workflows/UpdateDirectory.js @@ -63,7 +63,7 @@ globby([ "!**/test/**/*", '!**/*.test.js', '!**/*.manual-test.js', - '!babel.config.js' + '!vitest.config.ts' ]) // create markdown content .then(pathsToMarkdown) diff --git a/.github/workflows/UpdateDirectory.yml b/.github/workflows/UpdateDirectory.yml index 91de198df4..624047758a 100644 --- a/.github/workflows/UpdateDirectory.yml +++ b/.github/workflows/UpdateDirectory.yml @@ -11,16 +11,17 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 20 cache: npm - name: 📦 Install dependencies run: npm ci - name: 🗄️ Create Directory from JS files - run: node .github/workflows/UpdateDirectory.mjs + run: node .github/workflows/UpdateDirectory.js - name: Configure Github Action run: | diff --git a/.husky/pre-commit b/.husky/pre-commit index 9b70cd5958..35ea7e3c08 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -2,4 +2,4 @@ . "$(dirname "$0")/_/husky.sh" npm run style -npm run test-changed +npm run test diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000..d66f37a719 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +.github +DIRECTORY.md diff --git a/Backtracking/AllCombinationsOfSizeK.js b/Backtracking/AllCombinationsOfSizeK.js index 77ddd54f86..264acb1f19 100644 --- a/Backtracking/AllCombinationsOfSizeK.js +++ b/Backtracking/AllCombinationsOfSizeK.js @@ -22,14 +22,14 @@ */ class Combinations { - constructor (n, k) { + constructor(n, k) { this.n = n this.k = k this.current = [] // will be used for storing current combination this.combinations = [] } - findCombinations (high = this.n, total = this.k, low = 1) { + findCombinations(high = this.n, total = this.k, low = 1) { if (total === 0) { this.combinations.push([...this.current]) return this.combinations diff --git a/Backtracking/GeneratePermutations.js b/Backtracking/GeneratePermutations.js index 1629e2aa84..288eeb049b 100644 --- a/Backtracking/GeneratePermutations.js +++ b/Backtracking/GeneratePermutations.js @@ -10,14 +10,14 @@ */ const swap = (arr, i, j) => { - const newArray = [...arr]; + const newArray = [...arr] - [newArray[i], newArray[j]] = [newArray[j], newArray[i]] // Swapping elements ES6 way + ;[newArray[i], newArray[j]] = [newArray[j], newArray[i]] // Swapping elements ES6 way return newArray } -const permutations = arr => { +const permutations = (arr) => { const P = [] const permute = (arr, low, high) => { if (low === high) { diff --git a/Backtracking/KnightTour.js b/Backtracking/KnightTour.js index cc48396bad..36f400160d 100644 --- a/Backtracking/KnightTour.js +++ b/Backtracking/KnightTour.js @@ -1,12 +1,12 @@ // Wikipedia: https://en.wikipedia.org/wiki/Knight%27s_tour class OpenKnightTour { - constructor (size) { + constructor(size) { this.board = new Array(size).fill(0).map(() => new Array(size).fill(0)) this.size = size } - getMoves ([i, j]) { + getMoves([i, j]) { // helper function to get the valid moves of the knight from the current position const moves = [ [i + 2, j - 1], @@ -19,15 +19,17 @@ class OpenKnightTour { [i - 1, j + 2] ] - return moves.filter(([y, x]) => y >= 0 && y < this.size && x >= 0 && x < this.size) + return moves.filter( + ([y, x]) => y >= 0 && y < this.size && x >= 0 && x < this.size + ) } - isComplete () { + isComplete() { // helper function to check if the board is complete - return !this.board.map(row => row.includes(0)).includes(true) + return !this.board.map((row) => row.includes(0)).includes(true) } - solve () { + solve() { // function to find the solution for the given board for (let i = 0; i < this.size; i++) { for (let j = 0; j < this.size; j++) { @@ -37,7 +39,7 @@ class OpenKnightTour { return false } - solveHelper ([i, j], curr) { + solveHelper([i, j], curr) { // helper function for the main computation if (this.isComplete()) return true @@ -52,7 +54,7 @@ class OpenKnightTour { return false } - printBoard (output = value => console.log(value)) { + printBoard(output = (value) => console.log(value)) { // utility function to display the board for (const row of this.board) { let string = '' diff --git a/Backtracking/NQueens.js b/Backtracking/NQueens.js index f75b384869..307c66dc04 100644 --- a/Backtracking/NQueens.js +++ b/Backtracking/NQueens.js @@ -1,5 +1,5 @@ class NQueens { - constructor (size) { + constructor(size) { if (size < 0) { throw RangeError('Invalid board size') } @@ -8,7 +8,7 @@ class NQueens { this.solutionCount = 0 } - isValid ([row, col]) { + isValid([row, col]) { // function to check if the placement of the queen in the given location is valid // checking the left of the current row @@ -29,15 +29,15 @@ class NQueens { return true } - placeQueen (row, col) { + placeQueen(row, col) { this.board[row][col] = 'Q' } - removeQueen (row, col) { + removeQueen(row, col) { this.board[row][col] = '.' } - solve (col = 0) { + solve(col = 0) { if (col >= this.size) { this.solutionCount++ return true @@ -54,7 +54,7 @@ class NQueens { return false } - printBoard (output = value => console.log(value)) { + printBoard(output = (value) => console.log(value)) { if (!output._isMockFunction) { output('\n') } diff --git a/Backtracking/RatInAMaze.js b/Backtracking/RatInAMaze.js index 33095e3582..6522a87244 100644 --- a/Backtracking/RatInAMaze.js +++ b/Backtracking/RatInAMaze.js @@ -21,19 +21,23 @@ * @param grid The grid to check. * @throws TypeError When the given grid is invalid. */ -function validateGrid (grid) { - if (!Array.isArray(grid) || grid.length === 0) throw new TypeError('Grid must be a non-empty array') +function validateGrid(grid) { + if (!Array.isArray(grid) || grid.length === 0) + throw new TypeError('Grid must be a non-empty array') - const allRowsHaveCorrectLength = grid.every(row => row.length === grid.length) + const allRowsHaveCorrectLength = grid.every( + (row) => row.length === grid.length + ) if (!allRowsHaveCorrectLength) throw new TypeError('Grid must be a square') - const allCellsHaveValidValues = grid.every(row => { - return row.every(cell => cell === 0 || cell === 1) + const allCellsHaveValidValues = grid.every((row) => { + return row.every((cell) => cell === 0 || cell === 1) }) - if (!allCellsHaveValidValues) throw new TypeError('Grid must only contain 0s and 1s') + if (!allCellsHaveValidValues) + throw new TypeError('Grid must only contain 0s and 1s') } -function isSafe (grid, x, y) { +function isSafe(grid, x, y) { const n = grid.length return x >= 0 && x < n && y >= 0 && y < n && grid[y][x] === 1 } @@ -48,7 +52,7 @@ function isSafe (grid, x, y) { * @param path The path we took to get from the source cell to the current location. * @returns {string|boolean} Either the path to the target cell or false. */ -function getPathPart (grid, x, y, solution, path) { +function getPathPart(grid, x, y, solution, path) { const n = grid.length // are we there yet? @@ -89,7 +93,7 @@ function getPathPart (grid, x, y, solution, path) { return false } -function getPath (grid) { +function getPath(grid) { // grid dimensions const n = grid.length @@ -108,7 +112,7 @@ function getPath (grid) { * Creates an instance of the "rat in a maze" based on a given grid (maze). */ export class RatInAMaze { - constructor (grid) { + constructor(grid) { // first, let's do some error checking on the input validateGrid(grid) diff --git a/Backtracking/Sudoku.js b/Backtracking/Sudoku.js index 82299780de..6d529cc9dd 100644 --- a/Backtracking/Sudoku.js +++ b/Backtracking/Sudoku.js @@ -1,10 +1,10 @@ class Sudoku { // Sudoku Class to hold the board and related functions - constructor (board) { + constructor(board) { this.board = board } - findEmptyCell () { + findEmptyCell() { // Find a empty cell in the board (returns [-1, -1] if all cells are filled) for (let i = 0; i < 9; i++) { for (let j = 0; j < 9; j++) { @@ -14,7 +14,7 @@ class Sudoku { return [-1, -1] } - check ([y, x], value) { + check([y, x], value) { // checks if the value to be added in the board is an acceptable value for the cell // checking through the row @@ -29,8 +29,8 @@ class Sudoku { // checking through the 3x3 block of the cell const secRow = Math.floor(y / 3) const secCol = Math.floor(x / 3) - for (let i = (secRow * 3); i < ((secRow * 3) + 3); i++) { - for (let j = (secCol * 3); j < ((secCol * 3) + 3); j++) { + for (let i = secRow * 3; i < secRow * 3 + 3; i++) { + for (let j = secCol * 3; j < secCol * 3 + 3; j++) { if (y !== i && x !== j && this.board[i][j] === value) return false } } @@ -38,7 +38,7 @@ class Sudoku { return true } - solve () { + solve() { const [y, x] = this.findEmptyCell() // checking if the board is complete @@ -56,20 +56,23 @@ class Sudoku { return false } - getSection (row, [start, end]) { + getSection(row, [start, end]) { return this.board[row].slice(start, end) } - printBoard (output = (...v) => console.log(...v)) { + printBoard(output = (...v) => console.log(...v)) { // helper function to display board for (let i = 0; i < 9; i++) { if (i % 3 === 0 && i !== 0) { output('- - - - - - - - - - - -') } output( - ...this.getSection(i, [0, 3]), ' | ', - ...this.getSection(i, [3, 6]), ' | ', - ...this.getSection(i, [6, 9])) + ...this.getSection(i, [0, 3]), + ' | ', + ...this.getSection(i, [3, 6]), + ' | ', + ...this.getSection(i, [6, 9]) + ) } } } diff --git a/Backtracking/tests/AllCombinationsOfSizeK.test.js b/Backtracking/tests/AllCombinationsOfSizeK.test.js index 04acf6470c..a2135e54bf 100644 --- a/Backtracking/tests/AllCombinationsOfSizeK.test.js +++ b/Backtracking/tests/AllCombinationsOfSizeK.test.js @@ -3,11 +3,22 @@ import { Combinations } from '../AllCombinationsOfSizeK' describe('AllCombinationsOfSizeK', () => { it('should return 3x2 matrix solution for n = 3 and k = 2', () => { const test1 = new Combinations(3, 2) - expect(test1.findCombinations()).toEqual([[1, 2], [1, 3], [2, 3]]) + expect(test1.findCombinations()).toEqual([ + [1, 2], + [1, 3], + [2, 3] + ]) }) it('should return 6x2 matrix solution for n = 4 and k = 2', () => { const test2 = new Combinations(4, 2) - expect(test2.findCombinations()).toEqual([[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4]]) + expect(test2.findCombinations()).toEqual([ + [1, 2], + [1, 3], + [1, 4], + [2, 3], + [2, 4], + [3, 4] + ]) }) }) diff --git a/Backtracking/tests/GenerateParentheses.test.js b/Backtracking/tests/GenerateParentheses.test.js index d7431a1a3c..369ae8ee44 100644 --- a/Backtracking/tests/GenerateParentheses.test.js +++ b/Backtracking/tests/GenerateParentheses.test.js @@ -1,5 +1,11 @@ import { generateParentheses } from '../generateParentheses' test('generate all valid parentheses of input 3', () => { - expect(generateParentheses(3)).toStrictEqual(['((()))', '(()())', '(())()', '()(())', '()()()']) + expect(generateParentheses(3)).toStrictEqual([ + '((()))', + '(()())', + '(())()', + '()(())', + '()()()' + ]) }) diff --git a/Backtracking/tests/NQueens.test.js b/Backtracking/tests/NQueens.test.js index 6eac39ad90..681307a35a 100644 --- a/Backtracking/tests/NQueens.test.js +++ b/Backtracking/tests/NQueens.test.js @@ -14,6 +14,8 @@ describe('NQueens', () => { }) it('should throw RangeError for negative size board', () => { - expect(() => { return new NQueens(-1) }).toThrow(RangeError) + expect(() => { + return new NQueens(-1) + }).toThrow(RangeError) }) }) diff --git a/Backtracking/tests/RatInAMaze.test.js b/Backtracking/tests/RatInAMaze.test.js index 5f071096de..6cc5b31aae 100644 --- a/Backtracking/tests/RatInAMaze.test.js +++ b/Backtracking/tests/RatInAMaze.test.js @@ -7,14 +7,18 @@ describe('RatInAMaze', () => { for (const value of values) { // we deliberately want to check whether this constructor call fails or not // eslint-disable-next-line no-new - expect(() => { new RatInAMaze(value) }).toThrow() + expect(() => { + new RatInAMaze(value) + }).toThrow() } }) it('should fail for an empty array', () => { // we deliberately want to check whether this constructor call fails or not // eslint-disable-next-line no-new - expect(() => { new RatInAMaze([]) }).toThrow() + expect(() => { + new RatInAMaze([]) + }).toThrow() }) it('should fail for a non-square array', () => { @@ -25,7 +29,9 @@ describe('RatInAMaze', () => { // we deliberately want to check whether this constructor call fails or not // eslint-disable-next-line no-new - expect(() => { new RatInAMaze(array) }).toThrow() + expect(() => { + new RatInAMaze(array) + }).toThrow() }) it('should fail for arrays containing invalid values', () => { @@ -34,7 +40,9 @@ describe('RatInAMaze', () => { for (const value of values) { // we deliberately want to check whether this constructor call fails or not // eslint-disable-next-line no-new - expect(() => { new RatInAMaze(value) }).toThrow() + expect(() => { + new RatInAMaze(value) + }).toThrow() } }) @@ -51,13 +59,20 @@ describe('RatInAMaze', () => { }) it('should work for a simple 3x3 maze', () => { - const maze = new RatInAMaze([[1, 1, 0], [0, 1, 0], [0, 1, 1]]) + const maze = new RatInAMaze([ + [1, 1, 0], + [0, 1, 0], + [0, 1, 1] + ]) expect(maze.solved).toBe(true) expect(maze.path).toBe('RDDR') }) it('should work for a simple 2x2 that can not be solved', () => { - const maze = new RatInAMaze([[1, 0], [0, 1]]) + const maze = new RatInAMaze([ + [1, 0], + [0, 1] + ]) expect(maze.solved).toBe(false) expect(maze.path).toBe('') }) diff --git a/Backtracking/tests/Sudoku.test.js b/Backtracking/tests/Sudoku.test.js index 092556f1c9..8cbe187089 100644 --- a/Backtracking/tests/Sudoku.test.js +++ b/Backtracking/tests/Sudoku.test.js @@ -28,7 +28,9 @@ describe('Sudoku', () => { it('should create a valid board successfully', () => { // we deliberately want to check whether this constructor call fails or not // eslint-disable-next-line no-new - expect(() => { new Sudoku(data) }).not.toThrow() + expect(() => { + new Sudoku(data) + }).not.toThrow() }) it('should find an empty cell', () => { diff --git a/Bit-Manipulation/BinaryCountSetBits.js b/Bit-Manipulation/BinaryCountSetBits.js index 7e77ec88b1..e0a6d9414c 100644 --- a/Bit-Manipulation/BinaryCountSetBits.js +++ b/Bit-Manipulation/BinaryCountSetBits.js @@ -7,7 +7,7 @@ */ -function BinaryCountSetBits (a) { +function BinaryCountSetBits(a) { 'use strict' // check whether input is an integer, some non-integer number like, 21.1 have non-terminating binary expansions and hence their binary expansion will contain infinite ones, thus the handling of non-integers (including strings,objects etc. as it is meaningless) has been omitted diff --git a/Bit-Manipulation/IsPowerofFour.js b/Bit-Manipulation/IsPowerofFour.js index 38431f9242..f0e57f339f 100644 --- a/Bit-Manipulation/IsPowerofFour.js +++ b/Bit-Manipulation/IsPowerofFour.js @@ -12,6 +12,6 @@ * const result = isPowerOfFour(16); // Returns true (16 is 4^2) * const result2 = isPowerOfFour(5); // Returns false (5 is not a power of four) */ -const isPowerOfFour = (n) => ((n > 0) && ((n & n - 1) === 0) && (n % 3 === 1)) +const isPowerOfFour = (n) => n > 0 && (n & (n - 1)) === 0 && n % 3 === 1 export { isPowerOfFour } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3b85427d05..289f9acd34 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -94,8 +94,8 @@ Be confident that your code works. When was the last time you committed a code c your app stopped working? Mine was last week. Writing tests for our Algorithms will help us ensure the implementations are airtight even after multiple fixes and code changes. -We use [Jest](https://jestjs.io/) to run unit tests on our algorithms. It provides a very readable and expressive way to -structure your test code. +We use [Vitest](https://vitest.dev/) to run unit tests on our algorithms. It provides a very readable and expressive +way to structure your test code. It is advised that the algorithm file (module) does not contain any "live" code but rather just exports the function(s) needed to execute the algorithm. Your test code can import those function(s), call them with the appropriate parameters @@ -122,34 +122,23 @@ If you want to save some time and just run a specific test: npm test -- koch ``` -You can also start Jest in "watch" mode: +You can also start Vitest in "watch" mode: ```bash -npm test -- --watchAll -``` - -We also prepared a helper script that runs tests only for changed files: - -```bash -npm run test-changed +npm test-watch ``` This will run all tests and watch source and test files for changes. When a change is made, the tests will run again. #### Coding Style -To maximize the readability and correctness of our code, we require that new submissions follow the -[JavaScript Standard Style](https://standardjs.com/). - -Before committing, please run: +For consistency and readability, we require that new submissions follow the [Prettier Style](https://prettier.io/). +Before committing, please format your code automatically using Prettier by running the following command: ```bash npm run style ``` -In order to apply the coding style (where it can be done automatically). If an error is shown, please figure out what's -wrong, fix it and run standard again. - A few (but not all) of the things to keep in mind: - Use camelCase with the leading character as lowercase for identifier names (variables and functions). diff --git a/Cache/LFUCache.js b/Cache/LFUCache.js index c7ed906177..d8774fb506 100644 --- a/Cache/LFUCache.js +++ b/Cache/LFUCache.js @@ -1,5 +1,5 @@ class CacheNode { - constructor (key, value, frequency) { + constructor(key, value, frequency) { this.key = key this.value = value this.frequency = frequency @@ -10,15 +10,19 @@ class CacheNode { // This frequency map class will act like javascript Map DS with more two custom method refresh & insert class FrequencyMap extends Map { - static get [Symbol.species] () { return Map } // for using Symbol.species we can access Map constructor @see -> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/@@species - get [Symbol.toStringTag] () { return '' } + static get [Symbol.species]() { + return Map + } // for using Symbol.species we can access Map constructor @see -> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/@@species + get [Symbol.toStringTag]() { + return '' + } /** - * @method refresh - * @description - It's revive a CacheNode, increment of this nodes frequency and refresh the frequencyMap via new incremented nodes frequency - * @param {CacheNode} node - */ - refresh (node) { + * @method refresh + * @description - It's revive a CacheNode, increment of this nodes frequency and refresh the frequencyMap via new incremented nodes frequency + * @param {CacheNode} node + */ + refresh(node) { const { frequency } = node const freqSet = this.get(frequency) freqSet.delete(node) @@ -33,7 +37,7 @@ class FrequencyMap extends Map { * @description - Add new CacheNode into HashSet by the frequency * @param {CacheNode} node */ - insert (node) { + insert(node) { const { frequency } = node if (!this.has(frequency)) { @@ -49,10 +53,10 @@ class LFUCache { #frequencyMap /** - * @param {number} capacity - The range of LFUCache - * @returns {LFUCache} - sealed - */ - constructor (capacity) { + * @param {number} capacity - The range of LFUCache + * @returns {LFUCache} - sealed + */ + constructor(capacity) { this.#capacity = capacity this.#frequencyMap = new FrequencyMap() this.misses = 0 @@ -66,7 +70,7 @@ class LFUCache { * Get the capacity of the LFUCache * @returns {number} */ - get capacity () { + get capacity() { return this.#capacity } @@ -74,14 +78,14 @@ class LFUCache { * Get the current size of LFUCache * @returns {number} */ - get size () { + get size() { return this.cache.size } /** - * Set the capacity of the LFUCache if you decrease the capacity its removed CacheNodes following the LFU - least frequency used - */ - set capacity (newCapacity) { + * Set the capacity of the LFUCache if you decrease the capacity its removed CacheNodes following the LFU - least frequency used + */ + set capacity(newCapacity) { if (this.#capacity > newCapacity) { let diff = this.#capacity - newCapacity // get the decrement number of capacity @@ -95,7 +99,7 @@ class LFUCache { this.#capacity = newCapacity } - get info () { + get info() { return Object.freeze({ misses: this.misses, hits: this.hits, @@ -105,7 +109,7 @@ class LFUCache { }) } - get leastFrequency () { + get leastFrequency() { const freqCacheIterator = this.#frequencyMap.keys() let leastFrequency = freqCacheIterator.next().value || null @@ -117,7 +121,7 @@ class LFUCache { return leastFrequency } - #removeCacheNode () { + #removeCacheNode() { const leastFreqSet = this.#frequencyMap.get(this.leastFrequency) // Select the least recently used node from the least Frequency set const LFUNode = leastFreqSet.values().next().value @@ -131,19 +135,19 @@ class LFUCache { * @param {any} key * @returns {boolean} */ - has (key) { + has(key) { key = String(key) // converted to string return this.cache.has(key) } /** - * @method get - * @description - This method return the value of key & refresh the frequencyMap by the oldNode - * @param {string} key - * @returns {any} - */ - get (key) { + * @method get + * @description - This method return the value of key & refresh the frequencyMap by the oldNode + * @param {string} key + * @returns {any} + */ + get(key) { key = String(key) // converted to string if (this.cache.has(key)) { @@ -160,14 +164,14 @@ class LFUCache { } /** - * @method set - * @description - This method stored the value by key & add frequency if it doesn't exist - * @param {string} key - * @param {any} value - * @param {number} frequency - * @returns {LFUCache} - */ - set (key, value, frequency = 1) { + * @method set + * @description - This method stored the value by key & add frequency if it doesn't exist + * @param {string} key + * @param {any} value + * @param {number} frequency + * @returns {LFUCache} + */ + set(key, value, frequency = 1) { key = String(key) // converted to string if (this.#capacity === 0) { @@ -197,12 +201,12 @@ class LFUCache { } /** - * @method parse - * @description - This method receive a valid LFUCache JSON & run JSON.prase() method and merge with existing LFUCache - * @param {JSON} json - * @returns {LFUCache} - merged - */ - parse (json) { + * @method parse + * @description - This method receive a valid LFUCache JSON & run JSON.prase() method and merge with existing LFUCache + * @param {JSON} json + * @returns {LFUCache} - merged + */ + parse(json) { const { misses, hits, cache } = JSON.parse(json) this.misses += misses ?? 0 @@ -217,11 +221,11 @@ class LFUCache { } /** - * @method clear - * @description - This method cleared the whole LFUCache - * @returns {LFUCache} - */ - clear () { + * @method clear + * @description - This method cleared the whole LFUCache + * @returns {LFUCache} + */ + clear() { this.cache.clear() this.#frequencyMap.clear() @@ -229,12 +233,12 @@ class LFUCache { } /** - * @method toString - * @description - This method generate a JSON format of LFUCache & return it. - * @param {number} indent - * @returns {string} - JSON - */ - toString (indent) { + * @method toString + * @description - This method generate a JSON format of LFUCache & return it. + * @param {number} indent + * @returns {string} - JSON + */ + toString(indent) { const replacer = (_, value) => { if (value instanceof Set) { return [...value] diff --git a/Cache/LRUCache.js b/Cache/LRUCache.js index d524bcbaec..43848b52aa 100644 --- a/Cache/LRUCache.js +++ b/Cache/LRUCache.js @@ -6,7 +6,7 @@ class LRUCache { * @param {number} capacity - the capacity of LRUCache * @returns {LRUCache} - sealed */ - constructor (capacity) { + constructor(capacity) { if (!Number.isInteger(capacity) || capacity < 0) { throw new TypeError('Invalid capacity') } @@ -19,7 +19,7 @@ class LRUCache { return Object.seal(this) } - get info () { + get info() { return Object.freeze({ misses: this.misses, hits: this.hits, @@ -28,15 +28,15 @@ class LRUCache { }) } - get size () { + get size() { return this.cache.size } - get capacity () { + get capacity() { return this.#capacity } - set capacity (newCapacity) { + set capacity(newCapacity) { if (newCapacity < 0) { throw new RangeError('Capacity should be greater than 0') } @@ -53,9 +53,9 @@ class LRUCache { } /** - * delete oldest key existing in map by the help of iterator - */ - #removeLeastRecentlyUsed () { + * delete oldest key existing in map by the help of iterator + */ + #removeLeastRecentlyUsed() { this.cache.delete(this.cache.keys().next().value) } @@ -63,7 +63,7 @@ class LRUCache { * @param {string} key * @returns {*} */ - has (key) { + has(key) { key = String(key) return this.cache.has(key) @@ -73,7 +73,7 @@ class LRUCache { * @param {string} key * @param {*} value */ - set (key, value) { + set(key, value) { key = String(key) // Sets the value for the input key and if the key exists it updates the existing key if (this.size === this.capacity) { @@ -87,7 +87,7 @@ class LRUCache { * @param {string} key * @returns {*} */ - get (key) { + get(key) { key = String(key) // Returns the value for the input key. Returns null if key is not present in cache if (this.cache.has(key)) { @@ -109,7 +109,7 @@ class LRUCache { * @param {JSON} json * @returns {LRUCache} */ - parse (json) { + parse(json) { const { misses, hits, cache } = JSON.parse(json) this.misses += misses ?? 0 @@ -126,7 +126,7 @@ class LRUCache { * @param {number} indent * @returns {JSON} - string */ - toString (indent) { + toString(indent) { const replacer = (_, value) => { if (value instanceof Set) { return [...value] diff --git a/Cache/Memoize.js b/Cache/Memoize.js index 5b87cee1e8..b6ff37b9e5 100644 --- a/Cache/Memoize.js +++ b/Cache/Memoize.js @@ -15,11 +15,13 @@ */ const memoize = (func, cache = new Map()) => { const jsonReplacer = (_, value) => { - if (value instanceof Set) { // if the value is Set it's converted to Array cause JSON.stringify can't convert Set + if (value instanceof Set) { + // if the value is Set it's converted to Array cause JSON.stringify can't convert Set return [...value] } - if (value instanceof Map) { // if the value is Map it's converted to Object cause JSON.stringify can't convert Map + if (value instanceof Map) { + // if the value is Map it's converted to Object cause JSON.stringify can't convert Map return Object.fromEntries(value) } diff --git a/Cache/test/LFUCache.test.js b/Cache/test/LFUCache.test.js index a10c91b859..a7f30a0274 100644 --- a/Cache/test/LFUCache.test.js +++ b/Cache/test/LFUCache.test.js @@ -36,7 +36,8 @@ describe('Testing LFUCache class', () => { leastFrequency: 2 }) - const json = '{"misses":3,"hits":6,"cache":{"2":{"key":"2","value":2,"frequency":4},"4":{"key":"4","value":4,"frequency":2}}}' + const json = + '{"misses":3,"hits":6,"cache":{"2":{"key":"2","value":2,"frequency":4},"4":{"key":"4","value":4,"frequency":2}}}' expect(cache.toString()).toBe(json) const cacheInstance = cache.parse(json) // again merge the json @@ -45,7 +46,8 @@ describe('Testing LFUCache class', () => { cache.capacity = 1 // decrease the capacity - expect(cache.info).toEqual({ // after merging the info + expect(cache.info).toEqual({ + // after merging the info misses: 6, hits: 12, capacity: 1, diff --git a/Cache/test/Memoize.test.js b/Cache/test/Memoize.test.js index 7ce4d03529..cc53e41615 100644 --- a/Cache/test/Memoize.test.js +++ b/Cache/test/Memoize.test.js @@ -43,11 +43,7 @@ describe('Testing Memoize', () => { it('expects the union function to use the cache on the second call', () => { const memoUnion = memoize(union) - const inputs = [ - new Set([1, 2, 3]), - new Set([4, 3, 2]), - new Set([5, 3, 6]) - ] + const inputs = [new Set([1, 2, 3]), new Set([4, 3, 2]), new Set([5, 3, 6])] expect(memoUnion(...inputs)).toEqual(new Set([1, 2, 3, 4, 5, 6])) expect(memoUnion(...inputs)).toEqual(union(...inputs)) diff --git a/Cache/test/cacheTest.js b/Cache/test/cacheTest.js index aecdcc6193..1aa7bc6d6e 100644 --- a/Cache/test/cacheTest.js +++ b/Cache/test/cacheTest.js @@ -31,7 +31,5 @@ export const fibonacciCache = (n, cache = null) => { * @return {new Set} */ export const union = (...sets) => { - return new Set( - sets.reduce((flatArray, set) => [...flatArray, ...set], []) - ) + return new Set(sets.reduce((flatArray, set) => [...flatArray, ...set], [])) } diff --git a/Cellular-Automata/ConwaysGameOfLife.js b/Cellular-Automata/ConwaysGameOfLife.js index 6ce4474783..3175216f02 100644 --- a/Cellular-Automata/ConwaysGameOfLife.js +++ b/Cellular-Automata/ConwaysGameOfLife.js @@ -11,7 +11,7 @@ The Game of Life is a cellular automaton devised by the British mathematician Jo /** * Generates the next generation for a given state of Conway's Game of Life. */ -export function newGeneration (cells) { +export function newGeneration(cells) { const nextGeneration = [] for (let i = 0; i < cells.length; i++) { const nextGenerationRow = [] @@ -20,12 +20,14 @@ export function newGeneration (cells) { let neighbourCount = 0 if (i > 0 && j > 0) neighbourCount += cells[i - 1][j - 1] if (i > 0) neighbourCount += cells[i - 1][j] - if (i > 0 && j < cells[i].length - 1) neighbourCount += cells[i - 1][j + 1] + if (i > 0 && j < cells[i].length - 1) + neighbourCount += cells[i - 1][j + 1] if (j > 0) neighbourCount += cells[i][j - 1] if (j < cells[i].length - 1) neighbourCount += cells[i][j + 1] if (i < cells.length - 1 && j > 0) neighbourCount += cells[i + 1][j - 1] if (i < cells.length - 1) neighbourCount += cells[i + 1][j] - if (i < cells.length - 1 && j < cells[i].length - 1) neighbourCount += cells[i + 1][j + 1] + if (i < cells.length - 1 && j < cells[i].length - 1) + neighbourCount += cells[i + 1][j + 1] // Decide whether the cell is alive or dead const alive = cells[i][j] === 1 diff --git a/Cellular-Automata/Elementary.js b/Cellular-Automata/Elementary.js index 7fd3e59962..7eb0b51090 100644 --- a/Cellular-Automata/Elementary.js +++ b/Cellular-Automata/Elementary.js @@ -64,20 +64,26 @@ * @param {number} rule The current rule of the Elementary Cellular Automata simulation. Must be an integer between 0 and 255 inclusive * @returns {(0 | 1)[]} The next generation according to the inputted rule */ -export function getNextElementaryGeneration (generation, rule) { +export function getNextElementaryGeneration(generation, rule) { const NUM_ELEMENTARY_NEIGHBORHOOD_STATES = 8 const MIN_RULE = 0 const MAX_RULE = 255 if (!Number.isInteger(rule)) { - throw new Error(`Rule must be an integer between the values 0 and 255 (got ${rule})`) + throw new Error( + `Rule must be an integer between the values 0 and 255 (got ${rule})` + ) } if (rule < MIN_RULE || rule > MAX_RULE) { - throw new RangeError(`Rule must be an integer between the values 0 and 255 (got ${rule})`) + throw new RangeError( + `Rule must be an integer between the values 0 and 255 (got ${rule})` + ) } - const binaryRule = rule.toString(2).padStart(NUM_ELEMENTARY_NEIGHBORHOOD_STATES, '0') - const ruleData = binaryRule.split('').map(bit => Number.parseInt(bit)) // note that ruleData[0] represents "all alive" while ruleData[7] represents "all dead" + const binaryRule = rule + .toString(2) + .padStart(NUM_ELEMENTARY_NEIGHBORHOOD_STATES, '0') + const ruleData = binaryRule.split('').map((bit) => Number.parseInt(bit)) // note that ruleData[0] represents "all alive" while ruleData[7] represents "all dead" const output = new Array(generation.length) const LEFT_DEAD = 4 // 100 in binary const MIDDLE_DEAD = 2 // 010 in binary diff --git a/Cellular-Automata/test/ConwaysGameOfLife.test.js b/Cellular-Automata/test/ConwaysGameOfLife.test.js index 9432457bdf..2bf5ac3bbc 100644 --- a/Cellular-Automata/test/ConwaysGameOfLife.test.js +++ b/Cellular-Automata/test/ConwaysGameOfLife.test.js @@ -2,7 +2,16 @@ import { newGeneration } from '../ConwaysGameOfLife' describe('newGeneration', () => { it('should produce the next generation according to the rules', () => { - expect(newGeneration([[0, 1, 0], [0, 1, 0], [0, 1, 0]])) - .toEqual([[0, 0, 0], [1, 1, 1], [0, 0, 0]]) + expect( + newGeneration([ + [0, 1, 0], + [0, 1, 0], + [0, 1, 0] + ]) + ).toEqual([ + [0, 0, 0], + [1, 1, 1], + [0, 0, 0] + ]) }) }) diff --git a/Cellular-Automata/test/Elementary.test.js b/Cellular-Automata/test/Elementary.test.js index 7f868584b9..7c41163818 100644 --- a/Cellular-Automata/test/Elementary.test.js +++ b/Cellular-Automata/test/Elementary.test.js @@ -3,91 +3,137 @@ import { getNextElementaryGeneration } from '../Elementary' describe('Elementary Cellular Automata', () => { describe('Rule Errors', () => { it('Correct', () => { - expect(() => getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 128)).not.toThrow() + expect(() => + getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 128) + ).not.toThrow() }) it('Less than 0', () => { - expect(() => getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], -1)).toThrow() + expect(() => + getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], -1) + ).toThrow() }) it('Greater than 255', () => { - expect(() => getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 256)).toThrow() + expect(() => + getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 256) + ).toThrow() }) it('Decimal', () => { - expect(() => getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 100.4)).toThrow() + expect(() => + getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 100.4) + ).toThrow() }) }) describe('Rule 54 Iterations', () => { it('Generation 1', () => { - expect(getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 54)).toEqual([0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0]) + expect( + getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 54) + ).toEqual([0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0]) }) it('Generation 2', () => { - expect(getNextElementaryGeneration([0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], 54)).toEqual([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]) + expect( + getNextElementaryGeneration([0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], 54) + ).toEqual([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]) }) it('Generation 3', () => { - expect(getNextElementaryGeneration([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], 54)).toEqual([0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0]) + expect( + getNextElementaryGeneration([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], 54) + ).toEqual([0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0]) }) it('Generation 4', () => { - expect(getNextElementaryGeneration([0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0], 54)).toEqual([0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0]) + expect( + getNextElementaryGeneration([0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0], 54) + ).toEqual([0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0]) }) }) describe('Rule 222 Iterations', () => { it('Generation 1', () => { - expect(getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 222)).toEqual([0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0]) + expect( + getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 222) + ).toEqual([0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0]) }) it('Generation 2', () => { - expect(getNextElementaryGeneration([0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], 222)).toEqual([0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0]) + expect( + getNextElementaryGeneration([0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], 222) + ).toEqual([0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0]) }) it('Generation 3', () => { - expect(getNextElementaryGeneration([0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0], 222)).toEqual([0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0]) + expect( + getNextElementaryGeneration([0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0], 222) + ).toEqual([0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0]) }) it('Generation 4', () => { - expect(getNextElementaryGeneration([0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0], 222)).toEqual([0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]) + expect( + getNextElementaryGeneration([0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0], 222) + ).toEqual([0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]) }) }) describe('Rule 60 Iterations', () => { it('Generation 1', () => { - expect(getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 60)).toEqual([0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0]) + expect( + getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 60) + ).toEqual([0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0]) }) it('Generation 2', () => { - expect(getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0], 60)).toEqual([0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0]) + expect( + getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0], 60) + ).toEqual([0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0]) }) it('Generation 3', () => { - expect(getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0], 60)).toEqual([0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0]) + expect( + getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0], 60) + ).toEqual([0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0]) }) it('Generation 4', () => { - expect(getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0], 60)).toEqual([0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0]) + expect( + getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0], 60) + ).toEqual([0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0]) }) }) describe('Rule 90 Iterations', () => { it('Generation 1', () => { - expect(getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 90)).toEqual([0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0]) + expect( + getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 90) + ).toEqual([0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0]) }) it('Generation 2', () => { - expect(getNextElementaryGeneration([0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], 90)).toEqual([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]) + expect( + getNextElementaryGeneration([0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], 90) + ).toEqual([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]) }) it('Generation 3', () => { - expect(getNextElementaryGeneration([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], 90)).toEqual([0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0]) + expect( + getNextElementaryGeneration([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], 90) + ).toEqual([0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0]) }) it('Generation 4', () => { - expect(getNextElementaryGeneration([0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0], 90)).toEqual([0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0]) + expect( + getNextElementaryGeneration([0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0], 90) + ).toEqual([0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0]) }) }) describe('Rule 30 Iterations', () => { it('Generation 1', () => { - expect(getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 30)).toEqual([0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0]) + expect( + getNextElementaryGeneration([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 30) + ).toEqual([0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0]) }) it('Generation 2', () => { - expect(getNextElementaryGeneration([0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], 30)).toEqual([0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0]) + expect( + getNextElementaryGeneration([0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], 30) + ).toEqual([0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0]) }) it('Generation 3', () => { - expect(getNextElementaryGeneration([0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0], 30)).toEqual([0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0]) + expect( + getNextElementaryGeneration([0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0], 30) + ).toEqual([0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0]) }) }) }) diff --git a/Ciphers/AffineCipher.js b/Ciphers/AffineCipher.js index 7aa590c4fe..c5097daf89 100644 --- a/Ciphers/AffineCipher.js +++ b/Ciphers/AffineCipher.js @@ -13,7 +13,7 @@ const key = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' * @param {Number} m - Modulos value * @return {Number} Return n mod m */ -function mod (n, m) { +function mod(n, m) { return ((n % m) + m) % m } @@ -23,7 +23,7 @@ function mod (n, m) { * @param {Number} m - Modulos value * @return {Number} Return modular multiplicative inverse of coefficient a and modulos m */ -function inverseMod (a, m) { +function inverseMod(a, m) { for (let x = 1; x < m; x++) { if (mod(a * x, m) === 1) return x } @@ -36,7 +36,7 @@ function inverseMod (a, m) { * @param {Number} b - B coefficient to be checked * @return {Boolean} Result of the checking */ -function isCorrectFormat (str, a, b) { +function isCorrectFormat(str, a, b) { if (typeof a !== 'number' || typeof b !== 'number') { throw new TypeError('Coefficient a, b should be number') } @@ -57,8 +57,8 @@ function isCorrectFormat (str, a, b) { * @param {String} char - Character index to be found * @return {Boolean} Character index */ -function findCharIndex (char) { - return char.toUpperCase().charCodeAt(0) - ('A').charCodeAt(0) +function findCharIndex(char) { + return char.toUpperCase().charCodeAt(0) - 'A'.charCodeAt(0) } /** @@ -69,7 +69,7 @@ function findCharIndex (char) { * @return {String} result - Encrypted string */ -function encrypt (str, a, b) { +function encrypt(str, a, b) { let result = '' if (isCorrectFormat(str, a, b)) { for (let x = 0; x < str.length; x++) { @@ -88,7 +88,7 @@ function encrypt (str, a, b) { * @param {Number} b - B coefficient * @return {String} result - Decrypted string */ -function decrypt (str, a, b) { +function decrypt(str, a, b) { let result = '' if (isCorrectFormat(str, a, b)) { str = str.split(' ') diff --git a/Ciphers/KeyFinder.js b/Ciphers/KeyFinder.js index add581f65b..b9121e1d91 100644 --- a/Ciphers/KeyFinder.js +++ b/Ciphers/KeyFinder.js @@ -2,7 +2,8 @@ Find and retrieve the encryption key automatically Note: This is a draft version, please help to modify, Thanks! ******************************************************/ -function keyFinder (str) { // str is used to get the input of encrypted string +function keyFinder(str) { + // str is used to get the input of encrypted string const wordBank = [ 'I ', 'You ', @@ -27,13 +28,15 @@ function keyFinder (str) { // str is used to get the input of encrypted string ' may ', 'May ', ' be ', - 'Be '] + 'Be ' + ] // let wordbankelementCounter = 0; // let key = 0; // return zero means the key can not be found const inStr = str.toString() // convert the input to String let outStr = '' // store the output value let outStrElement = '' // temporary store the word inside the outStr, it is used for comparison - for (let k = 0; k < 26; k++) { // try the number of key shifted, the sum of character from a-z or A-Z is 26 + for (let k = 0; k < 26; k++) { + // try the number of key shifted, the sum of character from a-z or A-Z is 26 outStr = caesarCipherEncodeAndDecodeEngine(inStr, k) // use the encryption engine to decrypt the input string // loop through the whole input string @@ -57,7 +60,7 @@ function keyFinder (str) { // str is used to get the input of encrypted string } /* this sub-function is used to assist the keyFinder to find the key */ -function caesarCipherEncodeAndDecodeEngine (inStr, numShifted) { +function caesarCipherEncodeAndDecodeEngine(inStr, numShifted) { const shiftNum = numShifted let charCode = 0 let outStr = '' @@ -69,7 +72,7 @@ function caesarCipherEncodeAndDecodeEngine (inStr, numShifted) { shiftedCharCode = charCode + shiftNum result = charCode - if ((charCode >= 48 && charCode <= 57)) { + if (charCode >= 48 && charCode <= 57) { if (shiftedCharCode < 48) { let diff = Math.abs(48 - 1 - shiftedCharCode) % 10 @@ -95,11 +98,11 @@ function caesarCipherEncodeAndDecodeEngine (inStr, numShifted) { result = shiftedCharCode } - } else if ((charCode >= 65 && charCode <= 90)) { + } else if (charCode >= 65 && charCode <= 90) { if (shiftedCharCode <= 64) { let diff = Math.abs(65 - 1 - shiftedCharCode) % 26 - while ((diff % 26) >= 26) { + while (diff % 26 >= 26) { diff = diff % 26 } shiftedCharCode = 90 - diff @@ -109,17 +112,17 @@ function caesarCipherEncodeAndDecodeEngine (inStr, numShifted) { } else if (shiftedCharCode > 90) { let diff = Math.abs(shiftedCharCode - 1 - 90) % 26 - while ((diff % 26) >= 26) { + while (diff % 26 >= 26) { diff = diff % 26 } shiftedCharCode = 65 + diff result = shiftedCharCode } - } else if ((charCode >= 97 && charCode <= 122)) { + } else if (charCode >= 97 && charCode <= 122) { if (shiftedCharCode <= 96) { let diff = Math.abs(97 - 1 - shiftedCharCode) % 26 - while ((diff % 26) >= 26) { + while (diff % 26 >= 26) { diff = diff % 26 } shiftedCharCode = 122 - diff @@ -129,7 +132,7 @@ function caesarCipherEncodeAndDecodeEngine (inStr, numShifted) { } else if (shiftedCharCode > 122) { let diff = Math.abs(shiftedCharCode - 1 - 122) % 26 - while ((diff % 26) >= 26) { + while (diff % 26 >= 26) { diff = diff % 26 } shiftedCharCode = 97 + diff diff --git a/Ciphers/KeywordShiftedAlphabet.js b/Ciphers/KeywordShiftedAlphabet.js index 97656a5942..2c6f91fe48 100644 --- a/Ciphers/KeywordShiftedAlphabet.js +++ b/Ciphers/KeywordShiftedAlphabet.js @@ -16,9 +16,36 @@ * Non alphabetical characters (space, exclamation mark, ...) are kept as they are */ -const alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] +const alphabet = [ + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z' +] -function checkKeywordValidity (keyword) { +function checkKeywordValidity(keyword) { keyword.split('').forEach((char, index) => { const rest = keyword.slice(0, index) + keyword.slice(index + 1) if (rest.indexOf(char) !== -1) { @@ -28,7 +55,7 @@ function checkKeywordValidity (keyword) { return true } -function getEncryptedAlphabet (keyword) { +function getEncryptedAlphabet(keyword) { const encryptedAlphabet = keyword.split('') alphabet.forEach((char) => { if (encryptedAlphabet.indexOf(char) === -1) { @@ -38,17 +65,20 @@ function getEncryptedAlphabet (keyword) { return encryptedAlphabet } -function translate (sourceAlphabet, targetAlphabet, message) { +function translate(sourceAlphabet, targetAlphabet, message) { return message.split('').reduce((encryptedMessage, char) => { const isUpperCase = char === char.toUpperCase() const encryptedCharIndex = sourceAlphabet.indexOf(char.toLowerCase()) - const encryptedChar = encryptedCharIndex !== -1 ? targetAlphabet[encryptedCharIndex] : char - encryptedMessage += isUpperCase ? encryptedChar.toUpperCase() : encryptedChar + const encryptedChar = + encryptedCharIndex !== -1 ? targetAlphabet[encryptedCharIndex] : char + encryptedMessage += isUpperCase + ? encryptedChar.toUpperCase() + : encryptedChar return encryptedMessage }, '') } -function checkInputs (keyword, message) { +function checkInputs(keyword, message) { if (!keyword || !message) { throw new Error('Both keyword and message must be specified') } @@ -58,14 +88,22 @@ function checkInputs (keyword, message) { } } -function encrypt (keyword, message) { +function encrypt(keyword, message) { checkInputs(keyword, message) - return translate(alphabet, getEncryptedAlphabet(keyword.toLowerCase()), message) + return translate( + alphabet, + getEncryptedAlphabet(keyword.toLowerCase()), + message + ) } -function decrypt (keyword, message) { +function decrypt(keyword, message) { checkInputs(keyword, message) - return translate(getEncryptedAlphabet(keyword.toLowerCase()), alphabet, message) + return translate( + getEncryptedAlphabet(keyword.toLowerCase()), + alphabet, + message + ) } export { encrypt, decrypt } diff --git a/Ciphers/MorseCode.js b/Ciphers/MorseCode.js index 9c64a39a25..eeb580d520 100644 --- a/Ciphers/MorseCode.js +++ b/Ciphers/MorseCode.js @@ -50,7 +50,7 @@ const morse = (msg, dot = '*', dash = '-') => { ',': '--**--', '?': '**--**', '!': '-*-*--', - '\'': '*----*', + "'": '*----*', '"': '*-**-*', '(': '-*--*', ')': '-*--*-', @@ -68,16 +68,21 @@ const morse = (msg, dot = '*', dash = '-') => { let newMsg = '' - msg.toString().split('').forEach((e) => { - if (/[a-zA-Z]/.test(e)) { - newMsg += key[e.toUpperCase()].replaceAll('*', dot).replaceAll('-', dash) - } else if (Object.keys(key).includes(e)) { - newMsg += key[e].replaceAll('*', dot).replaceAll('-', dash) - } else { - newMsg += e - } - newMsg += ' ' - }) + msg + .toString() + .split('') + .forEach((e) => { + if (/[a-zA-Z]/.test(e)) { + newMsg += key[e.toUpperCase()] + .replaceAll('*', dot) + .replaceAll('-', dash) + } else if (Object.keys(key).includes(e)) { + newMsg += key[e].replaceAll('*', dot).replaceAll('-', dash) + } else { + newMsg += e + } + newMsg += ' ' + }) return newMsg.trim() } diff --git a/Ciphers/ROT13.js b/Ciphers/ROT13.js index 60208a3e14..3bddb389af 100644 --- a/Ciphers/ROT13.js +++ b/Ciphers/ROT13.js @@ -5,7 +5,7 @@ * @param {String} str - string to be decrypted * @return {String} decrypted string */ -function ROT13 (str) { +function ROT13(str) { if (typeof str !== 'string') { throw new TypeError('Argument should be string') } diff --git a/Ciphers/VigenereCipher.js b/Ciphers/VigenereCipher.js index 74d7358a96..9967b0a174 100644 --- a/Ciphers/VigenereCipher.js +++ b/Ciphers/VigenereCipher.js @@ -3,7 +3,7 @@ * @param {String} str - character to check * @return {object} An array with the character or null if isn't a letter */ -function isLetter (str) { +function isLetter(str) { return str.length === 1 && str.match(/[a-zA-Z]/i) } @@ -12,7 +12,7 @@ function isLetter (str) { * @param {String} character - character to check * @return {Boolean} result of the checking */ -function isUpperCase (character) { +function isUpperCase(character) { if (character === character.toUpperCase()) { return true } @@ -27,16 +27,22 @@ function isUpperCase (character) { * @param {String} key - key for encrypt * @return {String} result - encrypted string */ -function encrypt (message, key) { +function encrypt(message, key) { let result = '' for (let i = 0, j = 0; i < message.length; i++) { const c = message.charAt(i) if (isLetter(c)) { if (isUpperCase(c)) { - result += String.fromCharCode((c.charCodeAt(0) + key.toUpperCase().charCodeAt(j) - 2 * 65) % 26 + 65) // A: 65 + result += String.fromCharCode( + ((c.charCodeAt(0) + key.toUpperCase().charCodeAt(j) - 2 * 65) % 26) + + 65 + ) // A: 65 } else { - result += String.fromCharCode((c.charCodeAt(0) + key.toLowerCase().charCodeAt(j) - 2 * 97) % 26 + 97) // a: 97 + result += String.fromCharCode( + ((c.charCodeAt(0) + key.toLowerCase().charCodeAt(j) - 2 * 97) % 26) + + 97 + ) // a: 97 } } else { result += c @@ -52,16 +58,21 @@ function encrypt (message, key) { * @param {String} key - key for decrypt * @return {String} result - decrypted string */ -function decrypt (message, key) { +function decrypt(message, key) { let result = '' for (let i = 0, j = 0; i < message.length; i++) { const c = message.charAt(i) if (isLetter(c)) { if (isUpperCase(c)) { - result += String.fromCharCode(90 - (25 - (c.charCodeAt(0) - key.toUpperCase().charCodeAt(j))) % 26) + result += String.fromCharCode( + 90 - ((25 - (c.charCodeAt(0) - key.toUpperCase().charCodeAt(j))) % 26) + ) } else { - result += String.fromCharCode(122 - (25 - (c.charCodeAt(0) - key.toLowerCase().charCodeAt(j))) % 26) + result += String.fromCharCode( + 122 - + ((25 - (c.charCodeAt(0) - key.toLowerCase().charCodeAt(j))) % 26) + ) } } else { result += c diff --git a/Ciphers/XORCipher.js b/Ciphers/XORCipher.js index d73827a2ed..91b7134c3f 100644 --- a/Ciphers/XORCipher.js +++ b/Ciphers/XORCipher.js @@ -14,8 +14,8 @@ const XORCipher = (str, key) => { throw new TypeError('Arguments type are invalid') } - return str.replace( - /./g, (char) => String.fromCharCode(char.charCodeAt() ^ key) + return str.replace(/./g, (char) => + String.fromCharCode(char.charCodeAt() ^ key) ) } diff --git a/Ciphers/test/CaesarCipher.test.js b/Ciphers/test/CaesarCipher.test.js index b3d9eff9df..c39c09d061 100644 --- a/Ciphers/test/CaesarCipher.test.js +++ b/Ciphers/test/CaesarCipher.test.js @@ -9,8 +9,14 @@ describe('Testing the caesarsCipher function', () => { it('Test - 2, Testing for valid string and rotation', () => { expect(caesarCipher('middle-Outz', 2)).toBe('okffng-Qwvb') - expect(caesarCipher('abcdefghijklmnopqrstuvwxyz', 3)).toBe('defghijklmnopqrstuvwxyzabc') - expect(caesarCipher('Always-Look-on-the-Bright-Side-of-Life', 5)).toBe('Fqbfdx-Qttp-ts-ymj-Gwnlmy-Xnij-tk-Qnkj') - expect(caesarCipher('THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG', 23)).toBe('QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD') + expect(caesarCipher('abcdefghijklmnopqrstuvwxyz', 3)).toBe( + 'defghijklmnopqrstuvwxyzabc' + ) + expect(caesarCipher('Always-Look-on-the-Bright-Side-of-Life', 5)).toBe( + 'Fqbfdx-Qttp-ts-ymj-Gwnlmy-Xnij-tk-Qnkj' + ) + expect( + caesarCipher('THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG', 23) + ).toBe('QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD') }) }) diff --git a/Ciphers/test/KeywordShiftedAlphabet.test.js b/Ciphers/test/KeywordShiftedAlphabet.test.js index 7fd153c972..38e0839488 100644 --- a/Ciphers/test/KeywordShiftedAlphabet.test.js +++ b/Ciphers/test/KeywordShiftedAlphabet.test.js @@ -1,13 +1,13 @@ -import { encrypt, decrypt } from '../KeywordShiftedAlphabet' - -test('Hello world! === decrypt(encrypt(Hello world!))', () => { - const word = 'Hello world!' - const result = decrypt('keyword', encrypt('keyword', word)) - expect(result).toMatch(word) -}) - -test('The Algorithms === decrypt(encrypt(The Algorithms))', () => { - const word = 'The Algorithms' - const result = decrypt('keyword', encrypt('keyword', word)) - expect(result).toMatch(word) -}) +import { encrypt, decrypt } from '../KeywordShiftedAlphabet' + +test('Hello world! === decrypt(encrypt(Hello world!))', () => { + const word = 'Hello world!' + const result = decrypt('keyword', encrypt('keyword', word)) + expect(result).toMatch(word) +}) + +test('The Algorithms === decrypt(encrypt(The Algorithms))', () => { + const word = 'The Algorithms' + const result = decrypt('keyword', encrypt('keyword', word)) + expect(result).toMatch(word) +}) diff --git a/Ciphers/test/MorseCode.test.js b/Ciphers/test/MorseCode.test.js index 5dd4e07959..4785ad3aa4 100644 --- a/Ciphers/test/MorseCode.test.js +++ b/Ciphers/test/MorseCode.test.js @@ -2,12 +2,16 @@ import { morse } from '../MorseCode' describe('Testing morse function', () => { it('should return an enciphered string with a given input string', () => { - expect(morse('Hello World!')).toBe('**** * *-** *-** --- *-- --- *-* *-** -** -*-*--') + expect(morse('Hello World!')).toBe( + '**** * *-** *-** --- *-- --- *-* *-** -** -*-*--' + ) expect(morse('1+1=2')).toBe('*---- *-*-* *---- -***- **---') }) it('should leave symbols that does not have its corresponding morse representation', () => { - expect(morse('© 2023 GitHub, Inc.')).toBe('© **--- ----- **--- ***-- --* ** - **** **- -*** --**-- ** -* -*-* *-*-*-') + expect(morse('© 2023 GitHub, Inc.')).toBe( + '© **--- ----- **--- ***-- --* ** - **** **- -*** --**-- ** -* -*-* *-*-*-' + ) }) it('should be able to accept custom morse code symbols', () => { diff --git a/Ciphers/test/ROT13.test.js b/Ciphers/test/ROT13.test.js index 82aa0837ad..d600cf64b4 100644 --- a/Ciphers/test/ROT13.test.js +++ b/Ciphers/test/ROT13.test.js @@ -12,7 +12,11 @@ describe('Testing ROT13 function', () => { it('Test - 2, passing a string as an argument', () => { expect(ROT13('Uryyb Jbeyq')).toBe('Hello World') - expect(ROT13('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz')).toBe('NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm') - expect(ROT13('The quick brown fox jumps over the lazy dog')).toBe('Gur dhvpx oebja sbk whzcf bire gur ynml qbt') + expect(ROT13('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz')).toBe( + 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm' + ) + expect(ROT13('The quick brown fox jumps over the lazy dog')).toBe( + 'Gur dhvpx oebja sbk whzcf bire gur ynml qbt' + ) }) }) diff --git a/Ciphers/test/VigenereCipher.test.js b/Ciphers/test/VigenereCipher.test.js index 83ba405046..c7c154a958 100644 --- a/Ciphers/test/VigenereCipher.test.js +++ b/Ciphers/test/VigenereCipher.test.js @@ -1,13 +1,13 @@ -import { encrypt, decrypt } from '../VigenereCipher' - -test('Hello world! === decrypt(encrypt(Hello world!))', () => { - const word = 'Hello world!' - const result = decrypt(encrypt(word, 'code'), 'code') - expect(result).toMatch(word) -}) - -test('The Algorithms === decrypt(encrypt(The Algorithms))', () => { - const word = 'The Algorithms' - const result = decrypt(encrypt(word, 'code'), 'code') - expect(result).toMatch(word) -}) +import { encrypt, decrypt } from '../VigenereCipher' + +test('Hello world! === decrypt(encrypt(Hello world!))', () => { + const word = 'Hello world!' + const result = decrypt(encrypt(word, 'code'), 'code') + expect(result).toMatch(word) +}) + +test('The Algorithms === decrypt(encrypt(The Algorithms))', () => { + const word = 'The Algorithms' + const result = decrypt(encrypt(word, 'code'), 'code') + expect(result).toMatch(word) +}) diff --git a/Conversions/ArbitraryBase.js b/Conversions/ArbitraryBase.js index 33c88d5c1b..d743c361c8 100644 --- a/Conversions/ArbitraryBase.js +++ b/Conversions/ArbitraryBase.js @@ -1,9 +1,9 @@ /** -* Divide two numbers and get the result of floor division and remainder -* @param {number} dividend -* @param {number} divisor -* @returns {[result: number, remainder: number]} -*/ + * Divide two numbers and get the result of floor division and remainder + * @param {number} dividend + * @param {number} divisor + * @returns {[result: number, remainder: number]} + */ const floorDiv = (dividend, divisor) => { const remainder = dividend % divisor const result = Math.floor(dividend / divisor) @@ -12,14 +12,22 @@ const floorDiv = (dividend, divisor) => { } /** -* Converts a string from one base to other. Loses accuracy above the value of `Number.MAX_SAFE_INTEGER`. -* @param {string} stringInBaseOne String in input base -* @param {string} baseOneCharacters Character set for the input base -* @param {string} baseTwoCharacters Character set for the output base -* @returns {string} -*/ -const convertArbitraryBase = (stringInBaseOne, baseOneCharacterString, baseTwoCharacterString) => { - if ([stringInBaseOne, baseOneCharacterString, baseTwoCharacterString].map(arg => typeof arg).some(type => type !== 'string')) { + * Converts a string from one base to other. Loses accuracy above the value of `Number.MAX_SAFE_INTEGER`. + * @param {string} stringInBaseOne String in input base + * @param {string} baseOneCharacters Character set for the input base + * @param {string} baseTwoCharacters Character set for the output base + * @returns {string} + */ +const convertArbitraryBase = ( + stringInBaseOne, + baseOneCharacterString, + baseTwoCharacterString +) => { + if ( + [stringInBaseOne, baseOneCharacterString, baseTwoCharacterString] + .map((arg) => typeof arg) + .some((type) => type !== 'string') + ) { throw new TypeError('Only string arguments are allowed') } @@ -28,7 +36,9 @@ const convertArbitraryBase = (stringInBaseOne, baseOneCharacterString, baseTwoCh for (const charactersInBase of [baseOneCharacters, baseTwoCharacters]) { if (charactersInBase.length !== new Set(charactersInBase).size) { - throw new TypeError('Duplicate characters in character set are not allowed') + throw new TypeError( + 'Duplicate characters in character set are not allowed' + ) } } const reversedStringOneChars = [...stringInBaseOne].reverse() @@ -40,7 +50,7 @@ const convertArbitraryBase = (stringInBaseOne, baseOneCharacterString, baseTwoCh if (digitNumber === -1) { throw new TypeError(`Not a valid character: ${digit}`) } - value += (digitNumber * placeValue) + value += digitNumber * placeValue placeValue *= stringOneBase } const outputChars = [] @@ -54,14 +64,22 @@ const convertArbitraryBase = (stringInBaseOne, baseOneCharacterString, baseTwoCh } /** -* Converts a arbitrary-length string from one base to other. Doesn't lose accuracy. -* @param {string} stringInBaseOne String in input base -* @param {string} baseOneCharacters Character set for the input base -* @param {string} baseTwoCharacters Character set for the output base -* @returns {string} -*/ -const convertArbitraryBaseBigIntVersion = (stringInBaseOne, baseOneCharacterString, baseTwoCharacterString) => { - if ([stringInBaseOne, baseOneCharacterString, baseTwoCharacterString].map(arg => typeof arg).some(type => type !== 'string')) { + * Converts a arbitrary-length string from one base to other. Doesn't lose accuracy. + * @param {string} stringInBaseOne String in input base + * @param {string} baseOneCharacters Character set for the input base + * @param {string} baseTwoCharacters Character set for the output base + * @returns {string} + */ +const convertArbitraryBaseBigIntVersion = ( + stringInBaseOne, + baseOneCharacterString, + baseTwoCharacterString +) => { + if ( + [stringInBaseOne, baseOneCharacterString, baseTwoCharacterString] + .map((arg) => typeof arg) + .some((type) => type !== 'string') + ) { throw new TypeError('Only string arguments are allowed') } @@ -70,7 +88,9 @@ const convertArbitraryBaseBigIntVersion = (stringInBaseOne, baseOneCharacterStri for (const charactersInBase of [baseOneCharacters, baseTwoCharacters]) { if (charactersInBase.length !== new Set(charactersInBase).size) { - throw new TypeError('Duplicate characters in character set are not allowed') + throw new TypeError( + 'Duplicate characters in character set are not allowed' + ) } } const reversedStringOneChars = [...stringInBaseOne].reverse() @@ -82,7 +102,7 @@ const convertArbitraryBaseBigIntVersion = (stringInBaseOne, baseOneCharacterStri if (digitNumber === -1n) { throw new TypeError(`Not a valid character: ${digit}`) } - value += (digitNumber * placeValue) + value += digitNumber * placeValue placeValue *= stringOneBase } const outputChars = [] diff --git a/Conversions/ArrayBufferToBase64.js b/Conversions/ArrayBufferToBase64.js index 9d97427e2f..1718501abc 100644 --- a/Conversions/ArrayBufferToBase64.js +++ b/Conversions/ArrayBufferToBase64.js @@ -5,9 +5,10 @@ * @param {ArrayBuffer} binaryData An ArrayBuffer which represents an array of bytes * @returns {string} A string containing the base64 encoding of `binaryData` */ -function bufferToBase64 (binaryData) { +function bufferToBase64(binaryData) { // The base64 encoding uses the following set of characters to encode any binary data as text - const base64Table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' + const base64Table = + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' // Every 3 bytes translates to 4 base64 characters, if we have less than 3 bytes we must append '=' chars as padding const padding = 3 - (binaryData.byteLength % 3) // Create an instance of Uint8Array, to read from the binaryData array buffer @@ -23,15 +24,16 @@ function bufferToBase64 (binaryData) { const char4 = byteView[i + 2] & 63 result += - base64Table[char1] + - base64Table[char2] + - base64Table[char3] + - base64Table[char4] + base64Table[char1] + + base64Table[char2] + + base64Table[char3] + + base64Table[char4] } // Add padding '=' chars if needed if (padding !== 3) { - const paddedResult = result.slice(0, result.length - padding) + '='.repeat(padding) + const paddedResult = + result.slice(0, result.length - padding) + '='.repeat(padding) return paddedResult } diff --git a/Conversions/Base64ToArrayBuffer.js b/Conversions/Base64ToArrayBuffer.js index a23f151b66..8b4f855121 100644 --- a/Conversions/Base64ToArrayBuffer.js +++ b/Conversions/Base64ToArrayBuffer.js @@ -5,9 +5,10 @@ * @param {string} b64 A base64 string * @returns {ArrayBuffer} An ArrayBuffer representing the bytes encoded by the base64 string */ -function base64ToBuffer (b64) { +function base64ToBuffer(b64) { // The base64 encoding uses the following set of characters to encode any binary data as text - const base64Table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' + const base64Table = + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' // Find the index of char '=' first occurrence const paddingIdx = b64.indexOf('=') // Remove padding chars from base64 string, if there are any diff --git a/Conversions/BinaryToDecimal.js b/Conversions/BinaryToDecimal.js index f5a9086581..d149de0df2 100644 --- a/Conversions/BinaryToDecimal.js +++ b/Conversions/BinaryToDecimal.js @@ -1,8 +1,8 @@ -export default function binaryToDecimal (binaryString) { +export default function binaryToDecimal(binaryString) { let decimalNumber = 0 const binaryDigits = binaryString.split('').reverse() // Splits the binary number into reversed single digits binaryDigits.forEach((binaryDigit, index) => { - decimalNumber += binaryDigit * (Math.pow(2, index)) // Summation of all the decimal converted digits + decimalNumber += binaryDigit * Math.pow(2, index) // Summation of all the decimal converted digits }) return decimalNumber } diff --git a/Conversions/BinaryToHex.js b/Conversions/BinaryToHex.js index 27c9ccbac7..d7f253b222 100644 --- a/Conversions/BinaryToHex.js +++ b/Conversions/BinaryToHex.js @@ -9,22 +9,38 @@ const hexLookup = (bin) => { binary = pad(binary, 4) } switch (binary) { - case '0000': return '0' - case '0001': return '1' - case '0010': return '2' - case '0011': return '3' - case '0100': return '4' - case '0101': return '5' - case '0110': return '6' - case '0111': return '7' - case '1000': return '8' - case '1001': return '9' - case '1010': return 'A' - case '1011': return 'B' - case '1100': return 'C' - case '1101': return 'D' - case '1110': return 'E' - case '1111': return 'F' + case '0000': + return '0' + case '0001': + return '1' + case '0010': + return '2' + case '0011': + return '3' + case '0100': + return '4' + case '0101': + return '5' + case '0110': + return '6' + case '0111': + return '7' + case '1000': + return '8' + case '1001': + return '9' + case '1010': + return 'A' + case '1011': + return 'B' + case '1100': + return 'C' + case '1101': + return 'D' + case '1110': + return 'E' + case '1111': + return 'F' } } const binaryToHex = (binaryString) => { diff --git a/Conversions/DateDayDifference.js b/Conversions/DateDayDifference.js index b2dfc45ebd..770b64c174 100644 --- a/Conversions/DateDayDifference.js +++ b/Conversions/DateDayDifference.js @@ -14,7 +14,15 @@ const isLeap = (year) => { else return false } const DateToDay = (dd, mm, yyyy) => { - return Math.floor((365 * (yyyy - 1)) + ((yyyy - 1) / 4) - ((yyyy - 1) / 100) + ((yyyy - 1) / 400) + dd + (((367 * mm) - 362) / 12) + (mm <= 2 ? 0 : isLeap(yyyy) ? -1 : -2)) + return Math.floor( + 365 * (yyyy - 1) + + (yyyy - 1) / 4 - + (yyyy - 1) / 100 + + (yyyy - 1) / 400 + + dd + + (367 * mm - 362) / 12 + + (mm <= 2 ? 0 : isLeap(yyyy) ? -1 : -2) + ) } const DateDayDifference = (date1, date2) => { @@ -23,17 +31,30 @@ const DateDayDifference = (date1, date2) => { return new TypeError('Argument is not a string.') } // extract the first date - const [firstDateDay, firstDateMonth, firstDateYear] = date1.split('/').map((ele) => Number(ele)) + const [firstDateDay, firstDateMonth, firstDateYear] = date1 + .split('/') + .map((ele) => Number(ele)) // extract the second date - const [secondDateDay, secondDateMonth, secondDateYear] = date2.split('/').map((ele) => Number(ele)) + const [secondDateDay, secondDateMonth, secondDateYear] = date2 + .split('/') + .map((ele) => Number(ele)) // check the both data are valid or not. - if (firstDateDay < 0 || firstDateDay > 31 || - firstDateMonth > 12 || firstDateMonth < 0 || - secondDateDay < 0 || secondDateDay > 31 || - secondDateMonth > 12 || secondDateMonth < 0) { + if ( + firstDateDay < 0 || + firstDateDay > 31 || + firstDateMonth > 12 || + firstDateMonth < 0 || + secondDateDay < 0 || + secondDateDay > 31 || + secondDateMonth > 12 || + secondDateMonth < 0 + ) { return new TypeError('Date is not valid.') } - return Math.abs(DateToDay(secondDateDay, secondDateMonth, secondDateYear) - DateToDay(firstDateDay, firstDateMonth, firstDateYear)) + return Math.abs( + DateToDay(secondDateDay, secondDateMonth, secondDateYear) - + DateToDay(firstDateDay, firstDateMonth, firstDateYear) + ) } // Example : DateDayDifference('17/08/2002', '10/10/2020') => 6630 diff --git a/Conversions/DateToDay.js b/Conversions/DateToDay.js index a22f75ca3f..378489e50e 100644 --- a/Conversions/DateToDay.js +++ b/Conversions/DateToDay.js @@ -13,7 +13,15 @@ */ // Array holding name of the day: Saturday - Sunday - Friday => 0 - 1 - 6 -const daysNameArr = ['Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'] +const daysNameArr = [ + 'Saturday', + 'Sunday', + 'Monday', + 'Tuesday', + 'Wednesday', + 'Thursday', + 'Friday' +] const DateToDay = (date) => { // firstly, check that input is a string or not. @@ -53,7 +61,14 @@ const DateToDay = (date) => { Without the adaption, the formula yields `weekDay = -6` for the date 2/3/2014; With the adaption, it yields the positive result `weekDay = 7 - 6 = 1` (Sunday), which is what we need to index the array */ - const weekDay = (day + Math.floor((month + 1) * 2.6) + yearDigits + Math.floor(yearDigits / 4) + Math.floor(century / 4) + 5 * century) % 7 + const weekDay = + (day + + Math.floor((month + 1) * 2.6) + + yearDigits + + Math.floor(yearDigits / 4) + + Math.floor(century / 4) + + 5 * century) % + 7 return daysNameArr[weekDay] // name of the weekday } diff --git a/Conversions/DecimalToBinary.js b/Conversions/DecimalToBinary.js index f0babd8a26..03b0df8bea 100644 --- a/Conversions/DecimalToBinary.js +++ b/Conversions/DecimalToBinary.js @@ -1,4 +1,4 @@ -function decimalToBinary (num) { +function decimalToBinary(num) { const bin = [] while (num > 0) { bin.unshift(num % 2) diff --git a/Conversions/DecimalToHex.js b/Conversions/DecimalToHex.js index f13a93e098..4382ce2c92 100644 --- a/Conversions/DecimalToHex.js +++ b/Conversions/DecimalToHex.js @@ -1,16 +1,22 @@ -function intToHex (num) { +function intToHex(num) { switch (num) { - case 10: return 'A' - case 11: return 'B' - case 12: return 'C' - case 13: return 'D' - case 14: return 'E' - case 15: return 'F' + case 10: + return 'A' + case 11: + return 'B' + case 12: + return 'C' + case 13: + return 'D' + case 14: + return 'E' + case 15: + return 'F' } return num } -function decimalToHex (num) { +function decimalToHex(num) { const hexOut = [] while (num > 15) { hexOut.unshift(intToHex(num % 16)) diff --git a/Conversions/DecimalToOctal.js b/Conversions/DecimalToOctal.js index 06877c0f89..82b3cfe142 100644 --- a/Conversions/DecimalToOctal.js +++ b/Conversions/DecimalToOctal.js @@ -1,9 +1,9 @@ -function decimalToOctal (num) { +function decimalToOctal(num) { let oct = 0 let c = 0 while (num > 0) { const r = num % 8 - oct = oct + (r * Math.pow(10, c++)) + oct = oct + r * Math.pow(10, c++) num = Math.floor(num / 8) // basically /= 8 without remainder if any } return oct diff --git a/Conversions/DecimalToRoman.js b/Conversions/DecimalToRoman.js index 62126de37e..cea53fd1c6 100644 --- a/Conversions/DecimalToRoman.js +++ b/Conversions/DecimalToRoman.js @@ -38,7 +38,7 @@ const orders = [ 'I' ] -function decimalToRoman (num) { +function decimalToRoman(num) { let roman = '' for (const symbol of orders) { while (num >= values[symbol]) { diff --git a/Conversions/HexToBinary.js b/Conversions/HexToBinary.js index 2456dba016..913526fa84 100644 --- a/Conversions/HexToBinary.js +++ b/Conversions/HexToBinary.js @@ -1,21 +1,22 @@ -const binLookup = (key) => ({ - 0: '0000', - 1: '0001', - 2: '0010', - 3: '0011', - 4: '0100', - 5: '0101', - 6: '0110', - 7: '0111', - 8: '1000', - 9: '1001', - a: '1010', - b: '1011', - c: '1100', - d: '1101', - e: '1110', - f: '1111' -}[key.toLowerCase()]) // select the binary number by valid hex key with the help javascript object +const binLookup = (key) => + ({ + 0: '0000', + 1: '0001', + 2: '0010', + 3: '0011', + 4: '0100', + 5: '0101', + 6: '0110', + 7: '0111', + 8: '1000', + 9: '1001', + a: '1010', + b: '1011', + c: '1100', + d: '1101', + e: '1110', + f: '1111' + })[key.toLowerCase()] // select the binary number by valid hex key with the help javascript object const hexToBinary = (hexString) => { if (typeof hexString !== 'string') { @@ -32,10 +33,7 @@ const hexToBinary = (hexString) => { 2. Conversion goes by searching in the lookup table */ - return hexString.replace( - /[0-9a-f]/gi, - lexeme => binLookup(lexeme) - ) + return hexString.replace(/[0-9a-f]/gi, (lexeme) => binLookup(lexeme)) } export default hexToBinary diff --git a/Conversions/HexToDecimal.js b/Conversions/HexToDecimal.js index 9623d09a29..31ae13932f 100644 --- a/Conversions/HexToDecimal.js +++ b/Conversions/HexToDecimal.js @@ -1,22 +1,31 @@ -function hexToInt (hexNum) { +function hexToInt(hexNum) { const numArr = hexNum.split('') // converts number to array return numArr.map((item, index) => { switch (item) { - case 'A': return 10 - case 'B': return 11 - case 'C': return 12 - case 'D': return 13 - case 'E': return 14 - case 'F': return 15 - default: return parseInt(item) + case 'A': + return 10 + case 'B': + return 11 + case 'C': + return 12 + case 'D': + return 13 + case 'E': + return 14 + case 'F': + return 15 + default: + return parseInt(item) } }) } -function hexToDecimal (hexNum) { +function hexToDecimal(hexNum) { const intItemsArr = hexToInt(hexNum) return intItemsArr.reduce((accumulator, current, index) => { - return accumulator + (current * Math.pow(16, (intItemsArr.length - (1 + index)))) + return ( + accumulator + current * Math.pow(16, intItemsArr.length - (1 + index)) + ) }, 0) } diff --git a/Conversions/HexToRGB.js b/Conversions/HexToRGB.js index e726b5308d..b0cfc4a362 100644 --- a/Conversions/HexToRGB.js +++ b/Conversions/HexToRGB.js @@ -1,4 +1,4 @@ -function hexStringToRGB (hexString) { +function hexStringToRGB(hexString) { let r = hexString.substring(0, 2) let g = hexString.substring(2, 4) let b = hexString.substring(4, 6) diff --git a/Conversions/LengthConversion.js b/Conversions/LengthConversion.js index 36aedd416c..783be3fb8d 100644 --- a/Conversions/LengthConversion.js +++ b/Conversions/LengthConversion.js @@ -33,6 +33,4 @@ const lengthConversion = (length, fromUnit, toUnit) => { return convertedLength } -export { - lengthConversion -} +export { lengthConversion } diff --git a/Conversions/LowerCaseConversion.js b/Conversions/LowerCaseConversion.js index 39ba9aba6e..bdac7d1b5d 100644 --- a/Conversions/LowerCaseConversion.js +++ b/Conversions/LowerCaseConversion.js @@ -17,7 +17,7 @@ */ const LowerCaseConversion = (inputString) => { // Take a string and split it into characters. - const newString = inputString.split('').map(char => { + const newString = inputString.split('').map((char) => { // Get a character code by the use charCodeAt method. const presentCharCode = char.charCodeAt() // If the character code lies between 65 to 90 it means they are in the upper case so convert it. diff --git a/Conversions/OctToDecimal.js b/Conversions/OctToDecimal.js index b73cad3c4e..6ae685aa88 100644 --- a/Conversions/OctToDecimal.js +++ b/Conversions/OctToDecimal.js @@ -1,10 +1,10 @@ -function octalToDecimal (num) { +function octalToDecimal(num) { let dec = 0 let base = 1 while (num > 0) { const r = num % 10 num = Math.floor(num / 10) - dec = dec + (r * base) + dec = dec + r * base base = base * 8 } return dec diff --git a/Conversions/OuncesToKilograms.js b/Conversions/OuncesToKilograms.js index d39de85642..22c0f8aff3 100644 --- a/Conversions/OuncesToKilograms.js +++ b/Conversions/OuncesToKilograms.js @@ -5,7 +5,7 @@ * @param {number} oz - Amount of ounces to convert to kilograms */ const ouncesToKilograms = (oz) => { - return oz * 28.3498 / 1000 + return (oz * 28.3498) / 1000 } export default ouncesToKilograms diff --git a/Conversions/RGBToHex.js b/Conversions/RGBToHex.js index b453b350fc..c44e9917aa 100644 --- a/Conversions/RGBToHex.js +++ b/Conversions/RGBToHex.js @@ -1,13 +1,9 @@ -function RGBToHex (r, g, b) { - if ( - typeof r !== 'number' || - typeof g !== 'number' || - typeof b !== 'number' - ) { +function RGBToHex(r, g, b) { + if (typeof r !== 'number' || typeof g !== 'number' || typeof b !== 'number') { throw new TypeError('argument is not a Number') } - const toHex = n => (n || '0').toString(16).padStart(2, '0') + const toHex = (n) => (n || '0').toString(16).padStart(2, '0') return `#${toHex(r)}${toHex(g)}${toHex(b)}` } diff --git a/Conversions/RailwayTimeConversion.js b/Conversions/RailwayTimeConversion.js index 3d47a48271..fd4f9a5dad 100644 --- a/Conversions/RailwayTimeConversion.js +++ b/Conversions/RailwayTimeConversion.js @@ -23,12 +23,23 @@ const RailwayTimeConversion = (timeString) => { // split the string by ':' character. const [hour, minute, secondWithShift] = timeString.split(':') // split second and shift value. - const [second, shift] = [secondWithShift.substr(0, 2), secondWithShift.substr(2)] + const [second, shift] = [ + secondWithShift.substr(0, 2), + secondWithShift.substr(2) + ] // convert shifted time to not-shift time(Railway time) by using the above explanation. if (shift === 'PM') { - if (parseInt(hour) === 12) { return `${hour}:${minute}:${second}` } else { return `${parseInt(hour) + 12}:${minute}:${second}` } + if (parseInt(hour) === 12) { + return `${hour}:${minute}:${second}` + } else { + return `${parseInt(hour) + 12}:${minute}:${second}` + } } else { - if (parseInt(hour) === 12) { return `00:${minute}:${second}` } else { return `${hour}:${minute}:${second}` } + if (parseInt(hour) === 12) { + return `00:${minute}:${second}` + } else { + return `${hour}:${minute}:${second}` + } } } diff --git a/Conversions/RgbHsvConversion.js b/Conversions/RgbHsvConversion.js index 6582258cb4..d6d1714188 100644 --- a/Conversions/RgbHsvConversion.js +++ b/Conversions/RgbHsvConversion.js @@ -16,7 +16,7 @@ * @param value Brightness-value of the color. * @return The tuple of RGB-components. */ -export function hsvToRgb (hue, saturation, value) { +export function hsvToRgb(hue, saturation, value) { if (hue < 0 || hue > 360) { throw new Error('hue should be between 0 and 360') } @@ -31,7 +31,7 @@ export function hsvToRgb (hue, saturation, value) { const chroma = value * saturation const hueSection = hue / 60 - const secondLargestComponent = chroma * (1 - Math.abs(hueSection % 2 - 1)) + const secondLargestComponent = chroma * (1 - Math.abs((hueSection % 2) - 1)) const matchValue = value - chroma return getRgbBySection(hueSection, chroma, matchValue, secondLargestComponent) @@ -45,7 +45,7 @@ export function hsvToRgb (hue, saturation, value) { * @param blue Blue-component of the color. * @return The tuple of HSV-components. */ -export function rgbToHsv (red, green, blue) { +export function rgbToHsv(red, green, blue) { if (red < 0 || red > 255) { throw new Error('red should be between 0 and 255') } @@ -81,7 +81,7 @@ export function rgbToHsv (red, green, blue) { return [hue, saturation, value] } -export function approximatelyEqualHsv (hsv1, hsv2) { +export function approximatelyEqualHsv(hsv1, hsv2) { const bHue = Math.abs(hsv1[0] - hsv2[0]) < 0.2 const bSaturation = Math.abs(hsv1[1] - hsv2[1]) < 0.002 const bValue = Math.abs(hsv1[2] - hsv2[2]) < 0.002 @@ -89,8 +89,13 @@ export function approximatelyEqualHsv (hsv1, hsv2) { return bHue && bSaturation && bValue } -function getRgbBySection (hueSection, chroma, matchValue, secondLargestComponent) { - function convertToInt (input) { +function getRgbBySection( + hueSection, + chroma, + matchValue, + secondLargestComponent +) { + function convertToInt(input) { return Math.round(255 * input) } diff --git a/Conversions/RomanToDecimal.js b/Conversions/RomanToDecimal.js index f0f8359bf8..0d62a3d468 100644 --- a/Conversions/RomanToDecimal.js +++ b/Conversions/RomanToDecimal.js @@ -8,7 +8,7 @@ const values = { M: 1000 } -export function romanToDecimal (romanNumber) { +export function romanToDecimal(romanNumber) { let prev = ' ' let sum = 0 diff --git a/Conversions/TemperatureConversion.js b/Conversions/TemperatureConversion.js index d5b5452f7d..059bb3e86b 100644 --- a/Conversions/TemperatureConversion.js +++ b/Conversions/TemperatureConversion.js @@ -1,102 +1,113 @@ -// This files has functions to convert different temperature units -// Functions take temperature value as a argument and returns corresponding converted value - -const celsiusToFahrenheit = (celsius) => { - // Wikipedia reference: https://en.wikipedia.org/wiki/Celsius - // Wikipedia reference: https://en.wikipedia.org/wiki/Fahrenheit - return Math.round(((celsius) * 9 / 5) + 32) -} - -const celsiusToKelvin = (celsius) => { - // Wikipedia reference: https://en.wikipedia.org/wiki/Celsius - // Wikipedia reference: https://en.wikipedia.org/wiki/Kelvin - return Math.round((celsius) + 273.15) -} - -const celsiusToRankine = (celsius) => { - // Wikipedia reference: https://en.wikipedia.org/wiki/Celsius - // Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale - return Math.round(((celsius) * 9 / 5) + 491.67) -} - -const fahrenheitToCelsius = (fahrenheit) => { - // Wikipedia reference: https://en.wikipedia.org/wiki/Fahrenheit - // Wikipedia reference: https://en.wikipedia.org/wiki/Celsius - return Math.round(((fahrenheit) - 32) * 5 / 9) -} - -const fahrenheitToKelvin = (fahrenheit) => { - // Wikipedia reference: https://en.wikipedia.org/wiki/Fahrenheit - // Wikipedia reference: https://en.wikipedia.org/wiki/Kelvin - return Math.round((((fahrenheit) - 32) * 5 / 9) + 273.15) -} - -const fahrenheitToRankine = (fahrenheit) => { - // Wikipedia reference: https://en.wikipedia.org/wiki/Fahrenheit - // Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale - return Math.round((fahrenheit) + 459.67) -} - -const kelvinToCelsius = (kelvin) => { - // Wikipedia reference: https://en.wikipedia.org/wiki/Kelvin - // Wikipedia reference: https://en.wikipedia.org/wiki/Celsius - return Math.round((kelvin) - 273.15) -} - -const kelvinToFahrenheit = (kelvin) => { - // Wikipedia reference: https://en.wikipedia.org/wiki/Kelvin - // Wikipedia reference: https://en.wikipedia.org/wiki/Fahrenheit - return Math.round((((kelvin) - 273.15) * 9 / 5) + 32) -} - -const kelvinToRankine = (kelvin) => { - // Wikipedia reference: https://en.wikipedia.org/wiki/Kelvin - // Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale - return Math.round(((kelvin) * 9 / 5)) -} - -const rankineToCelsius = (rankine) => { - // Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale - // Wikipedia reference: https://en.wikipedia.org/wiki/Celsius - return Math.round(((rankine) - 491.67) * 5 / 9) -} - -const rankineToFahrenheit = (rankine) => { - // Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale - // Wikipedia reference: https://en.wikipedia.org/wiki/Fahrenheit - return Math.round((rankine) - 459.67) -} - -const rankineToKelvin = (rankine) => { - // Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale - // Wikipedia reference: https://en.wikipedia.org/wiki/Kelvin - return Math.round(((rankine) * 5 / 9)) -} - -const reaumurToKelvin = (reaumur) => { - // Reference:- http://www.csgnetwork.com/temp2conv.html - return Math.round(((reaumur) * 1.25 + 273.15)) -} - -const reaumurToFahrenheit = (reaumur) => { - // Reference:- http://www.csgnetwork.com/temp2conv.html - return Math.round(((reaumur) * 2.25 + 32)) -} - -const reaumurToCelsius = (reaumur) => { - // Reference:- http://www.csgnetwork.com/temp2conv.html - return Math.round(((reaumur) * 1.25)) -} - -const reaumurToRankine = (reaumur) => { - // Reference:- http://www.csgnetwork.com/temp2conv.html - return Math.round(((reaumur) * 2.25 + 32 + 459.67)) -} - -export { - celsiusToFahrenheit, celsiusToKelvin, celsiusToRankine, - fahrenheitToCelsius, fahrenheitToKelvin, fahrenheitToRankine, - kelvinToCelsius, kelvinToFahrenheit, kelvinToRankine, - rankineToCelsius, rankineToFahrenheit, rankineToKelvin, - reaumurToCelsius, reaumurToFahrenheit, reaumurToKelvin, reaumurToRankine -} +// This files has functions to convert different temperature units +// Functions take temperature value as a argument and returns corresponding converted value + +const celsiusToFahrenheit = (celsius) => { + // Wikipedia reference: https://en.wikipedia.org/wiki/Celsius + // Wikipedia reference: https://en.wikipedia.org/wiki/Fahrenheit + return Math.round((celsius * 9) / 5 + 32) +} + +const celsiusToKelvin = (celsius) => { + // Wikipedia reference: https://en.wikipedia.org/wiki/Celsius + // Wikipedia reference: https://en.wikipedia.org/wiki/Kelvin + return Math.round(celsius + 273.15) +} + +const celsiusToRankine = (celsius) => { + // Wikipedia reference: https://en.wikipedia.org/wiki/Celsius + // Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale + return Math.round((celsius * 9) / 5 + 491.67) +} + +const fahrenheitToCelsius = (fahrenheit) => { + // Wikipedia reference: https://en.wikipedia.org/wiki/Fahrenheit + // Wikipedia reference: https://en.wikipedia.org/wiki/Celsius + return Math.round(((fahrenheit - 32) * 5) / 9) +} + +const fahrenheitToKelvin = (fahrenheit) => { + // Wikipedia reference: https://en.wikipedia.org/wiki/Fahrenheit + // Wikipedia reference: https://en.wikipedia.org/wiki/Kelvin + return Math.round(((fahrenheit - 32) * 5) / 9 + 273.15) +} + +const fahrenheitToRankine = (fahrenheit) => { + // Wikipedia reference: https://en.wikipedia.org/wiki/Fahrenheit + // Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale + return Math.round(fahrenheit + 459.67) +} + +const kelvinToCelsius = (kelvin) => { + // Wikipedia reference: https://en.wikipedia.org/wiki/Kelvin + // Wikipedia reference: https://en.wikipedia.org/wiki/Celsius + return Math.round(kelvin - 273.15) +} + +const kelvinToFahrenheit = (kelvin) => { + // Wikipedia reference: https://en.wikipedia.org/wiki/Kelvin + // Wikipedia reference: https://en.wikipedia.org/wiki/Fahrenheit + return Math.round(((kelvin - 273.15) * 9) / 5 + 32) +} + +const kelvinToRankine = (kelvin) => { + // Wikipedia reference: https://en.wikipedia.org/wiki/Kelvin + // Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale + return Math.round((kelvin * 9) / 5) +} + +const rankineToCelsius = (rankine) => { + // Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale + // Wikipedia reference: https://en.wikipedia.org/wiki/Celsius + return Math.round(((rankine - 491.67) * 5) / 9) +} + +const rankineToFahrenheit = (rankine) => { + // Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale + // Wikipedia reference: https://en.wikipedia.org/wiki/Fahrenheit + return Math.round(rankine - 459.67) +} + +const rankineToKelvin = (rankine) => { + // Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale + // Wikipedia reference: https://en.wikipedia.org/wiki/Kelvin + return Math.round((rankine * 5) / 9) +} + +const reaumurToKelvin = (reaumur) => { + // Reference:- http://www.csgnetwork.com/temp2conv.html + return Math.round(reaumur * 1.25 + 273.15) +} + +const reaumurToFahrenheit = (reaumur) => { + // Reference:- http://www.csgnetwork.com/temp2conv.html + return Math.round(reaumur * 2.25 + 32) +} + +const reaumurToCelsius = (reaumur) => { + // Reference:- http://www.csgnetwork.com/temp2conv.html + return Math.round(reaumur * 1.25) +} + +const reaumurToRankine = (reaumur) => { + // Reference:- http://www.csgnetwork.com/temp2conv.html + return Math.round(reaumur * 2.25 + 32 + 459.67) +} + +export { + celsiusToFahrenheit, + celsiusToKelvin, + celsiusToRankine, + fahrenheitToCelsius, + fahrenheitToKelvin, + fahrenheitToRankine, + kelvinToCelsius, + kelvinToFahrenheit, + kelvinToRankine, + rankineToCelsius, + rankineToFahrenheit, + rankineToKelvin, + reaumurToCelsius, + reaumurToFahrenheit, + reaumurToKelvin, + reaumurToRankine +} diff --git a/Conversions/TitleCaseConversion.js b/Conversions/TitleCaseConversion.js index 82ff81ae16..c057f7a332 100644 --- a/Conversions/TitleCaseConversion.js +++ b/Conversions/TitleCaseConversion.js @@ -13,7 +13,7 @@ const titleCaseConversion = (inputString) => { if (inputString === '') return '' // Extract all space separated string. - const stringCollections = inputString.split(' ').map(word => { + const stringCollections = inputString.split(' ').map((word) => { let firstChar = '' // Get the [ASCII](https://en.wikipedia.org/wiki/ASCII) character code by the use charCodeAt method. const firstCharCode = word[0].charCodeAt() @@ -25,17 +25,20 @@ const titleCaseConversion = (inputString) => { // Else store the characters without any modification. firstChar += word[0] } - const newWordChar = word.slice(1).split('').map(char => { - // Get the ASCII character code by the use charCodeAt method. - const presentCharCode = char.charCodeAt() - // If the ASCII character code lies between 65 to 90, it means they are in the uppercase so convert it. - if (presentCharCode >= 65 && presentCharCode <= 90) { - // Convert the case by use of the above explanation. - return String.fromCharCode(presentCharCode + 32) - } - // Else return the characters without any modification. - return char - }) + const newWordChar = word + .slice(1) + .split('') + .map((char) => { + // Get the ASCII character code by the use charCodeAt method. + const presentCharCode = char.charCodeAt() + // If the ASCII character code lies between 65 to 90, it means they are in the uppercase so convert it. + if (presentCharCode >= 65 && presentCharCode <= 90) { + // Convert the case by use of the above explanation. + return String.fromCharCode(presentCharCode + 32) + } + // Else return the characters without any modification. + return char + }) // Return the first converted character and remaining character string. return firstChar + newWordChar.join('') }) diff --git a/Conversions/UpperCaseConversion.js b/Conversions/UpperCaseConversion.js index fb5e810a65..8bfb7ec128 100644 --- a/Conversions/UpperCaseConversion.js +++ b/Conversions/UpperCaseConversion.js @@ -17,7 +17,7 @@ */ const upperCaseConversion = (inputString) => { // Take a string and split it into characters. - const newString = inputString.split('').map(char => { + const newString = inputString.split('').map((char) => { // Get a character code by the use charCodeAt method. const presentCharCode = char.charCodeAt() // If the character code lies between 97 to 122, it means they are in the lowercase so convert it. diff --git a/Conversions/test/ArbitraryBase.test.js b/Conversions/test/ArbitraryBase.test.js index c6e835eb5a..3cfbd11081 100644 --- a/Conversions/test/ArbitraryBase.test.js +++ b/Conversions/test/ArbitraryBase.test.js @@ -1,4 +1,7 @@ -import { convertArbitraryBase, convertArbitraryBaseBigIntVersion } from '../ArbitraryBase' +import { + convertArbitraryBase, + convertArbitraryBaseBigIntVersion +} from '../ArbitraryBase' test('Check the answer of convertArbitraryBase(98, 0123456789, 01234567) is 142', () => { const res = convertArbitraryBase('98', '0123456789', '01234567') diff --git a/Conversions/test/BinaryToHex.test.js b/Conversions/test/BinaryToHex.test.js index 85679bb39d..0444e08e67 100644 --- a/Conversions/test/BinaryToHex.test.js +++ b/Conversions/test/BinaryToHex.test.js @@ -14,6 +14,8 @@ describe('BinaryToHex', () => { }) it('expects to return correct hexadecimal value, matching (num).toString(16)', () => { - expect(binaryToHex('1111')).toBe(parseInt('1111', 2).toString(16).toUpperCase()) + expect(binaryToHex('1111')).toBe( + parseInt('1111', 2).toString(16).toUpperCase() + ) }) }) diff --git a/Conversions/test/HexToRGB.test.js b/Conversions/test/HexToRGB.test.js index 78af51db06..0a16045f39 100644 --- a/Conversions/test/HexToRGB.test.js +++ b/Conversions/test/HexToRGB.test.js @@ -1,16 +1,16 @@ -import { hexStringToRGB } from '../HexToRGB' - -test('The RGB form of Hex String E1E1E1 is {r: 225, g: 225, b: 225}', () => { - const res = hexStringToRGB('E1E1E1') - expect(res).toEqual({ r: 225, g: 225, b: 225 }) -}) - -test('The RGB form of Hex String 000000 is {r: 0, g: 0, b: 0}', () => { - const res = hexStringToRGB('000000') - expect(res).toEqual({ r: 0, g: 0, b: 0 }) -}) - -test('The RGB form of Hex String 6CE1CD is {r: 108, g: 225, b: 205}', () => { - const res = hexStringToRGB('6CE1CD') - expect(res).toEqual({ r: 108, g: 225, b: 205 }) -}) +import { hexStringToRGB } from '../HexToRGB' + +test('The RGB form of Hex String E1E1E1 is {r: 225, g: 225, b: 225}', () => { + const res = hexStringToRGB('E1E1E1') + expect(res).toEqual({ r: 225, g: 225, b: 225 }) +}) + +test('The RGB form of Hex String 000000 is {r: 0, g: 0, b: 0}', () => { + const res = hexStringToRGB('000000') + expect(res).toEqual({ r: 0, g: 0, b: 0 }) +}) + +test('The RGB form of Hex String 6CE1CD is {r: 108, g: 225, b: 205}', () => { + const res = hexStringToRGB('6CE1CD') + expect(res).toEqual({ r: 108, g: 225, b: 205 }) +}) diff --git a/Conversions/test/LengthConversion.test.js b/Conversions/test/LengthConversion.test.js index 7618cb0b20..8adae08b51 100644 --- a/Conversions/test/LengthConversion.test.js +++ b/Conversions/test/LengthConversion.test.js @@ -2,11 +2,11 @@ import { lengthConversion } from '../LengthConversion.js' describe('LengthConversion', () => { it.each` - length | fromUnit | toUnit | expected - ${10} | ${'km'} | ${'m'} | ${10000} - ${100} | ${'m'} | ${'km'} | ${0.1} - ${5} | ${'cm'} | ${'mm'} | ${50} - ${12} | ${'ft'} | ${'inch'}| ${144.00000000000003} + length | fromUnit | toUnit | expected + ${10} | ${'km'} | ${'m'} | ${10000} + ${100} | ${'m'} | ${'km'} | ${0.1} + ${5} | ${'cm'} | ${'mm'} | ${50} + ${12} | ${'ft'} | ${'inch'} | ${144.00000000000003} `( 'converts $length $fromUnit to $toUnit', ({ length, fromUnit, toUnit, expected }) => { @@ -20,10 +20,10 @@ describe('LengthConversion', () => { ) it.each` - length | fromUnit | toUnit | expected - ${10} | ${'m'} | ${'km'} | ${0.01} - ${1000}| ${'mm'} | ${'cm'} | ${100} - ${1} | ${'inch'}| ${'ft'} | ${0.08333333333} + length | fromUnit | toUnit | expected + ${10} | ${'m'} | ${'km'} | ${0.01} + ${1000} | ${'mm'} | ${'cm'} | ${100} + ${1} | ${'inch'} | ${'ft'} | ${0.08333333333} `( 'converts $length $fromUnit to $toUnit (vice versa)', ({ length, fromUnit, toUnit, expected }) => { @@ -37,9 +37,9 @@ describe('LengthConversion', () => { ) it.each` - length | fromUnit | toUnit | expectedError - ${10} | ${'km'} | ${'invalid'} | ${'Invalid units'} - ${5} | ${'invalid'} | ${'m'} | ${'Invalid units'} + length | fromUnit | toUnit | expectedError + ${10} | ${'km'} | ${'invalid'} | ${'Invalid units'} + ${5} | ${'invalid'} | ${'m'} | ${'Invalid units'} `( 'returns error message for invalid units: $fromUnit to $toUnit', ({ length, fromUnit, toUnit, expectedError }) => { diff --git a/Conversions/test/RgbHsvConversion.test.js b/Conversions/test/RgbHsvConversion.test.js index c122ed092a..02c16f438f 100644 --- a/Conversions/test/RgbHsvConversion.test.js +++ b/Conversions/test/RgbHsvConversion.test.js @@ -20,14 +20,30 @@ describe('rgbToHsv', () => { // "approximatelyEqualHsv" needed because of small deviations due to rounding for the RGB-values it('should calculate the correct HSV values', () => { expect(approximatelyEqualHsv(rgbToHsv(0, 0, 0), [0, 0, 0])).toEqual(true) - expect(approximatelyEqualHsv(rgbToHsv(255, 255, 255), [0, 0, 1])).toEqual(true) + expect(approximatelyEqualHsv(rgbToHsv(255, 255, 255), [0, 0, 1])).toEqual( + true + ) expect(approximatelyEqualHsv(rgbToHsv(255, 0, 0), [0, 1, 1])).toEqual(true) - expect(approximatelyEqualHsv(rgbToHsv(255, 255, 0), [60, 1, 1])).toEqual(true) - expect(approximatelyEqualHsv(rgbToHsv(0, 255, 0), [120, 1, 1])).toEqual(true) - expect(approximatelyEqualHsv(rgbToHsv(0, 0, 255), [240, 1, 1])).toEqual(true) - expect(approximatelyEqualHsv(rgbToHsv(255, 0, 255), [300, 1, 1])).toEqual(true) - expect(approximatelyEqualHsv(rgbToHsv(64, 128, 128), [180, 0.5, 0.5])).toEqual(true) - expect(approximatelyEqualHsv(rgbToHsv(193, 196, 224), [234, 0.14, 0.88])).toEqual(true) - expect(approximatelyEqualHsv(rgbToHsv(128, 32, 80), [330, 0.75, 0.5])).toEqual(true) + expect(approximatelyEqualHsv(rgbToHsv(255, 255, 0), [60, 1, 1])).toEqual( + true + ) + expect(approximatelyEqualHsv(rgbToHsv(0, 255, 0), [120, 1, 1])).toEqual( + true + ) + expect(approximatelyEqualHsv(rgbToHsv(0, 0, 255), [240, 1, 1])).toEqual( + true + ) + expect(approximatelyEqualHsv(rgbToHsv(255, 0, 255), [300, 1, 1])).toEqual( + true + ) + expect( + approximatelyEqualHsv(rgbToHsv(64, 128, 128), [180, 0.5, 0.5]) + ).toEqual(true) + expect( + approximatelyEqualHsv(rgbToHsv(193, 196, 224), [234, 0.14, 0.88]) + ).toEqual(true) + expect( + approximatelyEqualHsv(rgbToHsv(128, 32, 80), [330, 0.75, 0.5]) + ).toEqual(true) }) }) diff --git a/Conversions/test/TemperatureConversion.test.js b/Conversions/test/TemperatureConversion.test.js index 50626bec8e..862eb07747 100644 --- a/Conversions/test/TemperatureConversion.test.js +++ b/Conversions/test/TemperatureConversion.test.js @@ -1,106 +1,106 @@ -import * as tc from '../TemperatureConversion.js' - -describe('Testing Conversion of Celsius to fahrenheit', () => { - it('with celsius value', () => { - const test1 = tc.celsiusToFahrenheit(10) - expect(test1).toBe(50) - }) -}) - -describe('Testing Conversion of Celsius to kelvin', () => { - it('with celsius value', () => { - const test1 = tc.celsiusToKelvin(15) - expect(test1).toBe(288) - }) -}) - -describe('Testing Conversion of Celsius to Rankine', () => { - it('with celsius value', () => { - const test1 = tc.celsiusToRankine(28) - expect(test1).toBe(542) - }) -}) - -describe('Testing Conversion of Fahrenheit to Celsius', () => { - it('with Fahrenheit value', () => { - const test1 = tc.fahrenheitToCelsius(134) - expect(test1).toBe(57) - }) -}) - -describe('Testing Conversion of Fahrenheit to Kelvin', () => { - it('with Fahrenheit value', () => { - const test1 = tc.fahrenheitToKelvin(125) - expect(test1).toBe(325) - }) -}) - -describe('Testing Conversion of Fahrenheit to Rankine', () => { - it('with Fahrenheit value', () => { - const test1 = tc.fahrenheitToRankine(10) - expect(test1).toBe(470) - }) -}) - -describe('Testing Conversion of Kelvin to Celsius', () => { - it('with Kelvin value', () => { - const test1 = tc.kelvinToCelsius(100) - expect(test1).toBe(-173) - }) -}) - -describe('Testing Conversion of Kelvin to Fahrenheit', () => { - it('with Kelvin value', () => { - const test1 = tc.kelvinToFahrenheit(20) - expect(test1).toBe(-424) - }) -}) - -describe('Testing Conversion of Kelvin to Rankine', () => { - it('with kelvin value', () => { - const test1 = tc.kelvinToRankine(69) - expect(test1).toBe(124) - }) -}) -describe('Testing Conversion of Rankine to Celsius', () => { - it('with Rankine value', () => { - const test1 = tc.rankineToCelsius(234) - expect(test1).toBe(-143) - }) -}) -describe('Testing Conversion of Rankine to Fahrenheit', () => { - it('with Rankine value', () => { - const test1 = tc.rankineToFahrenheit(98) - expect(test1).toBe(-362) - }) -}) -describe('Testing Conversion of Rankine to Kelvin', () => { - it('with Rankine value', () => { - const test1 = tc.rankineToKelvin(10) - expect(test1).toBe(6) - }) -}) -describe('Testing Conversion of Reaumur to Celsius', () => { - it('with Reaumur value', () => { - const test1 = tc.reaumurToCelsius(100) - expect(test1).toBe(125) - }) -}) -describe('Testing Conversion of Reaumur to Fahrenheit', () => { - it('with Reaumur value', () => { - const test1 = tc.reaumurToFahrenheit(100) - expect(test1).toBe(257) - }) -}) -describe('Testing Conversion of Reaumur to Kelvin', () => { - it('with Reamur value', () => { - const test1 = tc.reaumurToKelvin(100) - expect(test1).toBe(398) - }) -}) -describe('Testing Conversion of Reamur to Rankine', () => { - it('with Reamur value', () => { - const test1 = tc.reaumurToRankine(100) - expect(test1).toBe(717) - }) -}) +import * as tc from '../TemperatureConversion.js' + +describe('Testing Conversion of Celsius to fahrenheit', () => { + it('with celsius value', () => { + const test1 = tc.celsiusToFahrenheit(10) + expect(test1).toBe(50) + }) +}) + +describe('Testing Conversion of Celsius to kelvin', () => { + it('with celsius value', () => { + const test1 = tc.celsiusToKelvin(15) + expect(test1).toBe(288) + }) +}) + +describe('Testing Conversion of Celsius to Rankine', () => { + it('with celsius value', () => { + const test1 = tc.celsiusToRankine(28) + expect(test1).toBe(542) + }) +}) + +describe('Testing Conversion of Fahrenheit to Celsius', () => { + it('with Fahrenheit value', () => { + const test1 = tc.fahrenheitToCelsius(134) + expect(test1).toBe(57) + }) +}) + +describe('Testing Conversion of Fahrenheit to Kelvin', () => { + it('with Fahrenheit value', () => { + const test1 = tc.fahrenheitToKelvin(125) + expect(test1).toBe(325) + }) +}) + +describe('Testing Conversion of Fahrenheit to Rankine', () => { + it('with Fahrenheit value', () => { + const test1 = tc.fahrenheitToRankine(10) + expect(test1).toBe(470) + }) +}) + +describe('Testing Conversion of Kelvin to Celsius', () => { + it('with Kelvin value', () => { + const test1 = tc.kelvinToCelsius(100) + expect(test1).toBe(-173) + }) +}) + +describe('Testing Conversion of Kelvin to Fahrenheit', () => { + it('with Kelvin value', () => { + const test1 = tc.kelvinToFahrenheit(20) + expect(test1).toBe(-424) + }) +}) + +describe('Testing Conversion of Kelvin to Rankine', () => { + it('with kelvin value', () => { + const test1 = tc.kelvinToRankine(69) + expect(test1).toBe(124) + }) +}) +describe('Testing Conversion of Rankine to Celsius', () => { + it('with Rankine value', () => { + const test1 = tc.rankineToCelsius(234) + expect(test1).toBe(-143) + }) +}) +describe('Testing Conversion of Rankine to Fahrenheit', () => { + it('with Rankine value', () => { + const test1 = tc.rankineToFahrenheit(98) + expect(test1).toBe(-362) + }) +}) +describe('Testing Conversion of Rankine to Kelvin', () => { + it('with Rankine value', () => { + const test1 = tc.rankineToKelvin(10) + expect(test1).toBe(6) + }) +}) +describe('Testing Conversion of Reaumur to Celsius', () => { + it('with Reaumur value', () => { + const test1 = tc.reaumurToCelsius(100) + expect(test1).toBe(125) + }) +}) +describe('Testing Conversion of Reaumur to Fahrenheit', () => { + it('with Reaumur value', () => { + const test1 = tc.reaumurToFahrenheit(100) + expect(test1).toBe(257) + }) +}) +describe('Testing Conversion of Reaumur to Kelvin', () => { + it('with Reamur value', () => { + const test1 = tc.reaumurToKelvin(100) + expect(test1).toBe(398) + }) +}) +describe('Testing Conversion of Reamur to Rankine', () => { + it('with Reamur value', () => { + const test1 = tc.reaumurToRankine(100) + expect(test1).toBe(717) + }) +}) diff --git a/Conversions/test/TitleCaseConversion.test.js b/Conversions/test/TitleCaseConversion.test.js index a4eaa2ecd6..16741662a0 100644 --- a/Conversions/test/TitleCaseConversion.test.js +++ b/Conversions/test/TitleCaseConversion.test.js @@ -1,12 +1,14 @@ import { titleCaseConversion } from '../TitleCaseConversion' -describe(('Tests for the titleCaseConversion function'), () => { +describe('Tests for the titleCaseConversion function', () => { it('should return an empty string when the input is an empty string', () => { expect(titleCaseConversion('')).toEqual('') }) it('should return the input string when the input string is a title case string', () => { - expect(titleCaseConversion('A Proper Title Case String')).toEqual('A Proper Title Case String') + expect(titleCaseConversion('A Proper Title Case String')).toEqual( + 'A Proper Title Case String' + ) }) it('should return a title case string when input is an all-uppercase string', () => { @@ -34,7 +36,9 @@ describe(('Tests for the titleCaseConversion function'), () => { }) it('should return a title case string when input is an all-lowercase string with punctuation', () => { - expect(titleCaseConversion('lower, case, input.')).toEqual('Lower, Case, Input.') + expect(titleCaseConversion('lower, case, input.')).toEqual( + 'Lower, Case, Input.' + ) }) it('should return a title case string when input is an mixed-case string', () => { @@ -46,6 +50,8 @@ describe(('Tests for the titleCaseConversion function'), () => { }) it('should return a title case string when input is an mixed-case string with punctuation', () => { - expect(titleCaseConversion('mixeD, CaSe, INPuT!')).toEqual('Mixed, Case, Input!') + expect(titleCaseConversion('mixeD, CaSe, INPuT!')).toEqual( + 'Mixed, Case, Input!' + ) }) }) diff --git a/Conversions/test/UpperCaseConverstion.test.js b/Conversions/test/UpperCaseConverstion.test.js index a78ec5b9cc..d9b4f82fd3 100644 --- a/Conversions/test/UpperCaseConverstion.test.js +++ b/Conversions/test/UpperCaseConverstion.test.js @@ -1,6 +1,6 @@ import { upperCaseConversion } from '../UpperCaseConversion' -describe(('Test the upperCaseConversion function'), () => { +describe('Test the upperCaseConversion function', () => { it('should return an empty string when the input is an empty string', () => { expect(upperCaseConversion('')).toEqual('') }) @@ -26,7 +26,9 @@ describe(('Test the upperCaseConversion function'), () => { }) it('should return an all-uppercase string when input is an all-lowercase string with punctuation', () => { - expect(upperCaseConversion('lower-case, input.')).toEqual('LOWER-CASE, INPUT.') + expect(upperCaseConversion('lower-case, input.')).toEqual( + 'LOWER-CASE, INPUT.' + ) }) it('should return an all-uppercase string when input is an mixed-case string', () => { @@ -38,6 +40,8 @@ describe(('Test the upperCaseConversion function'), () => { }) it('should return an all-uppercase string when input is an mixed-case string with punctuation', () => { - expect(upperCaseConversion('mixeD-CaSe INPuT!')).toEqual('MIXED-CASE INPUT!') + expect(upperCaseConversion('mixeD-CaSe INPuT!')).toEqual( + 'MIXED-CASE INPUT!' + ) }) }) diff --git a/DIRECTORY.md b/DIRECTORY.md index 2d70c5d6a2..31969e4cd1 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -47,6 +47,7 @@ * [HexToBinary](Conversions/HexToBinary.js) * [HexToDecimal](Conversions/HexToDecimal.js) * [HexToRGB](Conversions/HexToRGB.js) + * [LengthConversion](Conversions/LengthConversion.js) * [LitersToImperialGallons](Conversions/LitersToImperialGallons.js) * [LitersToUSGallons](Conversions/LitersToUSGallons.js) * [LowerCaseConversion](Conversions/LowerCaseConversion.js) @@ -233,6 +234,7 @@ * [PowLogarithmic](Maths/PowLogarithmic.js) * [PrimeCheck](Maths/PrimeCheck.js) * [PrimeFactors](Maths/PrimeFactors.js) + * [QuadraticRoots](Maths/QuadraticRoots.js) * [RadianToDegree](Maths/RadianToDegree.js) * [ReverseNumber](Maths/ReverseNumber.js) * [ReversePolishNotation](Maths/ReversePolishNotation.js) @@ -363,6 +365,7 @@ * [HammingDistance](String/HammingDistance.js) * [IsPalindrome](String/IsPalindrome.js) * [KMPPatternSearching](String/KMPPatternSearching.js) + * [LengthofLongestSubstringWithoutRepetition](String/LengthofLongestSubstringWithoutRepetition.js) * [LevenshteinDistance](String/LevenshteinDistance.js) * [Lower](String/Lower.js) * [MaxCharacter](String/MaxCharacter.js) diff --git a/Data-Structures/Array/LocalMaximomPoint.js b/Data-Structures/Array/LocalMaximomPoint.js index b51e809ce2..f971c62814 100644 --- a/Data-Structures/Array/LocalMaximomPoint.js +++ b/Data-Structures/Array/LocalMaximomPoint.js @@ -9,19 +9,38 @@ * @complexity: O(log(n)) (worst case) * @flow */ -const findMaxPointIndex = (array, rangeStartIndex, rangeEndIndex, originalLength) => { +const findMaxPointIndex = ( + array, + rangeStartIndex, + rangeEndIndex, + originalLength +) => { // find index range middle point - const middleIndex = rangeStartIndex + parseInt((rangeEndIndex - rangeStartIndex) / 2) + const middleIndex = + rangeStartIndex + parseInt((rangeEndIndex - rangeStartIndex) / 2) // handle array bounds - if ((middleIndex === 0 || array[middleIndex - 1] <= array[middleIndex]) && - (middleIndex === originalLength - 1 || array[middleIndex + 1] <= array[middleIndex])) { + if ( + (middleIndex === 0 || array[middleIndex - 1] <= array[middleIndex]) && + (middleIndex === originalLength - 1 || + array[middleIndex + 1] <= array[middleIndex]) + ) { return middleIndex } else if (middleIndex > 0 && array[middleIndex - 1] > array[middleIndex]) { - return findMaxPointIndex(array, rangeStartIndex, (middleIndex - 1), originalLength) + return findMaxPointIndex( + array, + rangeStartIndex, + middleIndex - 1, + originalLength + ) } else { // regular local max - return findMaxPointIndex(array, (middleIndex + 1), rangeEndIndex, originalLength) + return findMaxPointIndex( + array, + middleIndex + 1, + rangeEndIndex, + originalLength + ) } } diff --git a/Data-Structures/Array/NumberOfLocalMaximumPoints.js b/Data-Structures/Array/NumberOfLocalMaximumPoints.js index 0b004f11aa..0df6a1d0ce 100644 --- a/Data-Structures/Array/NumberOfLocalMaximumPoints.js +++ b/Data-Structures/Array/NumberOfLocalMaximumPoints.js @@ -33,10 +33,13 @@ const CountLocalMaximumPoints = (array, startIndex, endIndex) => { // handle the two halves const middleIndex = parseInt((startIndex + endIndex) / 2) - return CountLocalMaximumPoints(array, startIndex, middleIndex) + + return ( + CountLocalMaximumPoints(array, startIndex, middleIndex) + CountLocalMaximumPoints(array, middleIndex + 1, endIndex) + ) } -const NumberOfLocalMaximumPoints = (A) => CountLocalMaximumPoints(A, 0, A.length - 1) +const NumberOfLocalMaximumPoints = (A) => + CountLocalMaximumPoints(A, 0, A.length - 1) export { NumberOfLocalMaximumPoints } diff --git a/Data-Structures/Array/QuickSelect.js b/Data-Structures/Array/QuickSelect.js index 2b7819bee9..d01555ed95 100644 --- a/Data-Structures/Array/QuickSelect.js +++ b/Data-Structures/Array/QuickSelect.js @@ -11,7 +11,8 @@ * @flow */ -function QuickSelect (items, kth) { // eslint-disable-line no-unused-vars +function QuickSelect(items, kth) { + // eslint-disable-line no-unused-vars if (kth < 1 || kth > items.length) { throw new RangeError('Index Out of Bound') } @@ -19,7 +20,7 @@ function QuickSelect (items, kth) { // eslint-disable-line no-unused-vars return RandomizedSelect(items, 0, items.length - 1, kth) } -function RandomizedSelect (items, left, right, i) { +function RandomizedSelect(items, left, right, i) { if (left === right) return items[left] const pivotIndex = RandomizedPartition(items, left, right) @@ -31,13 +32,13 @@ function RandomizedSelect (items, left, right, i) { return RandomizedSelect(items, pivotIndex + 1, right, i - k) } -function RandomizedPartition (items, left, right) { +function RandomizedPartition(items, left, right) { const rand = getRandomInt(left, right) Swap(items, rand, right) return Partition(items, left, right) } -function Partition (items, left, right) { +function Partition(items, left, right) { const x = items[right] let pivotIndex = left - 1 @@ -53,12 +54,12 @@ function Partition (items, left, right) { return pivotIndex + 1 } -function getRandomInt (min, max) { +function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min } -function Swap (arr, x, y) { - [arr[x], arr[y]] = [arr[y], arr[x]] +function Swap(arr, x, y) { + ;[arr[x], arr[y]] = [arr[y], arr[x]] } export { QuickSelect } diff --git a/Data-Structures/Array/test/Reverse.test.js b/Data-Structures/Array/test/Reverse.test.js index bf137fe655..7b3344a096 100644 --- a/Data-Structures/Array/test/Reverse.test.js +++ b/Data-Structures/Array/test/Reverse.test.js @@ -1,13 +1,14 @@ import { Reverse } from '../Reverse.js' -import each from 'jest-each' describe('reverse elements in an array', () => { - each` - array | expected - ${[]} | ${[]} - ${[1]} | ${[1]} - ${[1, 2, 3, 4]} | ${[4, 3, 2, 1]} - `.test('returns $expected when given $array', ({ array, expected }) => { - expect(Reverse(array)).toEqual(expected) - }) + it.each([ + [[], []], + [[1], [1]], + [ + [1, 2, 3, 4], + [4, 3, 2, 1] + ] + ])('returns %j when given %j', (array, expected) => { + expect(Reverse(array)).toEqual(expected) + }) }) diff --git a/Data-Structures/Graph/Graph.js b/Data-Structures/Graph/Graph.js index 1d8e941a11..d5764e4f9f 100644 --- a/Data-Structures/Graph/Graph.js +++ b/Data-Structures/Graph/Graph.js @@ -1,24 +1,24 @@ class Graph { - constructor () { + constructor() { this.adjacencyMap = {} } - addVertex (vertex) { + addVertex(vertex) { this.adjacencyMap[vertex] = [] } - containsVertex (vertex) { - return typeof (this.adjacencyMap[vertex]) !== 'undefined' + containsVertex(vertex) { + return typeof this.adjacencyMap[vertex] !== 'undefined' } - addEdge (vertex1, vertex2) { + addEdge(vertex1, vertex2) { if (this.containsVertex(vertex1) && this.containsVertex(vertex2)) { this.adjacencyMap[vertex1].push(vertex2) this.adjacencyMap[vertex2].push(vertex1) } } - printGraph (output = value => console.log(value)) { + printGraph(output = (value) => console.log(value)) { const keys = Object.keys(this.adjacencyMap) for (const i of keys) { const values = this.adjacencyMap[i] @@ -34,13 +34,14 @@ class Graph { * Prints the Breadth first traversal of the graph from source. * @param {number} source The source vertex to start BFS. */ - bfs (source, output = value => console.log(value)) { + bfs(source, output = (value) => console.log(value)) { const queue = [[source, 0]] // level of source is 0 const visited = new Set() while (queue.length) { const [node, level] = queue.shift() // remove the front of the queue - if (visited.has(node)) { // visited + if (visited.has(node)) { + // visited continue } @@ -56,8 +57,9 @@ class Graph { * Prints the Depth first traversal of the graph from source. * @param {number} source The source vertex to start DFS. */ - dfs (source, visited = new Set(), output = value => console.log(value)) { - if (visited.has(source)) { // visited + dfs(source, visited = new Set(), output = (value) => console.log(value)) { + if (visited.has(source)) { + // visited return } diff --git a/Data-Structures/Graph/Graph2.js b/Data-Structures/Graph/Graph2.js index 3c360f7a1d..645bf5294b 100644 --- a/Data-Structures/Graph/Graph2.js +++ b/Data-Structures/Graph/Graph2.js @@ -2,7 +2,7 @@ class Graph { // defining vertex array and // adjacent list - constructor (noOfVertices) { + constructor(noOfVertices) { this.noOfVertices = noOfVertices this.AdjList = new Map() } @@ -17,7 +17,7 @@ class Graph { // dfs(v) // add vertex to the graph - addVertex (v) { + addVertex(v) { // initialize the adjacent list with a // null array @@ -25,7 +25,7 @@ class Graph { } // add edge to the graph - addEdge (v, w) { + addEdge(v, w) { // get the list for vertex v and put the // vertex w denoting edge between v and w this.AdjList.get(v).push(w) @@ -36,7 +36,7 @@ class Graph { } // Prints the vertex and adjacency list - printGraph (output = value => console.log(value)) { + printGraph(output = (value) => console.log(value)) { // get all the vertices const getKeys = this.AdjList.keys() diff --git a/Data-Structures/Graph/Graph3.js b/Data-Structures/Graph/Graph3.js index d5a36bf181..894a892bdd 100644 --- a/Data-Structures/Graph/Graph3.js +++ b/Data-Structures/Graph/Graph3.js @@ -1,18 +1,18 @@ class Graph { - constructor () { + constructor() { this.adjacencyObject = {} } - addVertex (vertex) { + addVertex(vertex) { if (!this.adjacencyObject[vertex]) this.adjacencyObject[vertex] = [] } - addEdge (vertex1, vertex2) { + addEdge(vertex1, vertex2) { this.adjacencyObject[vertex1].push(vertex2) this.adjacencyObject[vertex2].push(vertex1) } - removeEdge (vertex1, vertex2) { + removeEdge(vertex1, vertex2) { this.adjacencyObject[vertex1] = this.adjacencyObject[vertex1].filter( (v) => v !== vertex2 ) @@ -21,7 +21,7 @@ class Graph { ) } - removeVertex (vertex) { + removeVertex(vertex) { while (this.adjacencyObject[vertex].length) { const adjacentVertex = this.adjacencyObject[vertex].pop() this.removeEdge(vertex, adjacentVertex) @@ -31,14 +31,14 @@ class Graph { /** * Return DFS (Depth First Search) List Using Recursive Method */ - DFS (start) { + DFS(start) { if (!start) return null const result = [] const visited = {} const adjacencyObject = this.adjacencyObject - function dfs (vertex) { + function dfs(vertex) { if (!vertex) return null visited[vertex] = true result.push(vertex) @@ -56,7 +56,7 @@ class Graph { /** * Return DFS(Depth First Search) List Using Iteration */ - DFSIterative (start) { + DFSIterative(start) { if (!start) return null const stack = [start] @@ -80,7 +80,7 @@ class Graph { return result } - BFS (start) { + BFS(start) { if (!start) return null const queue = [start] diff --git a/Data-Structures/Graph/test/Graph2.test.js b/Data-Structures/Graph/test/Graph2.test.js index 6d6816a8dc..0bbd3caddb 100644 --- a/Data-Structures/Graph/test/Graph2.test.js +++ b/Data-Structures/Graph/test/Graph2.test.js @@ -18,7 +18,7 @@ describe('Test Graph2', () => { graph.addEdge('C', 'F') it('Check adjacency lists', () => { - const mockFn = jest.fn() + const mockFn = vi.fn() graph.printGraph(mockFn) // Expect one call per vertex diff --git a/Data-Structures/Heap/KeyPriorityQueue.js b/Data-Structures/Heap/KeyPriorityQueue.js index e7bbede45e..420933396e 100644 --- a/Data-Structures/Heap/KeyPriorityQueue.js +++ b/Data-Structures/Heap/KeyPriorityQueue.js @@ -19,12 +19,12 @@ */ // Priority Queue Helper functions -const getParentPosition = position => Math.floor((position - 1) / 2) -const getChildrenPositions = position => [2 * position + 1, 2 * position + 2] +const getParentPosition = (position) => Math.floor((position - 1) / 2) +const getChildrenPositions = (position) => [2 * position + 1, 2 * position + 2] class KeyPriorityQueue { // Priority Queue class using Minimum Binary Heap - constructor () { + constructor() { this._heap = [] this.priorities = new Map() } @@ -33,7 +33,7 @@ class KeyPriorityQueue { * Checks if the heap is empty * @returns boolean */ - isEmpty () { + isEmpty() { return this._heap.length === 0 } @@ -42,7 +42,7 @@ class KeyPriorityQueue { * @param {*} key * @param {number} priority */ - push (key, priority) { + push(key, priority) { this._heap.push(key) this.priorities.set(key, priority) this._shiftUp(this._heap.length - 1) @@ -52,7 +52,7 @@ class KeyPriorityQueue { * Removes the element with least priority * @returns the key of the element with least priority */ - pop () { + pop() { this._swap(0, this._heap.length - 1) const key = this._heap.pop() this.priorities.delete(key) @@ -65,7 +65,7 @@ class KeyPriorityQueue { * @param {*} key * @returns boolean */ - contains (key) { + contains(key) { return this.priorities.has(key) } @@ -75,7 +75,7 @@ class KeyPriorityQueue { * @param {*} key the element to change * @param {number} priority new priority of the element */ - update (key, priority) { + update(key, priority) { const currPos = this._heap.indexOf(key) // if the key does not exist yet, add it if (currPos === -1) return this.push(key, priority) @@ -95,13 +95,14 @@ class KeyPriorityQueue { } } - _getPriorityOrInfinite (position) { + _getPriorityOrInfinite(position) { // Helper function, returns priority of the node, or Infinite if no node corresponds to this position - if (position >= 0 && position < this._heap.length) return this.priorities.get(this._heap[position]) + if (position >= 0 && position < this._heap.length) + return this.priorities.get(this._heap[position]) else return Infinity } - _shiftUp (position) { + _shiftUp(position) { // Helper function to shift up a node to proper position (equivalent to bubbleUp) let currPos = position let parentPos = getParentPosition(currPos) @@ -117,7 +118,7 @@ class KeyPriorityQueue { } } - _shiftDown (position) { + _shiftDown(position) { // Helper function to shift down a node to proper position (equivalent to bubbleDown) let currPos = position let [child1Pos, child2Pos] = getChildrenPositions(currPos) @@ -137,16 +138,19 @@ class KeyPriorityQueue { this._swap(child2Pos, currPos) currPos = child2Pos } - [child1Pos, child2Pos] = getChildrenPositions(currPos) + ;[child1Pos, child2Pos] = getChildrenPositions(currPos) child1Priority = this._getPriorityOrInfinite(child1Pos) child2Priority = this._getPriorityOrInfinite(child2Pos) currPriority = this._getPriorityOrInfinite(currPos) } } - _swap (position1, position2) { + _swap(position1, position2) { // Helper function to swap 2 nodes - [this._heap[position1], this._heap[position2]] = [this._heap[position2], this._heap[position1]] + ;[this._heap[position1], this._heap[position2]] = [ + this._heap[position2], + this._heap[position1] + ] } } diff --git a/Data-Structures/Heap/MaxHeap.js b/Data-Structures/Heap/MaxHeap.js index 47f4c1b9ec..5788d786e3 100644 --- a/Data-Structures/Heap/MaxHeap.js +++ b/Data-Structures/Heap/MaxHeap.js @@ -4,25 +4,25 @@ */ class BinaryHeap { - constructor () { + constructor() { this.heap = [] } - insert (value) { + insert(value) { this.heap.push(value) this.heapify() } - size () { + size() { return this.heap.length } - empty () { + empty() { return this.size() === 0 } // using iterative approach to reorder the heap after insertion - heapify () { + heapify() { let index = this.size() - 1 while (index > 0) { @@ -38,7 +38,7 @@ class BinaryHeap { } // Extracting the maximum element from the Heap - extractMax () { + extractMax() { const max = this.heap[0] const tmp = this.heap.pop() if (!this.empty()) { @@ -49,7 +49,7 @@ class BinaryHeap { } // To restore the balance of the heap after extraction. - sinkDown (index) { + sinkDown(index) { const left = 2 * index + 1 const right = 2 * index + 2 let largest = index diff --git a/Data-Structures/Heap/MinHeap.js b/Data-Structures/Heap/MinHeap.js index a1a0160727..a115447c97 100644 --- a/Data-Structures/Heap/MinHeap.js +++ b/Data-Structures/Heap/MinHeap.js @@ -19,15 +19,15 @@ */ class MinHeap { - constructor (array) { + constructor(array) { this.heap = this.initializeHeap(array) } /** * startingParent represents the parent of the last index (=== array.length-1) * and iterates towards 0 with all index values below sorted to meet heap conditions - */ - initializeHeap (array) { + */ + initializeHeap(array) { const startingParent = Math.floor((array.length - 2) / 2) for (let currIdx = startingParent; currIdx >= 0; currIdx--) { @@ -52,15 +52,16 @@ class MinHeap { * update currIdx and recalculate the new childOneIdx to check heap conditions again. * * if there is no swap, it means the children indices and the parent index satisfy heap conditions and can exit the function. - */ - sinkDown (currIdx, endIdx, heap) { + */ + sinkDown(currIdx, endIdx, heap) { let childOneIdx = currIdx * 2 + 1 while (childOneIdx <= endIdx) { const childTwoIdx = childOneIdx + 1 <= endIdx ? childOneIdx + 1 : -1 - const swapIdx = childTwoIdx !== -1 && heap[childTwoIdx] < heap[childOneIdx] - ? childTwoIdx - : childOneIdx + const swapIdx = + childTwoIdx !== -1 && heap[childTwoIdx] < heap[childOneIdx] + ? childTwoIdx + : childOneIdx if (heap[swapIdx] < heap[currIdx]) { this.swap(currIdx, swapIdx, heap) @@ -79,8 +80,8 @@ class MinHeap { * update currIdx and recalculate the new parentIdx to check heap condition again. * * iteration does not end while a valid currIdx has a value smaller than its parentIdx's value - */ - bubbleUp (currIdx) { + */ + bubbleUp(currIdx) { let parentIdx = Math.floor((currIdx - 1) / 2) while (currIdx > 0 && this.heap[currIdx] < this.heap[parentIdx]) { @@ -90,7 +91,7 @@ class MinHeap { } } - peek () { + peek() { return this.heap[0] } @@ -101,8 +102,8 @@ class MinHeap { * the resulting min heap value now resides at heap[heap.length-1] which is popped and later returned. * * the remaining values in the heap are re-sorted - */ - extractMin () { + */ + extractMin() { this.swap(0, this.heap.length - 1, this.heap) const min = this.heap.pop() this.sinkDown(0, this.heap.length - 1, this.heap) @@ -110,13 +111,13 @@ class MinHeap { } // a new value is pushed to the end of the heap and sorted up - insert (value) { + insert(value) { this.heap.push(value) this.bubbleUp(this.heap.length - 1) } // index-swapping helper method - swap (idx1, idx2, heap) { + swap(idx1, idx2, heap) { const temp = heap[idx1] heap[idx1] = heap[idx2] heap[idx2] = temp diff --git a/Data-Structures/Heap/MinPriorityQueue.js b/Data-Structures/Heap/MinPriorityQueue.js index 1c420b6c71..9d76c7aefd 100644 --- a/Data-Structures/Heap/MinPriorityQueue.js +++ b/Data-Structures/Heap/MinPriorityQueue.js @@ -1,18 +1,18 @@ /* Minimum Priority Queue -* It is a part of heap data structure -* A heap is a specific tree based data structure -* in which all the nodes of tree are in a specific order. -* that is the children are arranged in some -* respect of their parents, can either be greater -* or less than the parent. This makes it a min priority queue -* or max priority queue. -*/ + * It is a part of heap data structure + * A heap is a specific tree based data structure + * in which all the nodes of tree are in a specific order. + * that is the children are arranged in some + * respect of their parents, can either be greater + * or less than the parent. This makes it a min priority queue + * or max priority queue. + */ // Functions: insert, delete, peek, isEmpty, print, heapSort, sink class MinPriorityQueue { // calls the constructor and initializes the capacity - constructor (c) { + constructor(c) { this.heap = [] this.capacity = c this.size = 0 @@ -20,7 +20,7 @@ class MinPriorityQueue { // inserts the key at the end and rearranges it // so that the binary heap is in appropriate order - insert (key) { + insert(key) { if (this.isFull()) return this.heap[this.size + 1] = key let k = this.size + 1 @@ -36,33 +36,36 @@ class MinPriorityQueue { } // returns the highest priority value - peek () { + peek() { return this.heap[1] } // returns boolean value whether the heap is empty or not - isEmpty () { + isEmpty() { return this.size === 0 } // returns boolean value whether the heap is full or not - isFull () { + isFull() { return this.size === this.capacity } // prints the heap - print (output = value => console.log(value)) { + print(output = (value) => console.log(value)) { output(this.heap.slice(1)) } // heap reverse can be done by performing swapping the first // element with the last, removing the last element to // new array and calling sink function. - heapReverse () { + heapReverse() { const heapSort = [] while (this.size > 0) { // swap first element with last element - [this.heap[1], this.heap[this.size]] = [this.heap[this.size], this.heap[1]] + ;[this.heap[1], this.heap[this.size]] = [ + this.heap[this.size], + this.heap[1] + ] heapSort.push(this.heap.pop()) this.size-- this.sink() @@ -74,7 +77,7 @@ class MinPriorityQueue { } // this function reorders the heap after every delete function - sink () { + sink() { let k = 1 while (2 * k <= this.size || 2 * k + 1 <= this.size) { let minIndex @@ -92,8 +95,7 @@ class MinPriorityQueue { this.heap[k] > this.heap[2 * k] || this.heap[k] > this.heap[2 * k + 1] ) { - minIndex = - this.heap[2 * k] < this.heap[2 * k + 1] ? 2 * k : 2 * k + 1 + minIndex = this.heap[2 * k] < this.heap[2 * k + 1] ? 2 * k : 2 * k + 1 } else { minIndex = k } @@ -107,7 +109,7 @@ class MinPriorityQueue { // deletes the highest priority value from the heap. The last // element goes to ahead to first position and reorder heap - delete () { + delete() { // checks empty and one element array conditions if (this.isEmpty()) return if (this.size === 1) { diff --git a/Data-Structures/Heap/test/MinHeap.test.js b/Data-Structures/Heap/test/MinHeap.test.js index ff4abfff99..d7947ad12f 100644 --- a/Data-Structures/Heap/test/MinHeap.test.js +++ b/Data-Structures/Heap/test/MinHeap.test.js @@ -9,7 +9,9 @@ describe('MinHeap', () => { }) it('should initialize a heap from an input array', () => { - expect(heap).toEqual({ 'heap': [1, 4, 2, 7, 16, 10, 39, 23, 9, 43, 85, 42, 51] }) // eslint-disable-line + expect(heap).toEqual({ + heap: [1, 4, 2, 7, 16, 10, 39, 23, 9, 43, 85, 42, 51] + }) // eslint-disable-line }) it('should show the top value in the heap', () => { @@ -22,12 +24,14 @@ describe('MinHeap', () => { const minValue = heap.extractMin() expect(minValue).toEqual(1) - expect(heap).toEqual({ 'heap': [2, 4, 10, 7, 16, 42, 39, 23, 9, 43, 85, 51] }) // eslint-disable-line + expect(heap).toEqual({ heap: [2, 4, 10, 7, 16, 42, 39, 23, 9, 43, 85, 51] }) // eslint-disable-line }) it('should insert a new value and sort until it meets heap conditions', () => { heap.insert(15) - expect(heap).toEqual({ 'heap': [2, 4, 10, 7, 16, 15, 39, 23, 9, 43, 85, 51, 42] }) // eslint-disable-line + expect(heap).toEqual({ + heap: [2, 4, 10, 7, 16, 15, 39, 23, 9, 43, 85, 51, 42] + }) // eslint-disable-line }) }) diff --git a/Data-Structures/Heap/test/MinPriorityQueue.test.js b/Data-Structures/Heap/test/MinPriorityQueue.test.js index e79357e0f1..31549a1626 100644 --- a/Data-Structures/Heap/test/MinPriorityQueue.test.js +++ b/Data-Structures/Heap/test/MinPriorityQueue.test.js @@ -7,11 +7,11 @@ describe('MinPriorityQueue', () => { beforeEach(() => { queue = new MinPriorityQueue(capacity) - values.forEach(v => queue.insert(v)) + values.forEach((v) => queue.insert(v)) }) it('Check heap ordering', () => { - const mockFn = jest.fn() + const mockFn = vi.fn() queue.print(mockFn) expect(mockFn.mock.calls.length).toBe(1) // Expect one call @@ -24,7 +24,7 @@ describe('MinPriorityQueue', () => { it('heapSort() expected to reverse the heap ordering', () => { queue.heapReverse() - const mockFn = jest.fn() + const mockFn = vi.fn() queue.print(mockFn) expect(mockFn.mock.calls.length).toBe(1) diff --git a/Data-Structures/Linked-List/AddTwoNumbers.js b/Data-Structures/Linked-List/AddTwoNumbers.js index 1664a6d1ed..b17c2e3fc4 100644 --- a/Data-Structures/Linked-List/AddTwoNumbers.js +++ b/Data-Structures/Linked-List/AddTwoNumbers.js @@ -14,11 +14,11 @@ Link for the Problem: https://leetcode.com/problems/add-two-numbers/ */ class AddTwoNumbers { - constructor () { + constructor() { this.dummyNode = new Node(0) } - solution (firstList, secondList) { + solution(firstList, secondList) { let firstRunner = firstList let secondRunner = secondList let tail = this.dummyNode @@ -44,7 +44,7 @@ class AddTwoNumbers { return this.dummyNode.next } - solutionToArray () { + solutionToArray() { const list = [] let currentNode = this.dummyNode.next while (currentNode) { diff --git a/Data-Structures/Linked-List/CycleDetection.js b/Data-Structures/Linked-List/CycleDetection.js index 63b730eca1..007ace6560 100644 --- a/Data-Structures/Linked-List/CycleDetection.js +++ b/Data-Structures/Linked-List/CycleDetection.js @@ -3,18 +3,22 @@ * https://en.wikipedia.org/wiki/Cycle_detection */ -function detectCycle (head) { +function detectCycle(head) { /* Problem Statement: Given head, the head of a linked list, determine if the linked list has a cycle in it. Link for the Problem: https://leetcode.com/problems/linked-list-cycle/ */ - if (!head) { return false } + if (!head) { + return false + } let slow = head let fast = head.next while (fast && fast.next) { - if (fast === slow) { return true } + if (fast === slow) { + return true + } fast = fast.next.next slow = slow.next } diff --git a/Data-Structures/Linked-List/DoublyLinkedList.js b/Data-Structures/Linked-List/DoublyLinkedList.js index aeaaeaf085..0d391181ac 100644 --- a/Data-Structures/Linked-List/DoublyLinkedList.js +++ b/Data-Structures/Linked-List/DoublyLinkedList.js @@ -1,5 +1,5 @@ class Node { - constructor (element) { + constructor(element) { this.element = element this.next = null this.prev = null @@ -7,14 +7,14 @@ class Node { } class DoubleLinkedList { - constructor () { + constructor() { this.length = 0 this.head = null this.tail = null } // Add new element - append (element) { + append(element) { const node = new Node(element) if (!this.head) { @@ -30,7 +30,7 @@ class DoubleLinkedList { } // Add element - insert (position, element) { + insert(position, element) { // Check of out-of-bound values if (position >= 0 && position <= this.length) { const node = new Node(element) @@ -74,7 +74,7 @@ class DoubleLinkedList { } // Remove element at any position - removeAt (position) { + removeAt(position) { // look for out-of-bounds value if (position > -1 && position < this.length) { let current = this.head @@ -114,7 +114,7 @@ class DoubleLinkedList { } // Get the indexOf item - indexOf (elm) { + indexOf(elm) { let current = this.head let index = -1 @@ -133,27 +133,27 @@ class DoubleLinkedList { } // Find the item in the list - isPresent (elm) { + isPresent(elm) { return this.indexOf(elm) !== -1 } // Delete an item from the list - delete (elm) { + delete(elm) { return this.removeAt(this.indexOf(elm)) } // Delete first item from the list - deleteHead () { + deleteHead() { this.removeAt(0) } // Delete last item from the list - deleteTail () { + deleteTail() { this.removeAt(this.length - 1) } // Print item of the string - toString () { + toString() { let current = this.head let string = '' @@ -166,7 +166,7 @@ class DoubleLinkedList { } // Convert list to array - toArray () { + toArray() { const arr = [] let current = this.head @@ -179,31 +179,31 @@ class DoubleLinkedList { } // Check if list is empty - isEmpty () { + isEmpty() { return this.length === 0 } // Get the size of the list - size () { + size() { return this.length } // Get the this.head - getHead () { + getHead() { return this.head } // Get the this.tail - getTail () { + getTail() { return this.tail } // Method to iterate over the LinkedList - iterator () { + iterator() { let currentNode = this.getHead() if (currentNode === null) return -1 - const iterate = function * () { + const iterate = function* () { while (currentNode) { yield currentNode.element currentNode = currentNode.next @@ -214,7 +214,7 @@ class DoubleLinkedList { // Method to log the LinkedList, for debugging // it' a circular structure, so can't use stringify to debug the whole structure - log () { + log() { let currentNode = this.getHead() while (currentNode) { console.log(currentNode.element) diff --git a/Data-Structures/Linked-List/ReverseSinglyLinkedList.js b/Data-Structures/Linked-List/ReverseSinglyLinkedList.js index db4e7ef6d6..6e20956fda 100644 --- a/Data-Structures/Linked-List/ReverseSinglyLinkedList.js +++ b/Data-Structures/Linked-List/ReverseSinglyLinkedList.js @@ -1,7 +1,7 @@ /** A LinkedList based solution to reverse a number Problem Statement: Given a number such that each of its digit is stored in a singly linked list. Reverse the linked list and return the head of the linked list Link for the Problem: https://leetcode.com/problems/reverse-linked-list/ */ class ReverseSinglyLinkedList { - solution (head) { + solution(head) { let prev = null let next = null while (head) { @@ -11,6 +11,6 @@ class ReverseSinglyLinkedList { head = next } return prev - }; + } } export { ReverseSinglyLinkedList } diff --git a/Data-Structures/Linked-List/SinglyCircularLinkedList.js b/Data-Structures/Linked-List/SinglyCircularLinkedList.js index e1a8085f82..f79766a19b 100644 --- a/Data-Structures/Linked-List/SinglyCircularLinkedList.js +++ b/Data-Structures/Linked-List/SinglyCircularLinkedList.js @@ -2,7 +2,7 @@ import { Node } from './SinglyLinkedList.js' class SinglyCircularLinkedList { - constructor () { + constructor() { this.headNode = null this.length = 0 } @@ -15,12 +15,12 @@ class SinglyCircularLinkedList { isEmpty = () => this.length === 0 // initiate the node and index - initiateNodeAndIndex () { + initiateNodeAndIndex() { return { currentNode: this.headNode, currentIndex: 0 } } // get the data specific to an index - getElementAt (index) { + getElementAt(index) { if (this.length !== 0 && index >= 0 && index <= this.length) { let { currentNode } = this.initiateNodeAndIndex() for (let i = 0; i < index && currentNode !== null; i++) { @@ -32,7 +32,7 @@ class SinglyCircularLinkedList { } // Add the element in the first position - addAtFirst (data) { + addAtFirst(data) { const node = new Node(data) node.next = this.headNode this.headNode = node @@ -41,8 +41,10 @@ class SinglyCircularLinkedList { } // Add any data to the end of the linkedList - add (data) { - if (!this.headNode) { return this.addAtFirst(data) } + add(data) { + if (!this.headNode) { + return this.addAtFirst(data) + } const node = new Node(data) // Getting the last node const currentNode = this.getElementAt(this.length - 1) @@ -53,10 +55,11 @@ class SinglyCircularLinkedList { } // insert data at a specific position - insertAt (index, data) { + insertAt(index, data) { if (index === 0) return this.addAtFirst(data) if (index === this.length) return this.add(data) - if (index < 0 || index > this.length) throw new RangeError(`Index is out of range max ${this.length}`) + if (index < 0 || index > this.length) + throw new RangeError(`Index is out of range max ${this.length}`) const node = new Node(data) const previousNode = this.getElementAt(index - 1) node.next = previousNode.next @@ -66,7 +69,7 @@ class SinglyCircularLinkedList { } // find the first index of the data - indexOf (data) { + indexOf(data) { let { currentNode } = this.initiateNodeAndIndex() // initializing currentIndex as -1 let currentIndex = -1 @@ -81,7 +84,7 @@ class SinglyCircularLinkedList { } // remove the data from the end of the list - remove () { + remove() { if (this.isEmpty()) return null const secondLastNode = this.getElementAt(this.length - 2) const removedNode = secondLastNode.next @@ -91,7 +94,7 @@ class SinglyCircularLinkedList { } // remove the data from the first of the list - removeFirst () { + removeFirst() { if (this.isEmpty()) return null const removedNode = this.headNode if (this.length === 1) { @@ -106,7 +109,7 @@ class SinglyCircularLinkedList { } // remove the data from the index - removeAt (index) { + removeAt(index) { if (this.isEmpty()) return null if (index === 0) return this.removeFirst() if (index === this.length) return this.remove() @@ -119,14 +122,14 @@ class SinglyCircularLinkedList { } // remove if the data is present - removeData (data) { + removeData(data) { if (this.isEmpty()) return null const index = this.indexOf(data) return this.removeAt(index) } // logs the data - printData (output = value => console.log(value)) { + printData(output = (value) => console.log(value)) { let { currentIndex, currentNode } = this.initiateNodeAndIndex() while (currentNode !== null && currentIndex < this.length) { @@ -137,7 +140,7 @@ class SinglyCircularLinkedList { } // get the data from the linkedList - get () { + get() { let { currentIndex, currentNode } = this.initiateNodeAndIndex() const list = [] while (currentNode !== null && currentIndex < this.length) { @@ -148,7 +151,7 @@ class SinglyCircularLinkedList { return list } - clear () { + clear() { this.headNode = null this.length = 0 } diff --git a/Data-Structures/Linked-List/SinglyLinkedList.js b/Data-Structures/Linked-List/SinglyLinkedList.js index b093d4bde6..a5f875d1b3 100644 --- a/Data-Structures/Linked-List/SinglyLinkedList.js +++ b/Data-Structures/Linked-List/SinglyLinkedList.js @@ -9,14 +9,14 @@ // Methods - size, head, addLast, addFirst, addAt, removeFirst, removeLast, remove, removeAt, indexOf, isEmpty, elementAt, findMiddle, get, clean, rotateListRight class Node { - constructor (data) { + constructor(data) { this.data = data this.next = null } } class LinkedList { - constructor (listOfValues) { + constructor(listOfValues) { this.headNode = null this.tailNode = null this.length = 0 @@ -29,32 +29,32 @@ class LinkedList { } // initiates the currentNode and currentIndex and return as an object - initiateNodeAndIndex () { + initiateNodeAndIndex() { return { currentNode: this.headNode, currentIndex: 0 } } // Returns length - size () { + size() { return this.length } // Returns the head - head () { + head() { return this.headNode?.data ?? null } // Returns the tail - tail () { + tail() { return this.tailNode?.data ?? null } // Return if the list is empty - isEmpty () { + isEmpty() { return this.length === 0 } // add a node at last it to linklist - addLast (element) { + addLast(element) { // Check if its the first element if (this.headNode === null) { return this.addFirst(element) @@ -68,7 +68,7 @@ class LinkedList { } // add a node at first it to linklist - addFirst (element) { + addFirst(element) { const node = new Node(element) // Check if its the first element if (this.headNode === null) { @@ -82,7 +82,7 @@ class LinkedList { } // remove the first from the linklist - removeFirst () { + removeFirst() { // Check if head is null if (this.headNode === null) { return null @@ -99,7 +99,7 @@ class LinkedList { } // remove the last from the linklist - removeLast () { + removeLast() { if (this.isEmpty()) return null // Check if there is only one element if (this.length === 1) { @@ -118,7 +118,7 @@ class LinkedList { } // Removes the node with the value as param - remove (element) { + remove(element) { if (this.isEmpty()) return null let { currentNode } = this.initiateNodeAndIndex() let removedNode = null @@ -144,7 +144,7 @@ class LinkedList { } // Returns the index of the element passed as param otherwise -1 - indexOf (element) { + indexOf(element) { if (this.isEmpty()) return -1 let { currentNode, currentIndex } = this.initiateNodeAndIndex() while (currentNode) { @@ -158,7 +158,7 @@ class LinkedList { } // Returns the element at an index - elementAt (index) { + elementAt(index) { if (index >= this.length || index < 0) { throw new RangeError('Out of Range index') } @@ -171,7 +171,7 @@ class LinkedList { } // Adds the element at specified index - addAt (index, element) { + addAt(index, element) { // Check if index is out of bounds of list if (index > this.length || index < 0) { throw new RangeError('Out of Range index') @@ -196,7 +196,7 @@ class LinkedList { } // Removes the node at specified index - removeAt (index) { + removeAt(index) { // Check if index is present in list if (index < 0 || index >= this.length) { throw new RangeError('Out of Range index') @@ -216,7 +216,7 @@ class LinkedList { } // Returns a reference to middle node of linked list - findMiddle () { + findMiddle() { // If there are two middle nodes, return the second middle node. let fast = this.headNode let slow = this.headNode @@ -229,14 +229,14 @@ class LinkedList { } // make the linkedList Empty - clean () { + clean() { this.headNode = null this.tailNode = null this.length = 0 } // Method to get the LinkedList - get () { + get() { const list = [] let { currentNode } = this.initiateNodeAndIndex() while (currentNode) { @@ -247,7 +247,7 @@ class LinkedList { } // Method for Rotating a List to the right by k places - rotateListRight (k) { + rotateListRight(k) { if (!this.headNode) return let current = this.headNode let tail = this.tailNode @@ -268,11 +268,11 @@ class LinkedList { } // Method to iterate over the LinkedList - iterator () { + iterator() { let { currentNode } = this.initiateNodeAndIndex() if (currentNode === null) return -1 - const iterate = function * () { + const iterate = function* () { while (currentNode) { yield currentNode.data currentNode = currentNode.next @@ -282,12 +282,12 @@ class LinkedList { } // Method to log the LinkedList - log () { + log() { console.log(JSON.stringify(this.headNode, null, 2)) } // Method to reverse the LinkedList - reverse () { + reverse() { let head = this.headNode let prev = null let next = null @@ -299,7 +299,7 @@ class LinkedList { } this.tailNode = this.headNode this.headNode = prev - }; + } } export { Node, LinkedList } diff --git a/Data-Structures/Linked-List/test/SinglyCircularLinkedList.test.js b/Data-Structures/Linked-List/test/SinglyCircularLinkedList.test.js index 8f5087c537..00628a6e5b 100644 --- a/Data-Structures/Linked-List/test/SinglyCircularLinkedList.test.js +++ b/Data-Structures/Linked-List/test/SinglyCircularLinkedList.test.js @@ -1,147 +1,147 @@ -import { SinglyCircularLinkedList } from '../SinglyCircularLinkedList' - -describe('SinglyCircularLinkedList', () => { - let list - beforeEach(() => { - list = new SinglyCircularLinkedList() - }) - it('Check get', () => { - expect(list.get()).toEqual([]) - expect(list.add(1)).toEqual(1) - expect(list.get()).toEqual([1]) - expect(list.add(5)).toEqual(2) - expect(list.get()).toEqual([1, 5]) - }) - - it('Check size', () => { - expect(list.size()).toEqual(0) - expect(list.add(1)).toEqual(1) - expect(list.add(1)).toEqual(2) - expect(list.size()).toEqual(2) - }) - - it('Check head', () => { - expect(list.head()).toEqual(null) - expect(list.add(1)).toEqual(1) - expect(list.head()).toEqual(1) - expect(list.add(1)).toEqual(2) - expect(list.head()).toEqual(1) - expect(list.addAtFirst(100)).toEqual(3) - expect(list.head()).toEqual(100) - expect(list.insertAt(0, 500)).toEqual(4) - expect(list.head()).toEqual(500) - list.clear() - expect(list.head()).toEqual(null) - }) - - it('Check isEmpty', () => { - expect(list.isEmpty()).toEqual(true) - expect(list.add(1)).toEqual(1) - expect(list.add(1)).toEqual(2) - expect(list.isEmpty()).toEqual(false) - }) - - it('Check getElementAt', () => { - list.add(100) - list.add(200) - list.add(300) - list.add(500) - list.add(900) - - expect(list.getElementAt(1).data).toEqual(200) - expect(list.getElementAt(3).data).toEqual(500) - }) - - it('Check addAtFirst', () => { - list.add(1) - list.add(5) - list.add(7) - list.add(9) - list.add(0) - expect(list.get()).toEqual([1, 5, 7, 9, 0]) - list.addAtFirst(100) - expect(list.get()).toEqual([100, 1, 5, 7, 9, 0]) - }) - - it('Check add', () => { - list.add(1) - list.add(5) - list.add(7) - list.add(9) - list.add(0) - expect(list.get()).toEqual([1, 5, 7, 9, 0]) - list.add(100) - expect(list.get()).toEqual([1, 5, 7, 9, 0, 100]) - }) - - it('Check insertAt', () => { - expect(list.insertAt(0, 100)).toEqual(1) - expect(list.get()).toEqual([100]) - expect(list.insertAt(0, 200)).toEqual(2) - expect(list.get()).toEqual([200, 100]) - expect(list.insertAt(2, 300)).toEqual(3) - expect(list.get()).toEqual([200, 100, 300]) - }) - - it('Checks indexOf', () => { - expect(list.indexOf(200)).toEqual(-1) - list.add(100) - list.add(200) - list.add(300) - list.add(500) - list.add(900) - expect(list.indexOf(200)).toEqual(1) - }) - - it('Check remove', () => { - expect(list.remove()).toEqual(null) - list.add(100) - list.add(200) - list.add(300) - list.add(500) - list.add(900) - expect(list.get()).toEqual([100, 200, 300, 500, 900]) - const removedData = list.remove() - expect(removedData).toEqual(900) - expect(list.get()).toEqual([100, 200, 300, 500]) - }) - - it('Check removeFirst', () => { - expect(list.removeFirst()).toEqual(null) - list.add(100) - list.add(200) - list.add(300) - list.add(500) - list.add(900) - expect(list.get()).toEqual([100, 200, 300, 500, 900]) - const removedData = list.removeFirst() - expect(removedData).toEqual(100) - expect(list.get()).toEqual([200, 300, 500, 900]) - }) - - it('Check removeAt', () => { - expect(list.removeAt(1)).toEqual(null) - list.add(100) - list.add(200) - list.add(300) - list.add(500) - list.add(900) - expect(list.get()).toEqual([100, 200, 300, 500, 900]) - const removedData = list.removeAt(2) - expect(removedData).toEqual(300) - expect(list.get()).toEqual([100, 200, 500, 900]) - }) - - it('Check removeData', () => { - expect(list.removeData(100)).toEqual(null) - list.add(100) - list.add(200) - list.add(300) - list.add(500) - list.add(900) - expect(list.get()).toEqual([100, 200, 300, 500, 900]) - const removedData = list.removeData(200) - expect(removedData).toEqual(200) - expect(list.get()).toEqual([100, 300, 500, 900]) - }) -}) +import { SinglyCircularLinkedList } from '../SinglyCircularLinkedList' + +describe('SinglyCircularLinkedList', () => { + let list + beforeEach(() => { + list = new SinglyCircularLinkedList() + }) + it('Check get', () => { + expect(list.get()).toEqual([]) + expect(list.add(1)).toEqual(1) + expect(list.get()).toEqual([1]) + expect(list.add(5)).toEqual(2) + expect(list.get()).toEqual([1, 5]) + }) + + it('Check size', () => { + expect(list.size()).toEqual(0) + expect(list.add(1)).toEqual(1) + expect(list.add(1)).toEqual(2) + expect(list.size()).toEqual(2) + }) + + it('Check head', () => { + expect(list.head()).toEqual(null) + expect(list.add(1)).toEqual(1) + expect(list.head()).toEqual(1) + expect(list.add(1)).toEqual(2) + expect(list.head()).toEqual(1) + expect(list.addAtFirst(100)).toEqual(3) + expect(list.head()).toEqual(100) + expect(list.insertAt(0, 500)).toEqual(4) + expect(list.head()).toEqual(500) + list.clear() + expect(list.head()).toEqual(null) + }) + + it('Check isEmpty', () => { + expect(list.isEmpty()).toEqual(true) + expect(list.add(1)).toEqual(1) + expect(list.add(1)).toEqual(2) + expect(list.isEmpty()).toEqual(false) + }) + + it('Check getElementAt', () => { + list.add(100) + list.add(200) + list.add(300) + list.add(500) + list.add(900) + + expect(list.getElementAt(1).data).toEqual(200) + expect(list.getElementAt(3).data).toEqual(500) + }) + + it('Check addAtFirst', () => { + list.add(1) + list.add(5) + list.add(7) + list.add(9) + list.add(0) + expect(list.get()).toEqual([1, 5, 7, 9, 0]) + list.addAtFirst(100) + expect(list.get()).toEqual([100, 1, 5, 7, 9, 0]) + }) + + it('Check add', () => { + list.add(1) + list.add(5) + list.add(7) + list.add(9) + list.add(0) + expect(list.get()).toEqual([1, 5, 7, 9, 0]) + list.add(100) + expect(list.get()).toEqual([1, 5, 7, 9, 0, 100]) + }) + + it('Check insertAt', () => { + expect(list.insertAt(0, 100)).toEqual(1) + expect(list.get()).toEqual([100]) + expect(list.insertAt(0, 200)).toEqual(2) + expect(list.get()).toEqual([200, 100]) + expect(list.insertAt(2, 300)).toEqual(3) + expect(list.get()).toEqual([200, 100, 300]) + }) + + it('Checks indexOf', () => { + expect(list.indexOf(200)).toEqual(-1) + list.add(100) + list.add(200) + list.add(300) + list.add(500) + list.add(900) + expect(list.indexOf(200)).toEqual(1) + }) + + it('Check remove', () => { + expect(list.remove()).toEqual(null) + list.add(100) + list.add(200) + list.add(300) + list.add(500) + list.add(900) + expect(list.get()).toEqual([100, 200, 300, 500, 900]) + const removedData = list.remove() + expect(removedData).toEqual(900) + expect(list.get()).toEqual([100, 200, 300, 500]) + }) + + it('Check removeFirst', () => { + expect(list.removeFirst()).toEqual(null) + list.add(100) + list.add(200) + list.add(300) + list.add(500) + list.add(900) + expect(list.get()).toEqual([100, 200, 300, 500, 900]) + const removedData = list.removeFirst() + expect(removedData).toEqual(100) + expect(list.get()).toEqual([200, 300, 500, 900]) + }) + + it('Check removeAt', () => { + expect(list.removeAt(1)).toEqual(null) + list.add(100) + list.add(200) + list.add(300) + list.add(500) + list.add(900) + expect(list.get()).toEqual([100, 200, 300, 500, 900]) + const removedData = list.removeAt(2) + expect(removedData).toEqual(300) + expect(list.get()).toEqual([100, 200, 500, 900]) + }) + + it('Check removeData', () => { + expect(list.removeData(100)).toEqual(null) + list.add(100) + list.add(200) + list.add(300) + list.add(500) + list.add(900) + expect(list.get()).toEqual([100, 200, 300, 500, 900]) + const removedData = list.removeData(200) + expect(removedData).toEqual(200) + expect(list.get()).toEqual([100, 300, 500, 900]) + }) +}) diff --git a/Data-Structures/Queue/CircularQueue.js b/Data-Structures/Queue/CircularQueue.js index a9bbc37385..27f2196780 100644 --- a/Data-Structures/Queue/CircularQueue.js +++ b/Data-Structures/Queue/CircularQueue.js @@ -4,7 +4,7 @@ // Doesn’t use dynamic memory so No memory leaks class CircularQueue { - constructor (maxLength) { + constructor(maxLength) { this.queue = [] this.front = 0 this.rear = 0 @@ -12,7 +12,7 @@ class CircularQueue { } // ADD ELEMENTS TO QUEUE - enqueue (value) { + enqueue(value) { if (this.checkOverflow()) return if (this.checkEmpty()) { this.front += 1 @@ -26,7 +26,7 @@ class CircularQueue { } // REMOVES ELEMENTS - dequeue () { + dequeue() { if (this.checkEmpty()) { // UNDERFLOW return @@ -44,13 +44,13 @@ class CircularQueue { } // checks if the queue is empty or not - checkEmpty () { + checkEmpty() { if (this.front === 0 && this.rear === 0) { return true } } - checkSingleelement () { + checkSingleelement() { if (this.front === this.rear && this.rear !== 0) { this.front = this.rear = 0 return true @@ -58,27 +58,30 @@ class CircularQueue { } // Checks if max capacity of queue has been reached or not - checkOverflow () { - if ((this.front === 1 && this.rear === this.maxLength) || (this.front === this.rear + 1)) { + checkOverflow() { + if ( + (this.front === 1 && this.rear === this.maxLength) || + this.front === this.rear + 1 + ) { // CIRCULAR QUEUE OVERFLOW return true } } // Prints the entire array ('*' represents blank space) - display (output = value => console.log(value)) { + display(output = (value) => console.log(value)) { for (let index = 1; index < this.queue.length; index++) { output(this.queue[index]) } } // Displays the length of queue - length () { + length() { return this.queue.length - 1 } // Display the top most value of queue - peek () { + peek() { return this.queue[this.front] } } diff --git a/Data-Structures/Queue/Queue.js b/Data-Structures/Queue/Queue.js index af7aa884a7..20af54a200 100644 --- a/Data-Structures/Queue/Queue.js +++ b/Data-Structures/Queue/Queue.js @@ -1,15 +1,15 @@ /* Queue -* A Queue is a data structure that allows you to add an element to the end of -* a list and remove the item at the front. A queue follows a FIFO (First In First Out) -* system, where the first item to enter the queue is the first to be removed, -* All these operation complexities are O(1). -* This implementation following the linked list structure. -*/ + * A Queue is a data structure that allows you to add an element to the end of + * a list and remove the item at the front. A queue follows a FIFO (First In First Out) + * system, where the first item to enter the queue is the first to be removed, + * All these operation complexities are O(1). + * This implementation following the linked list structure. + */ class Queue { #size - constructor () { + constructor() { this.head = null this.tail = null this.#size = 0 @@ -17,7 +17,7 @@ class Queue { return Object.seal(this) } - get length () { + get length() { return this.#size } @@ -26,7 +26,7 @@ class Queue { * @param {*} data * @returns {number} - The current size of queue */ - enqueue (data) { + enqueue(data) { const node = { data, next: null } if (!this.head && !this.tail) { @@ -44,7 +44,7 @@ class Queue { * @description - Removes the value at the front of the queue * @returns {*} - The first data of the queue */ - dequeue () { + dequeue() { if (this.isEmpty()) { throw new Error('Queue is Empty') } @@ -66,7 +66,7 @@ class Queue { * @description - Return the item at the front of the queue * @returns {*} */ - peekFirst () { + peekFirst() { if (this.isEmpty()) { throw new Error('Queue is Empty') } @@ -78,7 +78,7 @@ class Queue { * @description - Return the item at the tail of the queue * @returns {*} */ - peekLast () { + peekLast() { if (this.isEmpty()) { throw new Error('Queue is Empty') } @@ -90,7 +90,7 @@ class Queue { * @description - Return the array of Queue * @returns {Array<*>} */ - toArray () { + toArray() { const array = [] let node = this.head @@ -103,10 +103,10 @@ class Queue { } /** - * @description - Return is queue empty or not - * @returns {boolean} - */ - isEmpty () { + * @description - Return is queue empty or not + * @returns {boolean} + */ + isEmpty() { return this.length === 0 } } diff --git a/Data-Structures/Queue/QueueUsing2Stacks.js b/Data-Structures/Queue/QueueUsing2Stacks.js index 130a8c13a5..256f11060d 100644 --- a/Data-Structures/Queue/QueueUsing2Stacks.js +++ b/Data-Structures/Queue/QueueUsing2Stacks.js @@ -2,17 +2,17 @@ // contribution made by hamza chabchoub for a university project class Queue { - constructor () { + constructor() { this.inputStack = [] this.outputStack = [] } // Push item into the inputstack - enqueue (item) { + enqueue(item) { this.inputStack.push(item) } - dequeue () { + dequeue() { // push all items to outputstack this.outputStack = [] while (this.inputStack.length > 0) { @@ -31,7 +31,7 @@ class Queue { } // display elements of the inputstack - listIn (output = value => console.log(value)) { + listIn(output = (value) => console.log(value)) { let i = 0 while (i < this.inputStack.length) { output(this.inputStack[i]) @@ -40,7 +40,7 @@ class Queue { } // display element of the outputstack - listOut (output = value => console.log(value)) { + listOut(output = (value) => console.log(value)) { let i = 0 while (i < this.outputStack.length) { output(this.outputStack[i]) diff --git a/Data-Structures/Stack/Stack.js b/Data-Structures/Stack/Stack.js index 93cf761bea..d3001e8020 100644 --- a/Data-Structures/Stack/Stack.js +++ b/Data-Structures/Stack/Stack.js @@ -1,15 +1,15 @@ /* Stack!! -* A stack is exactly what it sounds like. An element gets added to the top of -* the stack and only the element on the top may be removed. This is an example -* of an array implementation of a Stack. So an element can only be added/removed -* from the end of the array. -*/ + * A stack is exactly what it sounds like. An element gets added to the top of + * the stack and only the element on the top may be removed. This is an example + * of an array implementation of a Stack. So an element can only be added/removed + * from the end of the array. + */ // Functions: push, pop, peek, view, length // Creates a stack constructor const Stack = (function () { - function Stack () { + function Stack() { // The top of the Stack this.top = 0 // The array representation of the stack @@ -45,13 +45,13 @@ const Stack = (function () { } // To see all the elements in the stack - Stack.prototype.view = function (output = value => console.log(value)) { + Stack.prototype.view = function (output = (value) => console.log(value)) { for (let i = 0; i < this.top; i++) { output(this.stack[i]) } } return Stack -}()) +})() export { Stack } diff --git a/Data-Structures/Stack/StackES6.js b/Data-Structures/Stack/StackES6.js index 1abafd8507..b70e14512a 100644 --- a/Data-Structures/Stack/StackES6.js +++ b/Data-Structures/Stack/StackES6.js @@ -10,19 +10,19 @@ // Class declaration class Stack { - constructor () { + constructor() { this.stack = [] this.top = 0 } // Adds a value to the end of the Stack - push (newValue) { + push(newValue) { this.stack.push(newValue) this.top += 1 } // Returns and removes the last element of the Stack - pop () { + pop() { if (this.top !== 0) { this.top -= 1 return this.stack.pop() @@ -31,17 +31,17 @@ class Stack { } // Returns the number of elements in the Stack - get length () { + get length() { return this.top } // Returns true if stack is empty, false otherwise - get isEmpty () { + get isEmpty() { return this.top === 0 } // Returns the last element without removing it - get last () { + get last() { if (this.top !== 0) { return this.stack[this.stack.length - 1] } @@ -49,7 +49,7 @@ class Stack { } // Checks if an object is the instance os the Stack class - static isStack (el) { + static isStack(el) { return el instanceof Stack } } diff --git a/Data-Structures/Tree/AVLTree.js b/Data-Structures/Tree/AVLTree.js index 1390defd35..e5abbf3e55 100644 --- a/Data-Structures/Tree/AVLTree.js +++ b/Data-Structures/Tree/AVLTree.js @@ -13,9 +13,9 @@ * RETURN > 0 if a > b * MUST RETURN 0 if a == b */ -let utils; -(function (_utils) { - function comparator () { +let utils +;(function (_utils) { + function comparator() { return function (v1, v2) { if (v1 < v2) return -1 if (v2 < v1) return 1 @@ -32,7 +32,7 @@ let utils; * If no argument is sent it uses utils.comparator */ const AVLTree = (function () { - function _avl (comp) { + function _avl(comp) { /** @public comparator function */ this._comp = undefined this._comp = comp !== undefined ? comp : utils.comparator() @@ -53,7 +53,9 @@ const AVLTree = (function () { // get height of a node const getHeight = function (node) { - if (node == null) { return 0 } + if (node == null) { + return 0 + } return node._height } @@ -64,12 +66,15 @@ const AVLTree = (function () { // update height of a node based on children's heights const updateHeight = function (node) { - if (node == null) { return } + if (node == null) { + return + } node._height = Math.max(getHeight(node._left), getHeight(node._right)) + 1 } // Helper: To check if the balanceFactor is valid - const isValidBalanceFactor = (balanceFactor) => [0, 1, -1].includes(balanceFactor) + const isValidBalanceFactor = (balanceFactor) => + [0, 1, -1].includes(balanceFactor) // rotations of AVL Tree const leftRotate = function (node) { @@ -140,13 +145,18 @@ const AVLTree = (function () { } updateHeight(root) const balanceFactor = getHeightDifference(root) - return isValidBalanceFactor(balanceFactor) ? root : insertBalance(root, val, balanceFactor, tree) + return isValidBalanceFactor(balanceFactor) + ? root + : insertBalance(root, val, balanceFactor, tree) } // delete am element const deleteElement = function (root, _val, tree) { - if (root == null) { return root } - if (tree._comp(root._val, _val) === 0) { // key found case + if (root == null) { + return root + } + if (tree._comp(root._val, _val) === 0) { + // key found case if (root._left === null && root._right === null) { root = null tree.size-- @@ -177,7 +187,9 @@ const AVLTree = (function () { } // search tree for a element const searchAVLTree = function (root, val, tree) { - if (root == null) { return null } + if (root == null) { + return null + } if (tree._comp(root._val, val) === 0) { return root } @@ -222,7 +234,7 @@ const AVLTree = (function () { return prevSize !== this.size } return _avl -}()) +})() /** * A Code for Testing the AVLTree diff --git a/Data-Structures/Tree/BinarySearchTree.js b/Data-Structures/Tree/BinarySearchTree.js index 2f9e78ad58..c86a2995c0 100644 --- a/Data-Structures/Tree/BinarySearchTree.js +++ b/Data-Structures/Tree/BinarySearchTree.js @@ -1,19 +1,19 @@ /* Binary Search Tree!! -* -* Nodes that will go on the Binary Tree. -* They consist of the data in them, the node to the left, the node -* to the right, and the parent from which they came from. -* -* A binary tree is a data structure in which an element -* has two successors(children). The left child is usually -* smaller than the parent, and the right child is usually -* bigger. -*/ + * + * Nodes that will go on the Binary Tree. + * They consist of the data in them, the node to the left, the node + * to the right, and the parent from which they came from. + * + * A binary tree is a data structure in which an element + * has two successors(children). The left child is usually + * smaller than the parent, and the right child is usually + * bigger. + */ // class Node -const Node = (function Node () { +const Node = (function Node() { // Node in the tree - function Node (val) { + function Node(val) { this.value = val this.left = null this.right = null @@ -32,7 +32,7 @@ const Node = (function Node () { } // Visit a node - Node.prototype.visit = function (output = value => console.log(value)) { + Node.prototype.visit = function (output = (value) => console.log(value)) { // Recursively go left if (this.left !== null) { this.left.visit() @@ -103,14 +103,14 @@ const Node = (function Node () { } // returns the constructor return Node -}()) +})() // class Tree const Tree = (function () { - function Tree () { + function Tree() { // Just store the root this.root = null - }; + } // Inorder traversal Tree.prototype.traverse = function () { @@ -149,6 +149,6 @@ const Tree = (function () { // returns the constructor return Tree -}()) +})() export { Tree } diff --git a/Data-Structures/Tree/SegmentTree.js b/Data-Structures/Tree/SegmentTree.js index 3778bb1e39..3d27981a07 100644 --- a/Data-Structures/Tree/SegmentTree.js +++ b/Data-Structures/Tree/SegmentTree.js @@ -13,7 +13,7 @@ class SegmentTree { size tree - constructor (arr) { + constructor(arr) { // we define tree like this // tree[1] : root node of tree // tree[i] : i'th node @@ -28,7 +28,7 @@ class SegmentTree { } // function to build the tree - build (arr) { + build(arr) { const { size, tree } = this // insert leaf nodes in tree // leaf nodes will start from index N @@ -45,7 +45,7 @@ class SegmentTree { } } - update (index, value) { + update(index, value) { const { size, tree } = this // only update values in the parents of the given node being changed. @@ -65,7 +65,7 @@ class SegmentTree { } // interval [L,R) with left index(L) included and right (R) excluded. - query (left, right) { + query(left, right) { const { size, tree } = this // cause R is excluded, increase right for convenient right++ diff --git a/Data-Structures/Tree/Trie.js b/Data-Structures/Tree/Trie.js index 69ae48a076..ea59e53846 100644 --- a/Data-Structures/Tree/Trie.js +++ b/Data-Structures/Tree/Trie.js @@ -1,4 +1,4 @@ -const TrieNode = function TrieNode (key, parent) { +const TrieNode = function TrieNode(key, parent) { this.key = key this.count = 0 this.children = Object.create(null) @@ -9,7 +9,7 @@ const TrieNode = function TrieNode (key, parent) { } } -function Trie () { +function Trie() { // create only root with null key and parent this.root = new TrieNode(null, null) } @@ -18,7 +18,9 @@ function Trie () { Trie.findAllWords = function (root, word, output) { if (root === null) return if (root.count > 0) { - if (typeof output === 'object') { output.push({ word, count: root.count }) } + if (typeof output === 'object') { + output.push({ word, count: root.count }) + } } let key for (key in root.children) { @@ -38,7 +40,9 @@ Trie.prototype.insert = function (word) { const len = word.length let i for (i = 0; i < len; i++) { - if (node.children[word.charAt(i)] === undefined) { node.children[word.charAt(i)] = new TrieNode(word.charAt(i), node) } + if (node.children[word.charAt(i)] === undefined) { + node.children[word.charAt(i)] = new TrieNode(word.charAt(i), node) + } node = node.children[word.charAt(i)] } node.count += 1 @@ -87,7 +91,11 @@ Trie.prototype.remove = function (word, count) { // if the object forms some other objects prefix we don't delete it // For checking an empty object // https://stackoverflow.com/questions/679915/how-do-i-test-for-an-empty-javascript-object - if (child.count <= 0 && (Object.keys(child.children).length && child.children.constructor === Object)) { + if ( + child.count <= 0 && + Object.keys(child.children).length && + child.children.constructor === Object + ) { child.parent.children[child.key] = undefined } } diff --git a/Data-Structures/Tree/test/AVLTree.test.js b/Data-Structures/Tree/test/AVLTree.test.js index 0b2f485174..862af38756 100644 --- a/Data-Structures/Tree/test/AVLTree.test.js +++ b/Data-Structures/Tree/test/AVLTree.test.js @@ -12,14 +12,14 @@ describe('AVLTree Implementation: ', () => { const emptyTree = new AVLTree(collator.compare) beforeAll(() => { - demoData.forEach(item => { + demoData.forEach((item) => { if (avlTree.add(item)) { dataList.push(item) } }) avlStringTree._comp = collator.compare - stringData.forEach(item => avlStringTree.add(item)) + stringData.forEach((item) => avlStringTree.add(item)) }) it('delete and search from empty tree', () => { @@ -33,10 +33,10 @@ describe('AVLTree Implementation: ', () => { }) it('search if inserted element is present', () => { - demoData.forEach(data => { + demoData.forEach((data) => { expect(avlTree.find(data)).toBeTruthy() }) - stringData.forEach(data => { + stringData.forEach((data) => { expect(avlStringTree.find(data)).toBeTruthy() }) }) diff --git a/Data-Structures/Vectors/Vector2.js b/Data-Structures/Vectors/Vector2.js index 780abbfcb9..f736b3e057 100644 --- a/Data-Structures/Vectors/Vector2.js +++ b/Data-Structures/Vectors/Vector2.js @@ -6,7 +6,7 @@ */ class Vector2 { - constructor (x, y) { + constructor(x, y) { this.x = x this.y = y } @@ -17,7 +17,7 @@ class Vector2 { * @param vector The vector to compare to. * @returns Whether they are exactly equal or not. */ - equalsExactly (vector) { + equalsExactly(vector) { return this.x === vector.x && this.y === vector.y } @@ -28,8 +28,11 @@ class Vector2 { * @param epsilon The allowed discrepancy for the x-values and the y-values. * @returns Whether they are approximately equal or not. */ - equalsApproximately (vector, epsilon) { - return (Math.abs(this.x - vector.x) < epsilon && Math.abs(this.y - vector.y) < epsilon) + equalsApproximately(vector, epsilon) { + return ( + Math.abs(this.x - vector.x) < epsilon && + Math.abs(this.y - vector.y) < epsilon + ) } /** @@ -37,7 +40,7 @@ class Vector2 { * * @returns The length of the vector. */ - length () { + length() { return Math.sqrt(this.x * this.x + this.y * this.y) } @@ -46,7 +49,7 @@ class Vector2 { * * @returns The normalized vector. */ - normalize () { + normalize() { const length = this.length() if (length === 0) { throw new Error('Cannot normalize vectors of length 0') @@ -60,7 +63,7 @@ class Vector2 { * @param vector The vector to be added. * @returns The sum-vector. */ - add (vector) { + add(vector) { const x = this.x + vector.x const y = this.y + vector.y return new Vector2(x, y) @@ -72,7 +75,7 @@ class Vector2 { * @param vector The vector to be subtracted. * @returns The difference-vector. */ - subtract (vector) { + subtract(vector) { const x = this.x - vector.x const y = this.y - vector.y return new Vector2(x, y) @@ -84,7 +87,7 @@ class Vector2 { * @param scalar The factor by which to multiply the vector. * @returns The scaled vector. */ - multiply (scalar) { + multiply(scalar) { const x = this.x * scalar const y = this.y * scalar return new Vector2(x, y) @@ -96,7 +99,7 @@ class Vector2 { * @param vector The vector to which to calculate the distance. * @returns The distance. */ - distance (vector) { + distance(vector) { const difference = vector.subtract(this) return difference.length() } @@ -107,7 +110,7 @@ class Vector2 { * @param vector The vector used for the multiplication. * @returns The resulting dot product. */ - dotProduct (vector) { + dotProduct(vector) { return this.x * vector.x + this.y * vector.y } @@ -117,7 +120,7 @@ class Vector2 { * @param angleInRadians The angle in radians by which to rotate the vector. * @returns The rotated vector. */ - rotate (angleInRadians) { + rotate(angleInRadians) { const ca = Math.cos(angleInRadians) const sa = Math.sin(angleInRadians) const x = ca * this.x - sa * this.y @@ -131,7 +134,7 @@ class Vector2 { * @param vector The 2nd vector for the measurement. * @returns The angle in radians. */ - angleBetween (vector) { + angleBetween(vector) { return Math.atan2(vector.y, vector.x) - Math.atan2(this.y, this.x) } } diff --git a/Data-Structures/Vectors/test/Vector2.test.js b/Data-Structures/Vectors/test/Vector2.test.js index 847716ded7..f2fa548fb4 100644 --- a/Data-Structures/Vectors/test/Vector2.test.js +++ b/Data-Structures/Vectors/test/Vector2.test.js @@ -5,52 +5,80 @@ describe('Vector2', () => { it('should compare equality correctly', () => { expect(new Vector2(1, 0).equalsExactly(new Vector2(1, 0))).toBe(true) - expect(new Vector2(1.23, 4.56).equalsExactly(new Vector2(0, 0))).toBe(false) + expect(new Vector2(1.23, 4.56).equalsExactly(new Vector2(0, 0))).toBe( + false + ) }) }) describe('#equalsApproximately', () => { it('should compare equality (approximately) correctly', () => { - expect(new Vector2(1, 0).equalsApproximately(new Vector2(1, 0.0000001), 0.000001)) - .toBe(true) - - expect(new Vector2(1.23, 4.56).equalsApproximately(new Vector2(1.24, 4.56), 0.000001)) - .toBe(false) + expect( + new Vector2(1, 0).equalsApproximately( + new Vector2(1, 0.0000001), + 0.000001 + ) + ).toBe(true) + + expect( + new Vector2(1.23, 4.56).equalsApproximately( + new Vector2(1.24, 4.56), + 0.000001 + ) + ).toBe(false) }) }) describe('#add', () => { it('should add two vectors correctly', () => { - expect(new Vector2(1, 0).add(new Vector2(0, 1)).equalsApproximately(new Vector2(1, 1), 0.000001)) - .toBe(true) - - expect(new Vector2(-3.3, -9).add(new Vector2(-2.2, 3)).equalsApproximately(new Vector2(-5.5, -6), 0.000001)) - .toBe(true) + expect( + new Vector2(1, 0) + .add(new Vector2(0, 1)) + .equalsApproximately(new Vector2(1, 1), 0.000001) + ).toBe(true) + + expect( + new Vector2(-3.3, -9) + .add(new Vector2(-2.2, 3)) + .equalsApproximately(new Vector2(-5.5, -6), 0.000001) + ).toBe(true) }) }) describe('#subtract', () => { it('should subtract two vectors correctly', () => { - expect(new Vector2(1, 0).subtract(new Vector2(0, 1)).equalsApproximately(new Vector2(1, -1), 0.000001)) - .toBe(true) - - expect(new Vector2(234.5, 1.7).subtract(new Vector2(3.3, 2.7)).equalsApproximately(new Vector2(231.2, -1), 0.000001)) - .toBe(true) + expect( + new Vector2(1, 0) + .subtract(new Vector2(0, 1)) + .equalsApproximately(new Vector2(1, -1), 0.000001) + ).toBe(true) + + expect( + new Vector2(234.5, 1.7) + .subtract(new Vector2(3.3, 2.7)) + .equalsApproximately(new Vector2(231.2, -1), 0.000001) + ).toBe(true) }) }) describe('#multiply', () => { it('should multiply two vectors correctly', () => { - expect(new Vector2(1, 0).multiply(5).equalsApproximately(new Vector2(5, 0), 0.000001)) - .toBe(true) - - expect(new Vector2(3.41, -7.12).multiply(-3.1).equalsApproximately(new Vector2(-10.571, 22.072), 0.000001)) - .toBe(true) + expect( + new Vector2(1, 0) + .multiply(5) + .equalsApproximately(new Vector2(5, 0), 0.000001) + ).toBe(true) + + expect( + new Vector2(3.41, -7.12) + .multiply(-3.1) + .equalsApproximately(new Vector2(-10.571, 22.072), 0.000001) + ).toBe(true) }) }) describe('#length', () => { - it('should calculate it\'s length correctly', () => { + it("should calculate it's length correctly", () => { expect(new Vector2(1, 0).length()).toBe(1) expect(new Vector2(-1, 1).length()).toBe(Math.sqrt(2)) @@ -59,11 +87,20 @@ describe('Vector2', () => { describe('#normalize', () => { it('should normalize vectors correctly', () => { - expect(new Vector2(1, 0).normalize().equalsApproximately(new Vector2(1, 0), 0.000001)) - .toBe(true) - - expect(new Vector2(1, -1).normalize().equalsApproximately(new Vector2(Math.sqrt(2) / 2, -Math.sqrt(2) / 2), 0.000001)) - .toBe(true) + expect( + new Vector2(1, 0) + .normalize() + .equalsApproximately(new Vector2(1, 0), 0.000001) + ).toBe(true) + + expect( + new Vector2(1, -1) + .normalize() + .equalsApproximately( + new Vector2(Math.sqrt(2) / 2, -Math.sqrt(2) / 2), + 0.000001 + ) + ).toBe(true) }) }) @@ -85,19 +122,29 @@ describe('Vector2', () => { describe('#rotate', () => { it('should rotate a vector correctly', () => { - expect(new Vector2(0, -1).rotate(Math.PI / 2).equalsApproximately(new Vector2(1, 0), 0.000001)) - .toBe(true) - - expect(new Vector2(1.23, -4.56).rotate(Math.PI).equalsApproximately(new Vector2(-1.23, 4.56), 0.000001)) - .toBe(true) + expect( + new Vector2(0, -1) + .rotate(Math.PI / 2) + .equalsApproximately(new Vector2(1, 0), 0.000001) + ).toBe(true) + + expect( + new Vector2(1.23, -4.56) + .rotate(Math.PI) + .equalsApproximately(new Vector2(-1.23, 4.56), 0.000001) + ).toBe(true) }) }) describe('#angleBetween', () => { it('should calculate the angle between two vectors correctly', () => { - expect(new Vector2(1, 0).angleBetween(new Vector2(0, 1))).toBe(Math.PI / 2) + expect(new Vector2(1, 0).angleBetween(new Vector2(0, 1))).toBe( + Math.PI / 2 + ) - expect(new Vector2(1, 0).angleBetween(new Vector2(1, -1))).toBe(-Math.PI / 4) + expect(new Vector2(1, 0).angleBetween(new Vector2(1, -1))).toBe( + -Math.PI / 4 + ) }) }) }) diff --git a/Dynamic-Programming/EditDistance.js b/Dynamic-Programming/EditDistance.js index d5bd5461db..64b0d5a7fe 100644 --- a/Dynamic-Programming/EditDistance.js +++ b/Dynamic-Programming/EditDistance.js @@ -15,7 +15,7 @@ space complexity - O(n*m) const minimumEditDistance = (word1, word2) => { const n = word1.length const m = word2.length - const dp = new Array(m + 1).fill(0).map(item => []) + const dp = new Array(m + 1).fill(0).map((item) => []) /* fill dp matrix with default values - diff --git a/Dynamic-Programming/FindMonthCalendar.js b/Dynamic-Programming/FindMonthCalendar.js index 6070cb11db..20c2fb4129 100644 --- a/Dynamic-Programming/FindMonthCalendar.js +++ b/Dynamic-Programming/FindMonthCalendar.js @@ -1,12 +1,12 @@ /* -* This algorithm accepts a month in the format mm/yyyy. -* And prints out the month's calendar. -* It uses an epoch of 1/1/1900, Monday. -*/ + * This algorithm accepts a month in the format mm/yyyy. + * And prints out the month's calendar. + * It uses an epoch of 1/1/1900, Monday. + */ import { isLeapYear } from '../Maths/LeapYear' class Month { - constructor () { + constructor() { this.Days = ['M', 'T', 'W', 'Th', 'F', 'S', 'Su'] this.BDays = ['M', 'Su', 'S', 'F', 'Th', 'W', 'T'] this.epoch = { month: 1, year: 1900 } @@ -14,9 +14,10 @@ class Month { this.monthDaysLeap = [31, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] } - printCal (days, startDay, output = value => console.log(value)) { + printCal(days, startDay, output = (value) => console.log(value)) { output('M T W Th F S Su') - const dates = []; let i + const dates = [] + let i for (i = 1; i <= days; i++) { dates.push(i) } @@ -25,9 +26,9 @@ class Month { } while (true) { let row = '' - for (i = 0; (i < 7) && (dates.length !== 0); i++) { + for (i = 0; i < 7 && dates.length !== 0; i++) { row += dates.shift() - while ((row.length % 4) !== 0) { + while (row.length % 4 !== 0) { row += ' ' } } @@ -36,8 +37,10 @@ class Month { } } - parseDate (date) { - const dateAr = []; let block = ''; let i + parseDate(date) { + const dateAr = [] + let block = '' + let i for (i = 0; i < date.length; i++) { if (date[i] === '/') { dateAr.push(parseInt(block)) @@ -52,7 +55,7 @@ class Month { return dateOb } - isGreater (startDate, endDate) { + isGreater(startDate, endDate) { if (startDate.year > endDate.year) { return true } else if (startDate.year < endDate.year) { @@ -65,26 +68,28 @@ class Month { return true } - getDayDiff (startDate, endDate) { + getDayDiff(startDate, endDate) { if (this.isGreater(startDate, endDate) === null) { return 0 - } else if ((this.isGreater(startDate, endDate) === true)) { + } else if (this.isGreater(startDate, endDate) === true) { const midDate = startDate startDate = endDate endDate = midDate } let diff = 0 while (startDate.year !== endDate.year) { - diff += (isLeapYear(startDate.year)) ? 366 : 365 + diff += isLeapYear(startDate.year) ? 366 : 365 startDate.year = startDate.year + 1 } while (startDate.month !== endDate.month) { if (startDate.month < endDate.month) { - if (isLeapYear(startDate.year)) diff += this.monthDaysLeap[startDate.month] + if (isLeapYear(startDate.year)) + diff += this.monthDaysLeap[startDate.month] else diff += this.monthDays[startDate.month] startDate.month = startDate.month + 1 } else { - if (isLeapYear(startDate.year)) diff -= this.monthDaysLeap[startDate.month - 1] + if (isLeapYear(startDate.year)) + diff -= this.monthDaysLeap[startDate.month - 1] else diff -= this.monthDays[startDate.month - 1] startDate.month = startDate.month - 1 } @@ -92,14 +97,18 @@ class Month { return diff } - generateMonthCal (date) { - const Month = this.parseDate(date); let day = '' + generateMonthCal(date) { + const Month = this.parseDate(date) + let day = '' let difference = this.getDayDiff(this.epoch, Month) difference = difference % 7 let Month2 = this.parseDate(date) - day = (this.isGreater(Month2, this.epoch)) ? this.Days[difference] : this.BDays[difference] + day = this.isGreater(Month2, this.epoch) + ? this.Days[difference] + : this.BDays[difference] Month2 = this.parseDate(date) - if (isLeapYear(Month2.year)) this.printCal(this.monthDaysLeap[Month2.month], day) + if (isLeapYear(Month2.year)) + this.printCal(this.monthDaysLeap[Month2.month], day) else this.printCal(this.monthDays[Month2.month], day) } } diff --git a/Dynamic-Programming/KadaneAlgo.js b/Dynamic-Programming/KadaneAlgo.js index 6f45e675a1..b3c7462cb6 100644 --- a/Dynamic-Programming/KadaneAlgo.js +++ b/Dynamic-Programming/KadaneAlgo.js @@ -9,7 +9,7 @@ * Reference article :- https://www.geeksforgeeks.org/largest-sum-contiguous-subarray/ */ -export function kadaneAlgo (array) { +export function kadaneAlgo(array) { let cumulativeSum = 0 let maxSum = Number.NEGATIVE_INFINITY // maxSum has the least possible value for (let i = 0; i < array.length; i++) { diff --git a/Dynamic-Programming/LevenshteinDistance.js b/Dynamic-Programming/LevenshteinDistance.js index 71ff6fe0a2..fb8b75bfa4 100644 --- a/Dynamic-Programming/LevenshteinDistance.js +++ b/Dynamic-Programming/LevenshteinDistance.js @@ -7,7 +7,7 @@ * @see [Levenshtein_distance](https://en.wikipedia.org/wiki/Levenshtein_distance) */ -function minimum (a, b, c) { +function minimum(a, b, c) { if (a < b && a < c) { return a } else if (b < a && b < c) { @@ -17,12 +17,12 @@ function minimum (a, b, c) { } } -function costOfSubstitution (x, y) { +function costOfSubstitution(x, y) { return x === y ? 0 : 1 } // Levenshtein distance between x and y -function calculateLevenshteinDp (x, y) { +function calculateLevenshteinDp(x, y) { const dp = new Array(x.length + 1) for (let i = 0; i < x.length + 1; i++) { dp[i] = new Array(y.length + 1) @@ -35,7 +35,12 @@ function calculateLevenshteinDp (x, y) { } else if (j === 0) { dp[i][j] = i } else { - dp[i][j] = minimum(dp[i - 1][j - 1] + costOfSubstitution(x.charAt(i - 1), y.charAt(j - 1)), dp[i - 1][j] + 1, dp[i][j - 1] + 1) + dp[i][j] = minimum( + dp[i - 1][j - 1] + + costOfSubstitution(x.charAt(i - 1), y.charAt(j - 1)), + dp[i - 1][j] + 1, + dp[i][j - 1] + 1 + ) } } } diff --git a/Dynamic-Programming/LongestCommonSubsequence.js b/Dynamic-Programming/LongestCommonSubsequence.js index 23f32c43fb..9c2a35fc6f 100644 --- a/Dynamic-Programming/LongestCommonSubsequence.js +++ b/Dynamic-Programming/LongestCommonSubsequence.js @@ -27,11 +27,12 @@ References: * @param {string} str2 Input string #2 * @returns {number} Length of the longest common subsequence */ -function longestCommonSubsequence (str1, str2) { - const memo = new Array(str1.length + 1).fill(null) +function longestCommonSubsequence(str1, str2) { + const memo = new Array(str1.length + 1) + .fill(null) .map(() => new Array(str2.length + 1).fill(null)) - function recursive (end1, end2) { + function recursive(end1, end2) { if (end1 === -1 || end2 === -1) { return 0 } diff --git a/Dynamic-Programming/LongestIncreasingSubsequence.js b/Dynamic-Programming/LongestIncreasingSubsequence.js index ac7f8d35c1..b9319db586 100644 --- a/Dynamic-Programming/LongestIncreasingSubsequence.js +++ b/Dynamic-Programming/LongestIncreasingSubsequence.js @@ -4,7 +4,7 @@ */ // Return the length of the Longest Increasing Subsequence, given array x -function longestIncreasingSubsequence (x) { +function longestIncreasingSubsequence(x) { const length = x.length const dp = Array(length).fill(1) diff --git a/Dynamic-Programming/LongestPalindromicSubsequence.js b/Dynamic-Programming/LongestPalindromicSubsequence.js index c6281e80eb..69a779c402 100644 --- a/Dynamic-Programming/LongestPalindromicSubsequence.js +++ b/Dynamic-Programming/LongestPalindromicSubsequence.js @@ -9,7 +9,9 @@ export const longestPalindromeSubsequence = function (s) { const n = s.length - const dp = new Array(n).fill(0).map(item => new Array(n).fill(0).map(item => 0)) + const dp = new Array(n) + .fill(0) + .map((item) => new Array(n).fill(0).map((item) => 0)) // fill predefined for single character for (let i = 0; i < n; i++) { diff --git a/Dynamic-Programming/MaxNonAdjacentSum.js b/Dynamic-Programming/MaxNonAdjacentSum.js index e7803b6a23..7c04f5f351 100644 --- a/Dynamic-Programming/MaxNonAdjacentSum.js +++ b/Dynamic-Programming/MaxNonAdjacentSum.js @@ -1,9 +1,9 @@ -function maximumNonAdjacentSum (nums) { +function maximumNonAdjacentSum(nums) { /* - * Find the maximum non-adjacent sum of the integers in the nums input list - * :param nums: Array of Numbers - * :return: The maximum non-adjacent sum - */ + * Find the maximum non-adjacent sum of the integers in the nums input list + * :param nums: Array of Numbers + * :return: The maximum non-adjacent sum + */ if (nums.length < 0) return 0 diff --git a/Dynamic-Programming/MaxProductOfThree.js b/Dynamic-Programming/MaxProductOfThree.js index 635aa8ee1d..5df275df56 100644 --- a/Dynamic-Programming/MaxProductOfThree.js +++ b/Dynamic-Programming/MaxProductOfThree.js @@ -5,7 +5,7 @@ * @param {number[]} arrayItems * @returns number */ -export function maxProductOfThree (arrayItems) { +export function maxProductOfThree(arrayItems) { // if size is less than 3, no triplet exists const n = arrayItems.length if (n < 3) throw new Error('Triplet cannot exist with the given array') diff --git a/Dynamic-Programming/MinimumCostPath.js b/Dynamic-Programming/MinimumCostPath.js index 53765eab4d..3fd8181751 100644 --- a/Dynamic-Programming/MinimumCostPath.js +++ b/Dynamic-Programming/MinimumCostPath.js @@ -20,7 +20,9 @@ const minCostPath = (matrix) => { for (let i = 1; i < n; i++) moves[i][0] = moves[i - 1][0] + matrix[i][0] for (let i = 1; i < n; i++) { - for (let j = 1; j < m; j++) { moves[i][j] = Math.min(moves[i - 1][j], moves[i][j - 1]) + matrix[i][j] } + for (let j = 1; j < m; j++) { + moves[i][j] = Math.min(moves[i - 1][j], moves[i][j - 1]) + matrix[i][j] + } } return moves[n - 1][m - 1] diff --git a/Dynamic-Programming/NumberOfSubsetEqualToGivenSum.js b/Dynamic-Programming/NumberOfSubsetEqualToGivenSum.js index 7ae79e12aa..dee12f8de9 100644 --- a/Dynamic-Programming/NumberOfSubsetEqualToGivenSum.js +++ b/Dynamic-Programming/NumberOfSubsetEqualToGivenSum.js @@ -6,7 +6,7 @@ equal to the given sum. /* Given solution is O(n*sum) Time complexity and O(sum) Space complexity */ -function NumberOfSubsetSum (array, sum) { +function NumberOfSubsetSum(array, sum) { const dp = [] // create an dp array where dp[i] denote number of subset with sum equal to i for (let i = 1; i <= sum; i++) { dp[i] = 0 diff --git a/Dynamic-Programming/RodCutting.js b/Dynamic-Programming/RodCutting.js index 1e8bac82ef..d9d5397d5c 100644 --- a/Dynamic-Programming/RodCutting.js +++ b/Dynamic-Programming/RodCutting.js @@ -1,15 +1,17 @@ /* - * You are given a rod of 'n' length and an array of prices associated with all the lengths less than 'n'. - * Find the maximum profit possible by cutting the rod and selling the pieces. -*/ + * You are given a rod of 'n' length and an array of prices associated with all the lengths less than 'n'. + * Find the maximum profit possible by cutting the rod and selling the pieces. + */ -export function rodCut (prices, n) { +export function rodCut(prices, n) { const memo = new Array(n + 1) memo[0] = 0 for (let i = 1; i <= n; i++) { let maxVal = Number.MIN_VALUE - for (let j = 0; j < i; j++) { maxVal = Math.max(maxVal, prices[j] + memo[i - j - 1]) } + for (let j = 0; j < i; j++) { + maxVal = Math.max(maxVal, prices[j] + memo[i - j - 1]) + } memo[i] = maxVal } diff --git a/Dynamic-Programming/Shuf.js b/Dynamic-Programming/Shuf.js index cb064097fb..58d5a8a568 100644 --- a/Dynamic-Programming/Shuf.js +++ b/Dynamic-Programming/Shuf.js @@ -3,7 +3,7 @@ Given a data set of an unknown size, Get a random sample in a random order It's used in data analytics, often as a way to get a small random sample from a data lake or warehouse, or from a large CSV file */ -function shuf (datasetSource, sampleSize) { +function shuf(datasetSource, sampleSize) { const output = fillBaseSample(datasetSource, sampleSize) return randomizeOutputFromDataset(datasetSource, output) @@ -16,7 +16,7 @@ function shuf (datasetSource, sampleSize) { * @returns {Array.} The random sample, as an array * @template T */ -function fillBaseSample (datasetSource, sampleSize) { +function fillBaseSample(datasetSource, sampleSize) { let filledIndexes = [] let output = new Array(sampleSize) @@ -58,7 +58,7 @@ function fillBaseSample (datasetSource, sampleSize) { * @returns {Array.} The random sample, as an array * @template T */ -function randomizeOutputFromDataset (datasetSource, output) { +function randomizeOutputFromDataset(datasetSource, output) { const newOutput = [...output] let readSoFar = output.length @@ -82,8 +82,8 @@ function randomizeOutputFromDataset (datasetSource, output) { * Generates a random range of data, with values between 0 and 2^31 - 1 * @param {number} length The number of data items to generate * @returns {Iterable} Random iterable data -*/ -function * generateRandomData (length) { + */ +function* generateRandomData(length) { const maxValue = Math.pow(2, 31) - 1 for (let i = 0; i < length; i++) { yield Math.floor(Math.random() * maxValue) diff --git a/Dynamic-Programming/SieveOfEratosthenes.js b/Dynamic-Programming/SieveOfEratosthenes.js index 77e588c073..9860273d78 100644 --- a/Dynamic-Programming/SieveOfEratosthenes.js +++ b/Dynamic-Programming/SieveOfEratosthenes.js @@ -5,7 +5,7 @@ * @return {Number[]} List of Primes till n. * @see [Sieve_of_Eratosthenes](https://www.geeksforgeeks.org/sieve-of-eratosthenes/) */ -function sieveOfEratosthenes (n) { +function sieveOfEratosthenes(n) { if (n <= 1) return [] const primes = new Array(n + 1).fill(true) // set all as true initially primes[0] = primes[1] = false // Handling case for 0 and 1 diff --git a/Dynamic-Programming/Sliding-Window/LongestSubstringWithoutRepeatingCharacters.js b/Dynamic-Programming/Sliding-Window/LongestSubstringWithoutRepeatingCharacters.js index 9b3822eeca..e9a60b05d9 100644 --- a/Dynamic-Programming/Sliding-Window/LongestSubstringWithoutRepeatingCharacters.js +++ b/Dynamic-Programming/Sliding-Window/LongestSubstringWithoutRepeatingCharacters.js @@ -10,7 +10,7 @@ * @description Get the length of the longest substring without repeating characters * @param {String} s - The input string */ -export function LongestSubstringWithoutRepeatingCharacters (s) { +export function LongestSubstringWithoutRepeatingCharacters(s) { let maxLength = 0 let start = 0 let end = 0 diff --git a/Dynamic-Programming/Sliding-Window/PermutationinString.js b/Dynamic-Programming/Sliding-Window/PermutationinString.js index 7022cb651b..28111fe8cf 100644 --- a/Dynamic-Programming/Sliding-Window/PermutationinString.js +++ b/Dynamic-Programming/Sliding-Window/PermutationinString.js @@ -12,7 +12,7 @@ * @return {boolean} - Returns true if s2 contains a permutation of s1, or false otherwise. */ -export function PermutationinString (s1, s2) { +export function PermutationinString(s1, s2) { if (s1.length > s2.length) return false let start = 0 let end = s1.length - 1 @@ -35,11 +35,11 @@ export function PermutationinString (s1, s2) { } return false } -function equals (a, b) { +function equals(a, b) { return JSON.stringify(a) === JSON.stringify(b) } -function SetHash () { +function SetHash() { const set = new Set() const alphabets = 'abcdefghijklmnopqrstuvwxyz' for (let i = 0; i < alphabets.length; i++) { diff --git a/Dynamic-Programming/SudokuSolver.js b/Dynamic-Programming/SudokuSolver.js index b077f6ec18..6c40474670 100644 --- a/Dynamic-Programming/SudokuSolver.js +++ b/Dynamic-Programming/SudokuSolver.js @@ -1,7 +1,7 @@ const isValid = (board, row, col, k) => { for (let i = 0; i < 9; i++) { const m = 3 * Math.floor(row / 3) + Math.floor(i / 3) - const n = 3 * Math.floor(col / 3) + i % 3 + const n = 3 * Math.floor(col / 3) + (i % 3) if (board[row][i] === k || board[i][col] === k || board[m][n] === k) { return false } diff --git a/Dynamic-Programming/ZeroOneKnapsack.js b/Dynamic-Programming/ZeroOneKnapsack.js index 4a9bbfa118..3913d016b3 100644 --- a/Dynamic-Programming/ZeroOneKnapsack.js +++ b/Dynamic-Programming/ZeroOneKnapsack.js @@ -12,7 +12,10 @@ const zeroOneKnapsack = (arr, n, cap, cache) => { return cache[n][cap] } if (arr[n - 1][0] <= cap) { - cache[n][cap] = Math.max(arr[n - 1][1] + zeroOneKnapsack(arr, n - 1, cap - arr[n - 1][0], cache), zeroOneKnapsack(arr, n - 1, cap, cache)) + cache[n][cap] = Math.max( + arr[n - 1][1] + zeroOneKnapsack(arr, n - 1, cap - arr[n - 1][0], cache), + zeroOneKnapsack(arr, n - 1, cap, cache) + ) return cache[n][cap] } else { cache[n][cap] = zeroOneKnapsack(arr, n - 1, cap, cache) @@ -52,9 +55,7 @@ const example = () => { arr.push(input[j]) j++ } - const newArr = arr.map(e => - e.trim().split(' ').map(Number) - ) + const newArr = arr.map((e) => e.trim().split(' ').map(Number)) const cache = [] for (let i = 0; i <= currlen; i++) { const temp = [] diff --git a/Dynamic-Programming/tests/EditDistance.test.js b/Dynamic-Programming/tests/EditDistance.test.js index 6bda3ee3cd..b7ea2eaa22 100644 --- a/Dynamic-Programming/tests/EditDistance.test.js +++ b/Dynamic-Programming/tests/EditDistance.test.js @@ -1,22 +1,22 @@ -import { minimumEditDistance } from '../EditDistance' - -test('minimumEditDistance(kitten, sitten) => 1', () => { - const str1 = 'kitten' - const str2 = 'sitten' - const res = minimumEditDistance(str1, str2) - expect(res).toEqual(1) -}) - -test('minimumEditDistance(school, skull) => 4', () => { - const str1 = 'school' - const str2 = 'skull' - const res = minimumEditDistance(str1, str2) - expect(res).toEqual(4) -}) - -test('minimumEditDistance(Algorithm, Algorithm) => 0', () => { - const str1 = 'Algorithm' - const str2 = 'Algorithm' - const res = minimumEditDistance(str1, str2) - expect(res).toEqual(0) -}) +import { minimumEditDistance } from '../EditDistance' + +test('minimumEditDistance(kitten, sitten) => 1', () => { + const str1 = 'kitten' + const str2 = 'sitten' + const res = minimumEditDistance(str1, str2) + expect(res).toEqual(1) +}) + +test('minimumEditDistance(school, skull) => 4', () => { + const str1 = 'school' + const str2 = 'skull' + const res = minimumEditDistance(str1, str2) + expect(res).toEqual(4) +}) + +test('minimumEditDistance(Algorithm, Algorithm) => 0', () => { + const str1 = 'Algorithm' + const str2 = 'Algorithm' + const res = minimumEditDistance(str1, str2) + expect(res).toEqual(0) +}) diff --git a/Dynamic-Programming/tests/LongestCommonSubsequence.test.js b/Dynamic-Programming/tests/LongestCommonSubsequence.test.js index 3e5c214d56..f797b0ecd8 100644 --- a/Dynamic-Programming/tests/LongestCommonSubsequence.test.js +++ b/Dynamic-Programming/tests/LongestCommonSubsequence.test.js @@ -26,7 +26,11 @@ describe('LongestCommonSubsequence', () => { }) it('expects to return the longest common subsequence, medium-length inputs', () => { - expect(longestCommonSubsequence('bsbininm', 'jmjkbkjkv')).toEqual('b'.length) - expect(longestCommonSubsequence('oxcpqrsvwf', 'shmtulqrypy')).toEqual('qr'.length) + expect(longestCommonSubsequence('bsbininm', 'jmjkbkjkv')).toEqual( + 'b'.length + ) + expect(longestCommonSubsequence('oxcpqrsvwf', 'shmtulqrypy')).toEqual( + 'qr'.length + ) }) }) diff --git a/Dynamic-Programming/tests/MaxProductOfThree.test.js b/Dynamic-Programming/tests/MaxProductOfThree.test.js index 68ed8bedd0..8ebc476398 100644 --- a/Dynamic-Programming/tests/MaxProductOfThree.test.js +++ b/Dynamic-Programming/tests/MaxProductOfThree.test.js @@ -21,7 +21,7 @@ describe('MaxProductOfThree', () => { describe('MaxProductOfThree, random arrays of size 3 to 5', () => { // Slower function that operates in O(n^3), where n is the length of the input array. // Calculates all possible products of 3 numbers in the array and returns the largest - function completeMaxThree (array) { + function completeMaxThree(array) { let maximumProduct = null for (let i = 0; i < array.length - 2; i++) { for (let j = i + 1; j < array.length - 1; j++) { @@ -47,7 +47,9 @@ describe('MaxProductOfThree, random arrays of size 3 to 5', () => { for (let i = 0; i < numberOfRandomTests; i++) { const arr = [] // Randomize the length of the array in the current test - const length = Math.floor(Math.random() * (maxLength - minLength) + minLength) + const length = Math.floor( + Math.random() * (maxLength - minLength) + minLength + ) // Fill the array with random values in the specified range for (let j = 0; j < length + 1; j++) { @@ -58,13 +60,19 @@ describe('MaxProductOfThree, random arrays of size 3 to 5', () => { const expectedProduct = completeMaxThree(arr) // Set up the expectation - it('Expect the array ' + arr.toString() + ' to return the maximum three product of ' + expectedProduct, () => { - // Calculate the max three product using the function being tested - const actualProduct = maxProductOfThree(arr) + it( + 'Expect the array ' + + arr.toString() + + ' to return the maximum three product of ' + + expectedProduct, + () => { + // Calculate the max three product using the function being tested + const actualProduct = maxProductOfThree(arr) - // Was unable to use expect().toBe(), since it sometimes compared 0 to -0, and that would not pass - // At the same time, standardjs forbid me from checking for === -0 to convert to 0 - expect(actualProduct === expectedProduct).toBeTruthy() - }) + // Was unable to use expect().toBe(), since it sometimes compared 0 to -0, and that would not pass + // At the same time, standardjs forbid me from checking for === -0 to convert to 0 + expect(actualProduct === expectedProduct).toBeTruthy() + } + ) } }) diff --git a/Dynamic-Programming/tests/SieveOfEratosthenes.test.js b/Dynamic-Programming/tests/SieveOfEratosthenes.test.js index 7fa2d4cc7e..b911440cc9 100644 --- a/Dynamic-Programming/tests/SieveOfEratosthenes.test.js +++ b/Dynamic-Programming/tests/SieveOfEratosthenes.test.js @@ -18,6 +18,8 @@ describe('SieveOfEratosthenes', () => { }) it('Primes till 70', () => { - expect(sieveOfEratosthenes(70)).toEqual([2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67]) + expect(sieveOfEratosthenes(70)).toEqual([ + 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67 + ]) }) }) diff --git a/Dynamic-Programming/tests/UniquePaths2.test.js b/Dynamic-Programming/tests/UniquePaths2.test.js index e34b9a3303..2780fdd89a 100644 --- a/Dynamic-Programming/tests/UniquePaths2.test.js +++ b/Dynamic-Programming/tests/UniquePaths2.test.js @@ -3,13 +3,37 @@ import { uniquePaths2 } from '../UniquePaths2' describe('Unique Paths2', () => { // Should return number of ways, taken into account the obstacles test('There are obstacles in the way', () => { - expect(uniquePaths2([[0, 0, 0], [0, 1, 0], [0, 0, 0]])).toEqual(2) - expect(uniquePaths2([[0, 0, 0], [0, 1, 0], [0, 0, 0], [1, 0, 0]])).toEqual(3) + expect( + uniquePaths2([ + [0, 0, 0], + [0, 1, 0], + [0, 0, 0] + ]) + ).toEqual(2) + expect( + uniquePaths2([ + [0, 0, 0], + [0, 1, 0], + [0, 0, 0], + [1, 0, 0] + ]) + ).toEqual(3) }) // Should return number of all possible ways to reach right-bottom corner test('There are no obstacles in the way', () => { - expect(uniquePaths2([[0, 0, 0], [0, 0, 0], [0, 0, 0]])).toEqual(6) - expect(uniquePaths2([[0, 0, 0], [0, 0, 0]])).toEqual(3) + expect( + uniquePaths2([ + [0, 0, 0], + [0, 0, 0], + [0, 0, 0] + ]) + ).toEqual(6) + expect( + uniquePaths2([ + [0, 0, 0], + [0, 0, 0] + ]) + ).toEqual(3) }) // Should throw an exception b/c input data has wrong type test('There are wrong type of input data', () => { diff --git a/Dynamic-Programming/tests/ZeroOneKnapsack.test.js b/Dynamic-Programming/tests/ZeroOneKnapsack.test.js index 9d814a189c..4f630d1eef 100644 --- a/Dynamic-Programming/tests/ZeroOneKnapsack.test.js +++ b/Dynamic-Programming/tests/ZeroOneKnapsack.test.js @@ -2,11 +2,36 @@ import { zeroOneKnapsack } from '../ZeroOneKnapsack' describe('ZeroOneKnapsack', () => { it('zeroOneKnapsack when capacity is 4 and 5 items', () => { - expect(zeroOneKnapsack([[1, 8], [2, 4], [3, 0], [2, 5], [2, 3]], 5, 4, [[-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1]])).toBe(13) + expect( + zeroOneKnapsack( + [ + [1, 8], + [2, 4], + [3, 0], + [2, 5], + [2, 3] + ], + 5, + 4, + [ + [-1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1] + ] + ) + ).toBe(13) }) it('zeroOneKnapsack when capacity is 1 and 1 items', () => { - expect(zeroOneKnapsack([[1, 80]], 1, 1, [[-1, -1], [-1, -1]])).toBe(80) + expect( + zeroOneKnapsack([[1, 80]], 1, 1, [ + [-1, -1], + [-1, -1] + ]) + ).toBe(80) }) it('zeroOneKnapsack when capacity is 0 and 1 items', () => { diff --git a/Geometry/Circle.js b/Geometry/Circle.js index 9e06527c9b..3e3a3e03f4 100644 --- a/Geometry/Circle.js +++ b/Geometry/Circle.js @@ -5,7 +5,7 @@ * @param {number} radius - The radius of the circle. */ export default class Circle { - constructor (radius) { + constructor(radius) { this.radius = radius } diff --git a/Geometry/Cone.js b/Geometry/Cone.js index 742a527f41..8820cfe0ae 100644 --- a/Geometry/Cone.js +++ b/Geometry/Cone.js @@ -6,7 +6,7 @@ * @param {number} height - The height of the cone */ export default class Cone { - constructor (baseRadius, height) { + constructor(baseRadius, height) { this.baseRadius = baseRadius this.height = height } @@ -16,10 +16,15 @@ export default class Cone { } volume = () => { - return this.baseArea() * this.height * 1 / 3 + return (this.baseArea() * this.height * 1) / 3 } surfaceArea = () => { - return this.baseArea() + Math.PI * this.baseRadius * Math.sqrt(Math.pow(this.baseRadius, 2) + Math.pow(this.height, 2)) + return ( + this.baseArea() + + Math.PI * + this.baseRadius * + Math.sqrt(Math.pow(this.baseRadius, 2) + Math.pow(this.height, 2)) + ) } } diff --git a/Geometry/ConvexHullGraham.js b/Geometry/ConvexHullGraham.js index e74b226eb7..0d400242dd 100644 --- a/Geometry/ConvexHullGraham.js +++ b/Geometry/ConvexHullGraham.js @@ -6,13 +6,13 @@ * convex polygon that contains all the points of it. */ -function compare (a, b) { +function compare(a, b) { // Compare Function to Sort the points, a and b are points to compare if (a.x < b.x) return -1 if (a.x === b.x && a.y < b.y) return -1 return 1 } -function orientation (a, b, c) { +function orientation(a, b, c) { // Check orientation of Line(a,b) and Line(b,c) const alpha = (b.y - a.y) / (b.x - a.x) const beta = (c.y - b.y) / (c.x - b.x) @@ -25,17 +25,19 @@ function orientation (a, b, c) { return 0 } -function convexHull (points) { +function convexHull(points) { const pointsLen = points.length if (pointsLen <= 2) { throw new Error('Minimum of 3 points is required to form closed polygon!') } points.sort(compare) - const p1 = points[0]; const p2 = points[pointsLen - 1] + const p1 = points[0] + const p2 = points[pointsLen - 1] // Divide Hull in two halves - const upperPoints = []; const lowerPoints = [] + const upperPoints = [] + const lowerPoints = [] upperPoints.push(p1) lowerPoints.push(p1) @@ -44,7 +46,14 @@ function convexHull (points) { if (i === pointsLen - 1 || orientation(p1, points[i], p2) !== -1) { let upLen = upperPoints.length - while (upLen >= 2 && orientation(upperPoints[upLen - 2], upperPoints[upLen - 1], points[i]) === -1) { + while ( + upLen >= 2 && + orientation( + upperPoints[upLen - 2], + upperPoints[upLen - 1], + points[i] + ) === -1 + ) { upperPoints.pop() upLen = upperPoints.length } @@ -52,7 +61,14 @@ function convexHull (points) { } if (i === pointsLen - 1 || orientation(p1, points[i], p2) !== 1) { let lowLen = lowerPoints.length - while (lowLen >= 2 && orientation(lowerPoints[lowLen - 2], lowerPoints[lowLen - 1], points[i]) === 1) { + while ( + lowLen >= 2 && + orientation( + lowerPoints[lowLen - 2], + lowerPoints[lowLen - 1], + points[i] + ) === 1 + ) { lowerPoints.pop() lowLen = lowerPoints.length } diff --git a/Geometry/Pyramid.js b/Geometry/Pyramid.js index 759b7376e1..294f43c873 100644 --- a/Geometry/Pyramid.js +++ b/Geometry/Pyramid.js @@ -6,7 +6,7 @@ * @param {number} height - The height of the pyramid */ export default class Pyramid { - constructor (bsl, height) { + constructor(bsl, height) { this.bsl = bsl this.height = height } @@ -16,10 +16,14 @@ export default class Pyramid { } volume = () => { - return this.baseArea() * this.height / 3 + return (this.baseArea() * this.height) / 3 } surfaceArea = () => { - return this.baseArea() + this.bsl * 4 / 2 * Math.sqrt(Math.pow(this.bsl / 2, 2) + Math.pow(this.height, 2)) + return ( + this.baseArea() + + ((this.bsl * 4) / 2) * + Math.sqrt(Math.pow(this.bsl / 2, 2) + Math.pow(this.height, 2)) + ) } } diff --git a/Geometry/Sphere.js b/Geometry/Sphere.js index 82f539b917..28c9448237 100644 --- a/Geometry/Sphere.js +++ b/Geometry/Sphere.js @@ -5,12 +5,12 @@ * @see https://en.wikipedia.org/wiki/Sphere */ export default class Sphere { - constructor (radius) { + constructor(radius) { this.radius = radius } volume = () => { - return Math.pow(this.radius, 3) * Math.PI * 4 / 3 + return (Math.pow(this.radius, 3) * Math.PI * 4) / 3 } surfaceArea = () => { diff --git a/Geometry/Test/ConvexHullGraham.test.js b/Geometry/Test/ConvexHullGraham.test.js index 747f995538..ba6c794984 100644 --- a/Geometry/Test/ConvexHullGraham.test.js +++ b/Geometry/Test/ConvexHullGraham.test.js @@ -1,29 +1,41 @@ -import { convexHull } from '../ConvexHullGraham' - -test('The ConvexHull of the following points is [{x: 0, y: 3}, {x: 4, y: 4}, {x: 3, y: 1}, {x: 0, y: 0}]', () => { - const points = [ - { x: 0, y: 3 }, - { x: 1, y: 1 }, - { x: 2, y: 2 }, - { x: 4, y: 4 }, - { x: 0, y: 0 }, - { x: 1, y: 2 }, - { x: 3, y: 1 }, - { x: 3, y: 3 }] - const res = convexHull(points) - expect(res).toEqual([{ x: 0, y: 3 }, { x: 4, y: 4 }, { x: 3, y: 1 }, { x: 0, y: 0 }]) -}) - -test('The ConvexHull of the following points is [{x: 1, y: 4}, {x: 9, y: 6}, {x: 7, y: 0}, {x: 0, y: 0}]', () => { - const points = [ - { x: 4, y: 3 }, - { x: 1, y: 4 }, - { x: 2, y: 4 }, - { x: 0, y: 0 }, - { x: 9, y: 6 }, - { x: 1, y: 3 }, - { x: 4, y: 1 }, - { x: 7, y: 0 }] - const res = convexHull(points) - expect(res).toEqual([{ x: 1, y: 4 }, { x: 9, y: 6 }, { x: 7, y: 0 }, { x: 0, y: 0 }]) -}) +import { convexHull } from '../ConvexHullGraham' + +test('The ConvexHull of the following points is [{x: 0, y: 3}, {x: 4, y: 4}, {x: 3, y: 1}, {x: 0, y: 0}]', () => { + const points = [ + { x: 0, y: 3 }, + { x: 1, y: 1 }, + { x: 2, y: 2 }, + { x: 4, y: 4 }, + { x: 0, y: 0 }, + { x: 1, y: 2 }, + { x: 3, y: 1 }, + { x: 3, y: 3 } + ] + const res = convexHull(points) + expect(res).toEqual([ + { x: 0, y: 3 }, + { x: 4, y: 4 }, + { x: 3, y: 1 }, + { x: 0, y: 0 } + ]) +}) + +test('The ConvexHull of the following points is [{x: 1, y: 4}, {x: 9, y: 6}, {x: 7, y: 0}, {x: 0, y: 0}]', () => { + const points = [ + { x: 4, y: 3 }, + { x: 1, y: 4 }, + { x: 2, y: 4 }, + { x: 0, y: 0 }, + { x: 9, y: 6 }, + { x: 1, y: 3 }, + { x: 4, y: 1 }, + { x: 7, y: 0 } + ] + const res = convexHull(points) + expect(res).toEqual([ + { x: 1, y: 4 }, + { x: 9, y: 6 }, + { x: 7, y: 0 }, + { x: 0, y: 0 } + ]) +}) diff --git a/Graphs/BellmanFord.js b/Graphs/BellmanFord.js index cf9d168460..a324bc00b5 100644 --- a/Graphs/BellmanFord.js +++ b/Graphs/BellmanFord.js @@ -25,7 +25,7 @@ Reference: * @param dest Destination node * @returns Shortest distance from source to destination */ -function BellmanFord (graph, V, E, src, dest) { +function BellmanFord(graph, V, E, src, dest) { // Initialize distance of all vertices as infinite. const dis = Array(V).fill(Infinity) // initialize distance of source as 0 @@ -36,7 +36,9 @@ function BellmanFord (graph, V, E, src, dest) { // vertex can have at-most |V| - 1 edges for (let i = 0; i < V - 1; i++) { for (let j = 0; j < E; j++) { - if ((dis[graph[j][0]] + graph[j][2]) < dis[graph[j][1]]) { dis[graph[j][1]] = dis[graph[j][0]] + graph[j][2] } + if (dis[graph[j][0]] + graph[j][2] < dis[graph[j][1]]) { + dis[graph[j][1]] = dis[graph[j][0]] + graph[j][2] + } } } // check for negative-weight cycles. @@ -44,7 +46,7 @@ function BellmanFord (graph, V, E, src, dest) { const x = graph[i][0] const y = graph[i][1] const weight = graph[i][2] - if ((dis[x] !== Infinity) && (dis[x] + weight < dis[y])) { + if (dis[x] !== Infinity && dis[x] + weight < dis[y]) { return null } } diff --git a/Graphs/BinaryLifting.js b/Graphs/BinaryLifting.js index 4ab9baa5ae..b9a0116abc 100644 --- a/Graphs/BinaryLifting.js +++ b/Graphs/BinaryLifting.js @@ -10,7 +10,7 @@ */ export class BinaryLifting { - constructor (root, tree) { + constructor(root, tree) { this.root = root this.connections = new Map() this.up = new Map() // up[node][i] stores the 2^i-th parent of node @@ -21,12 +21,12 @@ export class BinaryLifting { this.dfs(root, root) } - addNode (node) { + addNode(node) { // Function to add a node to the tree (connection represented by set) this.connections.set(node, new Set()) } - addEdge (node1, node2) { + addEdge(node1, node2) { // Function to add an edge (adds the node too if they are not present in the tree) if (!this.connections.has(node1)) { this.addNode(node1) @@ -38,7 +38,7 @@ export class BinaryLifting { this.connections.get(node2).add(node1) } - dfs (node, parent) { + dfs(node, parent) { // The dfs function calculates 2^i-th ancestor of all nodes for i ranging from 0 to this.log // We make use of the fact the two consecutive jumps of length 2^(i-1) make the total jump length 2^i this.up.set(node, new Map()) @@ -53,7 +53,7 @@ export class BinaryLifting { } } - kthAncestor (node, k) { + kthAncestor(node, k) { // if value of k is more than or equal to the number of total nodes, we return the root of the graph if (k >= this.connections.size) { return this.root @@ -69,7 +69,7 @@ export class BinaryLifting { } } -function binaryLifting (root, tree, queries) { +function binaryLifting(root, tree, queries) { const graphObject = new BinaryLifting(root, tree) const ancestors = [] for (const [node, k] of queries) { diff --git a/Graphs/BreadthFirstSearch.js b/Graphs/BreadthFirstSearch.js index abac118ac6..c77ee0e923 100644 --- a/Graphs/BreadthFirstSearch.js +++ b/Graphs/BreadthFirstSearch.js @@ -1,37 +1,37 @@ -import Queue from '../Data-Structures/Queue/Queue' - -/** - * Breadth-first search is an algorithm for traversing a graph. - * - * It discovers all nodes reachable from the starting position by exploring all of the neighbor nodes at the present - * depth prior to moving on to the nodes at the next depth level. - * - * (description adapted from https://en.wikipedia.org/wiki/Breadth-first_search) - * @see https://www.koderdojo.com/blog/breadth-first-search-and-shortest-path-in-csharp-and-net-core - */ -export function breadthFirstSearch (graph, startingNode) { - // visited keeps track of all nodes visited - const visited = new Set() - - // queue contains the nodes to be explored in the future - const queue = new Queue() - queue.enqueue(startingNode) - - while (!queue.isEmpty()) { - // start with the queue's first node - const node = queue.dequeue() - - if (!visited.has(node)) { - // mark the node as visited - visited.add(node) - const neighbors = graph[node] - - // put all its neighbors into the queue - for (let i = 0; i < neighbors.length; i++) { - queue.enqueue(neighbors[i]) - } - } - } - - return visited -} +import Queue from '../Data-Structures/Queue/Queue' + +/** + * Breadth-first search is an algorithm for traversing a graph. + * + * It discovers all nodes reachable from the starting position by exploring all of the neighbor nodes at the present + * depth prior to moving on to the nodes at the next depth level. + * + * (description adapted from https://en.wikipedia.org/wiki/Breadth-first_search) + * @see https://www.koderdojo.com/blog/breadth-first-search-and-shortest-path-in-csharp-and-net-core + */ +export function breadthFirstSearch(graph, startingNode) { + // visited keeps track of all nodes visited + const visited = new Set() + + // queue contains the nodes to be explored in the future + const queue = new Queue() + queue.enqueue(startingNode) + + while (!queue.isEmpty()) { + // start with the queue's first node + const node = queue.dequeue() + + if (!visited.has(node)) { + // mark the node as visited + visited.add(node) + const neighbors = graph[node] + + // put all its neighbors into the queue + for (let i = 0; i < neighbors.length; i++) { + queue.enqueue(neighbors[i]) + } + } + } + + return visited +} diff --git a/Graphs/BreadthFirstShortestPath.js b/Graphs/BreadthFirstShortestPath.js index 0e29b6440a..14b74dedb7 100644 --- a/Graphs/BreadthFirstShortestPath.js +++ b/Graphs/BreadthFirstShortestPath.js @@ -1,54 +1,54 @@ -import Queue from '../Data-Structures/Queue/Queue' -/** - * Breadth-first approach can be applied to determine the shortest path between two nodes in an equi-weighted graph. - * - * It searches the target node among all neighbors of the starting node, then the process is repeated on the level of - * the neighbors of the neighbors and so on. - * - * @see https://en.wikipedia.org/wiki/Breadth-first_search - * @see https://www.koderdojo.com/blog/breadth-first-search-and-shortest-path-in-csharp-and-net-core - */ -export function breadthFirstShortestPath (graph, startNode, targetNode) { - // check if startNode & targetNode are identical - if (startNode === targetNode) { - return [startNode] - } - - // visited keeps track of all nodes visited - const visited = new Set() - - // queue contains the paths to be explored in the future - const initialPath = [startNode] - const queue = new Queue() - queue.enqueue(initialPath) - - while (!queue.isEmpty()) { - // start with the queue's first path - const path = queue.dequeue() - const node = path[path.length - 1] - - // explore this node if it hasn't been visited yet - if (!visited.has(node)) { - // mark the node as visited - visited.add(node) - - const neighbors = graph[node] - - // create a new path in the queue for each neighbor - for (let i = 0; i < neighbors.length; i++) { - const newPath = path.concat([neighbors[i]]) - - // the first path to contain the target node is the shortest path - if (neighbors[i] === targetNode) { - return newPath - } - - // queue the new path - queue.enqueue(newPath) - } - } - } - - // the target node was not reachable - return [] -} +import Queue from '../Data-Structures/Queue/Queue' +/** + * Breadth-first approach can be applied to determine the shortest path between two nodes in an equi-weighted graph. + * + * It searches the target node among all neighbors of the starting node, then the process is repeated on the level of + * the neighbors of the neighbors and so on. + * + * @see https://en.wikipedia.org/wiki/Breadth-first_search + * @see https://www.koderdojo.com/blog/breadth-first-search-and-shortest-path-in-csharp-and-net-core + */ +export function breadthFirstShortestPath(graph, startNode, targetNode) { + // check if startNode & targetNode are identical + if (startNode === targetNode) { + return [startNode] + } + + // visited keeps track of all nodes visited + const visited = new Set() + + // queue contains the paths to be explored in the future + const initialPath = [startNode] + const queue = new Queue() + queue.enqueue(initialPath) + + while (!queue.isEmpty()) { + // start with the queue's first path + const path = queue.dequeue() + const node = path[path.length - 1] + + // explore this node if it hasn't been visited yet + if (!visited.has(node)) { + // mark the node as visited + visited.add(node) + + const neighbors = graph[node] + + // create a new path in the queue for each neighbor + for (let i = 0; i < neighbors.length; i++) { + const newPath = path.concat([neighbors[i]]) + + // the first path to contain the target node is the shortest path + if (neighbors[i] === targetNode) { + return newPath + } + + // queue the new path + queue.enqueue(newPath) + } + } + } + + // the target node was not reachable + return [] +} diff --git a/Graphs/ConnectedComponents.js b/Graphs/ConnectedComponents.js index 1fb74068e7..2605a3f280 100644 --- a/Graphs/ConnectedComponents.js +++ b/Graphs/ConnectedComponents.js @@ -1,23 +1,27 @@ class GraphUnweightedUndirectedAdjacencyList { // Unweighted Undirected Graph class - constructor () { + constructor() { this.connections = {} } - addNode (node) { + addNode(node) { // Function to add a node to the graph (connection represented by set) this.connections[node] = new Set() } - addEdge (node1, node2) { + addEdge(node1, node2) { // Function to add an edge (adds the node too if they are not present in the graph) - if (!(node1 in this.connections)) { this.addNode(node1) } - if (!(node2 in this.connections)) { this.addNode(node2) } + if (!(node1 in this.connections)) { + this.addNode(node1) + } + if (!(node2 in this.connections)) { + this.addNode(node2) + } this.connections[node1].add(node2) this.connections[node2].add(node1) } - DFSComponent (components, node, visited) { + DFSComponent(components, node, visited) { // Helper function to populate the visited set with the nodes in each component // adding the first visited node in the component to the array @@ -28,18 +32,22 @@ class GraphUnweightedUndirectedAdjacencyList { const curr = stack.pop() visited.add(curr.toString()) for (const neighbour of this.connections[curr].keys()) { - if (!visited.has(neighbour.toString())) { stack.push(neighbour) } + if (!visited.has(neighbour.toString())) { + stack.push(neighbour) + } } } } - connectedComponents () { + connectedComponents() { // Function to generate the Connected Components // Result is an array containing 1 node from each component const visited = new Set() const components = [] for (const node of Object.keys(this.connections)) { - if (!visited.has(node.toString())) { this.DFSComponent(components, node, visited) } + if (!visited.has(node.toString())) { + this.DFSComponent(components, node, visited) + } } return components } diff --git a/Graphs/Density.js b/Graphs/Density.js index 6659287c71..b37c95f77c 100644 --- a/Graphs/Density.js +++ b/Graphs/Density.js @@ -3,7 +3,7 @@ The density of a network is a measure of how many edges exist proportional to how many edges would exist in a complete network (where all possible edges). https://networkx.org/documentation/networkx-1.9/reference/generated/networkx.classes.function.density.html */ -function density (numberOfNodes, numberOfEdges, isDirected = false) { +function density(numberOfNodes, numberOfEdges, isDirected = false) { const multi = isDirected ? 1 : 2 return (multi * numberOfEdges) / (numberOfNodes * (numberOfNodes - 1)) } diff --git a/Graphs/DepthFirstSearchIterative.js b/Graphs/DepthFirstSearchIterative.js index cf2db373d0..a033c0bcad 100644 --- a/Graphs/DepthFirstSearchIterative.js +++ b/Graphs/DepthFirstSearchIterative.js @@ -1,30 +1,36 @@ class GraphUnweightedUndirected { // Unweighted Undirected Graph class - constructor () { + constructor() { this.connections = {} } - addNode (node) { + addNode(node) { // Function to add a node to the graph (connection represented by set) this.connections[node] = new Set() } - addEdge (node1, node2) { + addEdge(node1, node2) { // Function to add an edge (adds the node too if they are not present in the graph) - if (!(node1 in this.connections)) { this.addNode(node1) } - if (!(node2 in this.connections)) { this.addNode(node2) } + if (!(node1 in this.connections)) { + this.addNode(node1) + } + if (!(node2 in this.connections)) { + this.addNode(node2) + } this.connections[node1].add(node2) this.connections[node2].add(node1) } - DFSIterative (node, value) { + DFSIterative(node, value) { // DFS Function to search if a node with the given value is present in the graph const stack = [node] const visited = new Set() while (stack.length > 0) { const currNode = stack.pop() // if the current node contains the value being searched for, true is returned - if (currNode === value) { return true } + if (currNode === value) { + return true + } // adding the current node to the visited set visited.add(currNode) // adding neighbours in the stack diff --git a/Graphs/DepthFirstSearchRecursive.js b/Graphs/DepthFirstSearchRecursive.js index b0a1850113..b7916b7ed5 100644 --- a/Graphs/DepthFirstSearchRecursive.js +++ b/Graphs/DepthFirstSearchRecursive.js @@ -1,32 +1,40 @@ class GraphUnweightedUndirected { // Unweighted Undirected Graph class - constructor () { + constructor() { this.connections = {} } - addNode (node) { + addNode(node) { // Function to add a node to the graph (connection represented by set) this.connections[node] = new Set() } - addEdge (node1, node2) { + addEdge(node1, node2) { // Function to add an edge (adds the node too if they are not present in the graph) - if (!(node1 in this.connections)) { this.addNode(node1) } - if (!(node2 in this.connections)) { this.addNode(node2) } + if (!(node1 in this.connections)) { + this.addNode(node1) + } + if (!(node2 in this.connections)) { + this.addNode(node2) + } this.connections[node1].add(node2) this.connections[node2].add(node1) } - DFSRecursive (node, value, visited = new Set()) { + DFSRecursive(node, value, visited = new Set()) { // DFS Function to search if a node with the given value is present in the graph // checking if the searching node has been found - if (node === value) { return true } + if (node === value) { + return true + } // adding the current node to the visited set visited.add(node) // calling the helper function recursively for all unvisited nodes for (const neighbour of this.connections[node]) { if (!visited.has(neighbour)) { - if (this.DFSRecursive(neighbour, value, visited)) { return true } + if (this.DFSRecursive(neighbour, value, visited)) { + return true + } } } return false diff --git a/Graphs/Dijkstra.js b/Graphs/Dijkstra.js index 5271c6f70d..a836df0ff1 100644 --- a/Graphs/Dijkstra.js +++ b/Graphs/Dijkstra.js @@ -6,7 +6,7 @@ * It uses graph data structure. */ -function createGraph (V, E) { +function createGraph(V, E) { // V - Number of vertices in graph // E - Number of edges in graph (u,v,w) const adjList = [] // Adjacency list @@ -20,7 +20,7 @@ function createGraph (V, E) { return adjList } -function djikstra (graph, V, src) { +function djikstra(graph, V, src) { const vis = Array(V).fill(0) const dist = [] for (let i = 0; i < V; i++) dist.push([10000, -1]) diff --git a/Graphs/DijkstraSmallestPath.js b/Graphs/DijkstraSmallestPath.js index 10ada1f236..9765f1c679 100644 --- a/Graphs/DijkstraSmallestPath.js +++ b/Graphs/DijkstraSmallestPath.js @@ -1,5 +1,5 @@ // starting at s -function solve (graph, s) { +function solve(graph, s) { const solutions = {} solutions[s] = [] solutions[s].dist = 0 @@ -10,12 +10,16 @@ function solve (graph, s) { let dist = Infinity for (const n in solutions) { - if (!solutions[n]) { continue } + if (!solutions[n]) { + continue + } const ndist = solutions[n].dist const adj = graph[n] for (const a in adj) { - if (solutions[a]) { continue } + if (solutions[a]) { + continue + } const d = adj[a] + ndist if (d < dist) { diff --git a/Graphs/Kosaraju.js b/Graphs/Kosaraju.js index a0b4266b0c..2f22a300b2 100644 --- a/Graphs/Kosaraju.js +++ b/Graphs/Kosaraju.js @@ -9,7 +9,7 @@ */ class Kosaraju { - constructor (graph) { + constructor(graph) { this.connections = {} this.reverseConnections = {} this.stronglyConnectedComponents = [] @@ -20,14 +20,14 @@ class Kosaraju { return this.kosaraju() } - addNode (node) { + addNode(node) { // Function to add a node to the graph (connection represented by set) this.connections[node] = new Set() this.reverseConnections[node] = new Set() this.topoSorted = [] } - addEdge (node1, node2) { + addEdge(node1, node2) { // Function to add an edge (adds the node too if they are not present in the graph) if (!(node1 in this.connections) || !(node1 in this.reverseConnections)) { this.addNode(node1) @@ -39,7 +39,7 @@ class Kosaraju { this.reverseConnections[node2].add(node1) } - dfsTopoSort (node, visited) { + dfsTopoSort(node, visited) { visited.add(node) for (const child of this.connections[node]) { if (!visited.has(child)) this.dfsTopoSort(child, visited) @@ -47,7 +47,7 @@ class Kosaraju { this.topoSorted.push(node) } - topoSort () { + topoSort() { // Function to perform topological sorting const visited = new Set() const nodes = Object.keys(this.connections).map((key) => Number(key)) @@ -56,7 +56,7 @@ class Kosaraju { } } - dfsKosaraju (node, visited) { + dfsKosaraju(node, visited) { visited.add(node) this.stronglyConnectedComponents[ this.stronglyConnectedComponents.length - 1 @@ -66,7 +66,7 @@ class Kosaraju { } } - kosaraju () { + kosaraju() { // Function to perform Kosaraju Algorithm const visited = new Set() while (this.topoSorted.length > 0) { @@ -80,7 +80,7 @@ class Kosaraju { } } -function kosaraju (graph) { +function kosaraju(graph) { const stronglyConnectedComponents = new Kosaraju(graph) return stronglyConnectedComponents } diff --git a/Graphs/KruskalMST.js b/Graphs/KruskalMST.js index 7fe55d460c..c2f749c68d 100644 --- a/Graphs/KruskalMST.js +++ b/Graphs/KruskalMST.js @@ -1,6 +1,6 @@ class DisjointSetTreeNode { // Disjoint Set Node to store the parent and rank - constructor (key) { + constructor(key) { this.key = key this.parent = this this.rank = 0 @@ -9,17 +9,17 @@ class DisjointSetTreeNode { class DisjointSetTree { // Disjoint Set DataStructure - constructor () { + constructor() { // map to from node name to the node object this.map = {} } - makeSet (x) { + makeSet(x) { // Function to create a new set with x as its member this.map[x] = new DisjointSetTreeNode(x) } - findSet (x) { + findSet(x) { // Function to find the set x belongs to (with path-compression) if (this.map[x] !== this.map[x].parent) { this.map[x].parent = this.findSet(this.map[x].parent.key) @@ -27,12 +27,12 @@ class DisjointSetTree { return this.map[x].parent } - union (x, y) { + union(x, y) { // Function to merge 2 disjoint sets this.link(this.findSet(x), this.findSet(y)) } - link (x, y) { + link(x, y) { // Helper function for union operation if (x.rank > y.rank) { y.parent = x @@ -47,26 +47,30 @@ class DisjointSetTree { class GraphWeightedUndirectedAdjacencyList { // Weighted Undirected Graph class - constructor () { + constructor() { this.connections = {} this.nodes = 0 } - addNode (node) { + addNode(node) { // Function to add a node to the graph (connection represented by set) this.connections[node] = {} this.nodes += 1 } - addEdge (node1, node2, weight) { + addEdge(node1, node2, weight) { // Function to add an edge (adds the node too if they are not present in the graph) - if (!(node1 in this.connections)) { this.addNode(node1) } - if (!(node2 in this.connections)) { this.addNode(node2) } + if (!(node1 in this.connections)) { + this.addNode(node1) + } + if (!(node2 in this.connections)) { + this.addNode(node2) + } this.connections[node1][node2] = weight this.connections[node2][node1] = weight } - KruskalMST () { + KruskalMST() { // Kruskal's Algorithm to generate a Minimum Spanning Tree (MST) of a graph // Details: https://en.wikipedia.org/wiki/Kruskal%27s_algorithm // getting the edges in ascending order of weights @@ -83,7 +87,7 @@ class GraphWeightedUndirectedAdjacencyList { edges.sort((a, b) => a[2] - b[2]) // creating the disjoint set const disjointSet = new DisjointSetTree() - Object.keys(this.connections).forEach(node => disjointSet.makeSet(node)) + Object.keys(this.connections).forEach((node) => disjointSet.makeSet(node)) // MST generation const graph = new GraphWeightedUndirectedAdjacencyList() let numEdges = 0 diff --git a/Graphs/LCABinaryLifting.js b/Graphs/LCABinaryLifting.js index 7855b552cf..507f4a31b1 100644 --- a/Graphs/LCABinaryLifting.js +++ b/Graphs/LCABinaryLifting.js @@ -9,14 +9,14 @@ import { BinaryLifting } from './BinaryLifting' class LCABinaryLifting extends BinaryLifting { - constructor (root, tree) { + constructor(root, tree) { super(root, tree) this.depth = new Map() // depth[node] stores the depth of node from root this.depth.set(root, 1) this.dfsDepth(root, root) } - dfsDepth (node, parent) { + dfsDepth(node, parent) { // DFS to find depth of every node in the tree for (const child of this.connections.get(node)) { if (child !== parent) { @@ -26,10 +26,10 @@ class LCABinaryLifting extends BinaryLifting { } } - getLCA (node1, node2) { + getLCA(node1, node2) { // We make sure that node1 is the deeper node among node1 and node2 if (this.depth.get(node1) < this.depth.get(node2)) { - [node1, node2] = [node2, node1] + ;[node1, node2] = [node2, node1] } // We check if node1 is the ancestor of node2, and if so, then return node1 const k = this.depth.get(node1) - this.depth.get(node2) @@ -48,7 +48,7 @@ class LCABinaryLifting extends BinaryLifting { } } -function lcaBinaryLifting (root, tree, queries) { +function lcaBinaryLifting(root, tree, queries) { const graphObject = new LCABinaryLifting(root, tree) const lowestCommonAncestors = [] for (const [node1, node2] of queries) { diff --git a/Graphs/NodeNeighbors.js b/Graphs/NodeNeighbors.js index 65f125b18b..312f20101f 100644 --- a/Graphs/NodeNeighbors.js +++ b/Graphs/NodeNeighbors.js @@ -2,11 +2,11 @@ class Graph { // Generic graph: the algorithm works regardless of direction or weight - constructor () { + constructor() { this.edges = [] } - addEdge (node1, node2) { + addEdge(node1, node2) { // Adding edges to the graph this.edges.push({ node1, @@ -14,15 +14,15 @@ class Graph { }) } - nodeNeighbors (node) { + nodeNeighbors(node) { // Returns an array with all of the node neighbors const neighbors = new Set() for (const edge of this.edges) { // Checks if they have an edge between them and if the neighbor is not // already in the neighbors array - if (edge.node1 === node && !(neighbors.has(edge.node2))) { + if (edge.node1 === node && !neighbors.has(edge.node2)) { neighbors.add(edge.node2) - } else if (edge.node2 === node && !(neighbors.has(edge.node1))) { + } else if (edge.node2 === node && !neighbors.has(edge.node1)) { neighbors.add(edge.node1) } } diff --git a/Graphs/PrimMST.js b/Graphs/PrimMST.js index c658845874..ea19cadb35 100644 --- a/Graphs/PrimMST.js +++ b/Graphs/PrimMST.js @@ -1,24 +1,28 @@ import { KeyPriorityQueue } from '../Data-Structures/Heap/KeyPriorityQueue' class GraphWeightedUndirectedAdjacencyList { // Weighted Undirected Graph class - constructor () { + constructor() { this.connections = {} } - addNode (node) { + addNode(node) { // Function to add a node to the graph (connection represented by set) this.connections[node] = {} } - addEdge (node1, node2, weight) { + addEdge(node1, node2, weight) { // Function to add an edge (adds the node too if they are not present in the graph) - if (!(node1 in this.connections)) { this.addNode(node1) } - if (!(node2 in this.connections)) { this.addNode(node2) } + if (!(node1 in this.connections)) { + this.addNode(node1) + } + if (!(node2 in this.connections)) { + this.addNode(node2) + } this.connections[node1][node2] = weight this.connections[node2][node1] = weight } - PrimMST (start) { + PrimMST(start) { // Prim's Algorithm to generate a Minimum Spanning Tree (MST) of a graph // Details: https://en.wikipedia.org/wiki/Prim%27s_algorithm const distance = {} @@ -26,16 +30,21 @@ class GraphWeightedUndirectedAdjacencyList { const priorityQueue = new KeyPriorityQueue() // Initialization for (const node in this.connections) { - distance[node] = (node === start.toString() ? 0 : Infinity) + distance[node] = node === start.toString() ? 0 : Infinity parent[node] = null priorityQueue.push(node, distance[node]) } // Updating 'distance' object while (!priorityQueue.isEmpty()) { const node = priorityQueue.pop() - Object.keys(this.connections[node]).forEach(neighbour => { - if (priorityQueue.contains(neighbour) && distance[node] + this.connections[node][neighbour] < distance[neighbour]) { - distance[neighbour] = distance[node] + this.connections[node][neighbour] + Object.keys(this.connections[node]).forEach((neighbour) => { + if ( + priorityQueue.contains(neighbour) && + distance[node] + this.connections[node][neighbour] < + distance[neighbour] + ) { + distance[neighbour] = + distance[node] + this.connections[node][neighbour] parent[neighbour] = node priorityQueue.update(neighbour, distance[neighbour]) } @@ -44,7 +53,7 @@ class GraphWeightedUndirectedAdjacencyList { // MST Generation from the 'parent' object const graph = new GraphWeightedUndirectedAdjacencyList() - Object.keys(parent).forEach(node => { + Object.keys(parent).forEach((node) => { if (node && parent[node]) { graph.addEdge(node, parent[node], this.connections[node][parent[node]]) } diff --git a/Graphs/test/BellmanFord.test.js b/Graphs/test/BellmanFord.test.js index a5d8e2a856..c7ad375c34 100644 --- a/Graphs/test/BellmanFord.test.js +++ b/Graphs/test/BellmanFord.test.js @@ -4,10 +4,16 @@ test('Test Case 1', () => { const V = 5 const E = 8 const destination = 3 - const graph = [[0, 1, -1], [0, 2, 4], - [1, 2, 3], [1, 3, 2], - [1, 4, 2], [3, 2, 5], - [3, 1, 1], [4, 3, -3]] + const graph = [ + [0, 1, -1], + [0, 2, 4], + [1, 2, 3], + [1, 3, 2], + [1, 4, 2], + [3, 2, 5], + [3, 1, 1], + [4, 3, -3] + ] const dist = BellmanFord(graph, V, E, 0, destination) expect(dist).toBe(-2) }) @@ -15,10 +21,17 @@ test('Test Case 2', () => { const V = 6 const E = 9 const destination = 4 - const graph = [[0, 1, 3], [0, 3, 6], - [0, 5, -1], [1, 2, -3], - [1, 4, -2], [5, 2, 5], - [2, 3, 1], [4, 3, 5], [5, 4, 2]] + const graph = [ + [0, 1, 3], + [0, 3, 6], + [0, 5, -1], + [1, 2, -3], + [1, 4, -2], + [5, 2, 5], + [2, 3, 1], + [4, 3, 5], + [5, 4, 2] + ] const dist = BellmanFord(graph, V, E, 0, destination) expect(dist).toBe(1) }) @@ -26,9 +39,13 @@ test('Test Case 3', () => { const V = 4 const E = 5 const destination = 1 - const graph = [[0, 3, -1], [0, 2, 4], - [3, 2, 2], [3, 1, 5], - [2, 1, -1]] + const graph = [ + [0, 3, -1], + [0, 2, 4], + [3, 2, 2], + [3, 1, 5], + [2, 1, -1] + ] const dist = BellmanFord(graph, V, E, 0, destination) expect(dist).toBe(0) }) diff --git a/Graphs/test/BreadthFirstSearch.test.js b/Graphs/test/BreadthFirstSearch.test.js index 7d70c20084..5fc8db5cad 100644 --- a/Graphs/test/BreadthFirstSearch.test.js +++ b/Graphs/test/BreadthFirstSearch.test.js @@ -21,8 +21,19 @@ describe('BreadthFirstSearch', () => { */ it('should return the visited nodes', () => { - expect(Array.from(breadthFirstSearch(graph, 'C'))).toEqual(['C', 'D', 'A', 'B', 'E']) - expect(Array.from(breadthFirstSearch(graph, 'A'))).toEqual(['A', 'B', 'D', 'E']) + expect(Array.from(breadthFirstSearch(graph, 'C'))).toEqual([ + 'C', + 'D', + 'A', + 'B', + 'E' + ]) + expect(Array.from(breadthFirstSearch(graph, 'A'))).toEqual([ + 'A', + 'B', + 'D', + 'E' + ]) expect(Array.from(breadthFirstSearch(graph, 'F'))).toEqual(['F', 'G']) }) }) diff --git a/Graphs/test/BreadthFirstShortestPath.test.js b/Graphs/test/BreadthFirstShortestPath.test.js index 5280c7407e..007cac0d44 100644 --- a/Graphs/test/BreadthFirstShortestPath.test.js +++ b/Graphs/test/BreadthFirstShortestPath.test.js @@ -21,8 +21,19 @@ describe('BreadthFirstShortestPath', () => { */ it('should return the visited nodes', () => { - expect(breadthFirstShortestPath(graph, 'C', 'E')).toEqual(['C', 'D', 'A', 'B', 'E']) - expect(breadthFirstShortestPath(graph, 'E', 'B')).toEqual(['E', 'D', 'A', 'B']) + expect(breadthFirstShortestPath(graph, 'C', 'E')).toEqual([ + 'C', + 'D', + 'A', + 'B', + 'E' + ]) + expect(breadthFirstShortestPath(graph, 'E', 'B')).toEqual([ + 'E', + 'D', + 'A', + 'B' + ]) expect(breadthFirstShortestPath(graph, 'F', 'G')).toEqual(['F', 'G']) expect(breadthFirstShortestPath(graph, 'A', 'G')).toEqual([]) }) diff --git a/Hashes/SHA1.js b/Hashes/SHA1.js index d56de962f0..c3f7ecad2e 100644 --- a/Hashes/SHA1.js +++ b/Hashes/SHA1.js @@ -18,7 +18,7 @@ const CHAR_SIZE = 8 * @example * pad("10011", 8); // "00010011" */ -function pad (str, bits) { +function pad(str, bits) { let res = str while (res.length % bits !== 0) { res = '0' + res @@ -36,7 +36,7 @@ function pad (str, bits) { * @example * chunkify("this is a test", 2) */ -function chunkify (str, size) { +function chunkify(str, size) { const chunks = [] for (let i = 0; i < str.length; i += size) { chunks.push(str.slice(i, i + size)) @@ -54,7 +54,7 @@ function chunkify (str, size) { * @example * rotateLeft("1011", 3); // "1101" */ -function rotateLeft (bits, turns) { +function rotateLeft(bits, turns) { return bits.substr(turns) + bits.substr(0, turns) } @@ -64,14 +64,16 @@ function rotateLeft (bits, turns) { * @param {string} message - message to pre-process * @return {string} - processed message */ -function preProcess (message) { +function preProcess(message) { // convert message to binary representation padded to // 8 bits, and add 1 - let m = message.split('') - .map(e => e.charCodeAt(0)) - .map(e => e.toString(2)) - .map(e => pad(e, 8)) - .join('') + '1' + let m = + message + .split('') + .map((e) => e.charCodeAt(0)) + .map((e) => e.toString(2)) + .map((e) => pad(e, 8)) + .join('') + '1' // extend message by adding empty bits (0) while (m.length % 512 !== 448) { @@ -93,13 +95,13 @@ function preProcess (message) { * @param {string} message - message to hash * @return {string} - message digest (hash value) */ -function SHA1 (message) { +function SHA1(message) { // main variables let H0 = 0x67452301 - let H1 = 0xEFCDAB89 - let H2 = 0x98BADCFE + let H1 = 0xefcdab89 + let H2 = 0x98badcfe let H3 = 0x10325476 - let H4 = 0xC3D2E1F0 + let H4 = 0xc3d2e1f0 // pre-process message and split into 512 bit chunks const bits = preProcess(message) @@ -112,7 +114,7 @@ function SHA1 (message) { // extend 16 32-bit words to 80 32-bit words for (let i = 16; i < 80; i++) { const val = [words[i - 3], words[i - 8], words[i - 14], words[i - 16]] - .map(e => parseInt(e, 2)) + .map((e) => parseInt(e, 2)) .reduce((acc, curr) => curr ^ acc, 0) const bin = (val >>> 0).toString(2) const paddedBin = pad(bin, 32) @@ -127,16 +129,16 @@ function SHA1 (message) { let f, k if (i < 20) { f = (b & c) | (~b & d) - k = 0x5A827999 + k = 0x5a827999 } else if (i < 40) { f = b ^ c ^ d - k = 0x6ED9EBA1 + k = 0x6ed9eba1 } else if (i < 60) { f = (b & c) | (b & d) | (c & d) - k = 0x8F1BBCDC + k = 0x8f1bbcdc } else { f = b ^ c ^ d - k = 0xCA62C1D6 + k = 0xca62c1d6 } // make sure f is unsigned f >>>= 0 @@ -163,8 +165,8 @@ function SHA1 (message) { // combine hash values of main hash variables and return const HH = [H0, H1, H2, H3, H4] - .map(e => e.toString(16)) - .map(e => pad(e, 8)) + .map((e) => e.toString(16)) + .map((e) => pad(e, 8)) .join('') return HH diff --git a/Hashes/SHA256.js b/Hashes/SHA256.js index d764d31c02..d046b9966e 100644 --- a/Hashes/SHA256.js +++ b/Hashes/SHA256.js @@ -9,14 +9,17 @@ const CHAR_SIZE = 8 const K = [ - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, + 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, + 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, + 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, + 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, + 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 ] /** @@ -29,7 +32,7 @@ const K = [ * @example * pad("10011", 8); // "00010011" */ -function pad (str, bits) { +function pad(str, bits) { let res = str while (res.length % bits !== 0) { res = '0' + res @@ -47,7 +50,7 @@ function pad (str, bits) { * @example * chunkify("this is a test", 2) */ -function chunkify (str, size) { +function chunkify(str, size) { const chunks = [] for (let i = 0; i < str.length; i += size) { chunks.push(str.slice(i, i + size)) @@ -65,7 +68,7 @@ function chunkify (str, size) { * @example * rotateLeft("1011", 3); // "1101" */ -function rotateRight (bits, turns) { +function rotateRight(bits, turns) { return bits.substr(bits.length - turns) + bits.substr(0, bits.length - turns) } @@ -75,14 +78,16 @@ function rotateRight (bits, turns) { * @param {string} message - message to pre-process * @return {string} - processed message */ -function preProcess (message) { +function preProcess(message) { // convert message to binary representation padded to // 8 bits, and add 1 - let m = message.split('') - .map(e => e.charCodeAt(0)) - .map(e => e.toString(2)) - .map(e => pad(e, 8)) - .join('') + '1' + let m = + message + .split('') + .map((e) => e.charCodeAt(0)) + .map((e) => e.toString(2)) + .map((e) => pad(e, 8)) + .join('') + '1' // extend message by adding empty bits (0) while (m.length % 512 !== 448) { @@ -104,7 +109,7 @@ function preProcess (message) { * @param {string} message - message to hash * @return {string} - message digest (hash value) */ -function SHA256 (message) { +function SHA256(message) { // initial hash variables let H0 = 0x6a09e667 let H1 = 0xbb67ae85 @@ -133,7 +138,8 @@ function SHA256 (message) { const R4 = rotateRight(W2, 19) const S0 = parseInt(R1, 2) ^ parseInt(R2, 2) ^ (parseInt(W1, 2) >>> 3) const S1 = parseInt(R3, 2) ^ parseInt(R4, 2) ^ (parseInt(W2, 2) >>> 10) - const val = parseInt(words[i - 16], 2) + S0 + parseInt(words[i - 7], 2) + S1 + const val = + parseInt(words[i - 16], 2) + S0 + parseInt(words[i - 7], 2) + S1 words[i] = pad((val >>> 0).toString(2), 32) } @@ -141,16 +147,18 @@ function SHA256 (message) { let [a, b, c, d, e, f, g, h] = [H0, H1, H2, H3, H4, H5, H6, H7] for (let i = 0; i < 64; i++) { - const S1 = [6, 11, 25] - .map(turns => rotateRight(pad(e.toString(2), 32), turns)) - .map(bitstring => parseInt(bitstring, 2)) - .reduce((acc, curr) => acc ^ curr, 0) >>> 0 + const S1 = + [6, 11, 25] + .map((turns) => rotateRight(pad(e.toString(2), 32), turns)) + .map((bitstring) => parseInt(bitstring, 2)) + .reduce((acc, curr) => acc ^ curr, 0) >>> 0 const CH = ((e & f) ^ (~e & g)) >>> 0 const temp1 = (h + S1 + CH + K[i] + parseInt(words[i], 2)) >>> 0 - const S0 = [2, 13, 22] - .map(turns => rotateRight(pad(a.toString(2), 32), turns)) - .map(bitstring => parseInt(bitstring, 2)) - .reduce((acc, curr) => acc ^ curr, 0) >>> 0 + const S0 = + [2, 13, 22] + .map((turns) => rotateRight(pad(a.toString(2), 32), turns)) + .map((bitstring) => parseInt(bitstring, 2)) + .reduce((acc, curr) => acc ^ curr, 0) >>> 0 const maj = ((a & b) ^ (a & c) ^ (b & c)) >>> 0 const temp2 = (S0 + maj) >>> 0 @@ -177,8 +185,8 @@ function SHA256 (message) { // combine hash values of main hash variables and return const HH = [H0, H1, H2, H3, H4, H5, H6, H7] - .map(e => e.toString(16)) - .map(e => pad(e, 8)) + .map((e) => e.toString(16)) + .map((e) => pad(e, 8)) .join('') return HH diff --git a/Maths/AliquotSum.js b/Maths/AliquotSum.js index 5f61d87c55..92b47502e2 100644 --- a/Maths/AliquotSum.js +++ b/Maths/AliquotSum.js @@ -11,18 +11,19 @@ /** * @param {Number} input The number whose aliquot sum you want to calculate */ -function aliquotSum (input) { +function aliquotSum(input) { // input can't be negative if (input < 0) throw new TypeError('Input cannot be Negative') // input can't be a decimal - if (Math.floor(input) !== input) throw new TypeError('Input cannot be a Decimal') + if (Math.floor(input) !== input) + throw new TypeError('Input cannot be a Decimal') // Dealing with 1, which isn't a prime if (input === 1) return 0 let sum = 0 - for (let i = 1; i <= (input / 2); i++) { + for (let i = 1; i <= input / 2; i++) { if (input % i === 0) sum += i } diff --git a/Maths/ArithmeticGeometricMean.js b/Maths/ArithmeticGeometricMean.js index 100d094ef6..5e989eca67 100644 --- a/Maths/ArithmeticGeometricMean.js +++ b/Maths/ArithmeticGeometricMean.js @@ -13,7 +13,7 @@ export const agm = (a, g) => { if (a === g) return a // avoid rounding errors, and increase efficiency let x // temp var do { - [a, g, x] = [(a + g) / 2, Math.sqrt(a * g), a] + ;[a, g, x] = [(a + g) / 2, Math.sqrt(a * g), a] } while (a !== x && !isNaN(a)) /* `x !== a` ensures the return value has full precision, diff --git a/Maths/BinaryExponentiationRecursive.js b/Maths/BinaryExponentiationRecursive.js index a28ee38f1b..a030e5ba9a 100644 --- a/Maths/BinaryExponentiationRecursive.js +++ b/Maths/BinaryExponentiationRecursive.js @@ -1,20 +1,20 @@ -/* - Modified from: - https://github.com/TheAlgorithms/Python/blob/master/maths/binary_exponentiation.py - - Explanation: - https://en.wikipedia.org/wiki/Exponentiation_by_squaring -*/ - -export const binaryExponentiation = (a, n) => { - // input: a: int, n: int - // returns: a^n: int - if (n === 0) { - return 1 - } else if (n % 2 === 1) { - return binaryExponentiation(a, n - 1) * a - } else { - const b = binaryExponentiation(a, n / 2) - return b * b - } -} +/* + Modified from: + https://github.com/TheAlgorithms/Python/blob/master/maths/binary_exponentiation.py + + Explanation: + https://en.wikipedia.org/wiki/Exponentiation_by_squaring +*/ + +export const binaryExponentiation = (a, n) => { + // input: a: int, n: int + // returns: a^n: int + if (n === 0) { + return 1 + } else if (n % 2 === 1) { + return binaryExponentiation(a, n - 1) * a + } else { + const b = binaryExponentiation(a, n / 2) + return b * b + } +} diff --git a/Maths/BinomialCoefficient.js b/Maths/BinomialCoefficient.js index ff12a38ab5..65c52dd15d 100644 --- a/Maths/BinomialCoefficient.js +++ b/Maths/BinomialCoefficient.js @@ -17,7 +17,7 @@ import { calcFactorial } from './Factorial' export const findBinomialCoefficient = (n, k) => { - if ((typeof n !== 'number') || (typeof k !== 'number')) { + if (typeof n !== 'number' || typeof k !== 'number') { throw Error('Type of arguments must be number.') } if (n < 0 || k < 0) { diff --git a/Maths/BisectionMethod.js b/Maths/BisectionMethod.js index 79254ddc87..49b8c8ecc0 100644 --- a/Maths/BisectionMethod.js +++ b/Maths/BisectionMethod.js @@ -18,19 +18,26 @@ const findRoot = (a, b, func, numberOfIterations) => { const res = f(x) return !Number.isNaN(res) } - if (!belongsToDomain(a, func) || !belongsToDomain(b, func)) throw Error("Given interval is not a valid subset of function's domain") + if (!belongsToDomain(a, func) || !belongsToDomain(b, func)) + throw Error("Given interval is not a valid subset of function's domain") // Bolzano theorem const hasRoot = (a, b, func) => { return func(a) * func(b) < 0 } - if (hasRoot(a, b, func) === false) { throw Error('Product f(a)*f(b) has to be negative so that Bolzano theorem is applied') } + if (hasRoot(a, b, func) === false) { + throw Error( + 'Product f(a)*f(b) has to be negative so that Bolzano theorem is applied' + ) + } // Declare m const m = (a + b) / 2 // Recursion terminal condition - if (numberOfIterations === 0) { return m } + if (numberOfIterations === 0) { + return m + } // Find the products of f(m) and f(a), f(b) const fm = func(m) @@ -39,7 +46,8 @@ const findRoot = (a, b, func, numberOfIterations) => { // Depending on the sign of the products above, decide which position will m fill (a's or b's) if (prod1 > 0 && prod2 < 0) return findRoot(m, b, func, --numberOfIterations) - else if (prod1 < 0 && prod2 > 0) return findRoot(a, m, func, --numberOfIterations) + else if (prod1 < 0 && prod2 > 0) + return findRoot(a, m, func, --numberOfIterations) else throw Error('Unexpected behavior') } diff --git a/Maths/CircularArc.js b/Maths/CircularArc.js index 27d690bcf4..b1d819323c 100644 --- a/Maths/CircularArc.js +++ b/Maths/CircularArc.js @@ -1,31 +1,28 @@ import { degreeToRadian } from './DegreeToRadian.js' /** - * @function circularArcLength - * @description calculate the length of a circular arc - * @param {Integer} radius - * @param {Integer} degrees - * @returns {Integer} radius * angle_in_radians - * @see https://en.wikipedia.org/wiki/Circular_arc - * @example circularArcLength(3, 45) = 2.356194490192345 - */ -function circularArcLength (radius, degrees) { + * @function circularArcLength + * @description calculate the length of a circular arc + * @param {Integer} radius + * @param {Integer} degrees + * @returns {Integer} radius * angle_in_radians + * @see https://en.wikipedia.org/wiki/Circular_arc + * @example circularArcLength(3, 45) = 2.356194490192345 + */ +function circularArcLength(radius, degrees) { return radius * degreeToRadian(degrees) } /** - * @function circularArcArea - * @description calculate the area of the sector formed by an arc - * @param {Integer} radius - * @param {Integer} degrees - * @returns {Integer} 0.5 * r * r * angle_in_radians - * @see https://en.wikipedia.org/wiki/Circular_arc - * @example circularArcArea(3,45) = 3.5342917352885173 - */ -function circularArcArea (radius, degrees) { - return Math.pow(radius, 2) * degreeToRadian(degrees) / 2 + * @function circularArcArea + * @description calculate the area of the sector formed by an arc + * @param {Integer} radius + * @param {Integer} degrees + * @returns {Integer} 0.5 * r * r * angle_in_radians + * @see https://en.wikipedia.org/wiki/Circular_arc + * @example circularArcArea(3,45) = 3.5342917352885173 + */ +function circularArcArea(radius, degrees) { + return (Math.pow(radius, 2) * degreeToRadian(degrees)) / 2 } -export { - circularArcLength, - circularArcArea -} +export { circularArcLength, circularArcArea } diff --git a/Maths/CoPrimeCheck.js b/Maths/CoPrimeCheck.js index d4a463a903..3d9a0a3993 100644 --- a/Maths/CoPrimeCheck.js +++ b/Maths/CoPrimeCheck.js @@ -13,9 +13,9 @@ const GetEuclidGCD = (arg1, arg2) => { let less = arg1 > arg2 ? arg2 : arg1 for (less; less >= 2; less--) { - if ((arg1 % less === 0) && (arg2 % less === 0)) return (less) + if (arg1 % less === 0 && arg2 % less === 0) return less } - return (less) + return less } // CoPrimeCheck function return the boolean in respect of the given number is co-prime or not. diff --git a/Maths/CollatzSequence.js b/Maths/CollatzSequence.js index 4a3566b216..608fc99a0d 100644 --- a/Maths/CollatzSequence.js +++ b/Maths/CollatzSequence.js @@ -12,8 +12,8 @@ * * @example collatz(1) = { result: 1, steps: [] } * @example collatz(5) = { result: 1, steps: [16, 8, 4, 2, 1] } -*/ -export function collatz (n) { + */ +export function collatz(n) { const steps = [] while (n !== 1) { diff --git a/Maths/Coordinate.js b/Maths/Coordinate.js index 9bff1b3424..b2276baa37 100644 --- a/Maths/Coordinate.js +++ b/Maths/Coordinate.js @@ -7,7 +7,7 @@ const euclideanDistance = (longitude1, latitude1, longitude2, latitude2) => { const width = longitude2 - longitude1 const height = latitude2 - latitude1 - return (Math.sqrt(width * width + height * height)) + return Math.sqrt(width * width + height * height) } const manhattanDistance = (longitude1, latitude1, longitude2, latitude2) => { diff --git a/Maths/CountNumbersDivisible.js b/Maths/CountNumbersDivisible.js index 472ed75a7c..632011f107 100644 --- a/Maths/CountNumbersDivisible.js +++ b/Maths/CountNumbersDivisible.js @@ -19,13 +19,19 @@ * @returns {number} count of total number of divisibles */ const countNumbersDivisible = (num1, num2, divider) => { - if (typeof num1 !== 'number' || typeof num2 !== 'number' || typeof divider !== 'number') { + if ( + typeof num1 !== 'number' || + typeof num2 !== 'number' || + typeof divider !== 'number' + ) { throw new Error('Invalid input, please pass only numbers') } // Valid number range is num1 < num2, otherwise throw error if (num1 > num2) { - throw new Error('Invalid number range, please provide numbers such that num1 < num2') + throw new Error( + 'Invalid number range, please provide numbers such that num1 < num2' + ) } // if divider is out of range then return 0 diff --git a/Maths/DecimalExpansion.js b/Maths/DecimalExpansion.js index 6f699ba479..4cd8303d6b 100644 --- a/Maths/DecimalExpansion.js +++ b/Maths/DecimalExpansion.js @@ -20,7 +20,7 @@ * @param {number} [base=10] * @returns {array} */ -export function decExp (a, b, base = 10, exp = [], d = {}, dlen = 0) { +export function decExp(a, b, base = 10, exp = [], d = {}, dlen = 0) { if (base < 2 || base > 10) { throw new RangeError('Unsupported base. Must be in range [2, 10]') } diff --git a/Maths/EulerMethod.js b/Maths/EulerMethod.js index f0ecc60639..619f2c8a67 100644 --- a/Maths/EulerMethod.js +++ b/Maths/EulerMethod.js @@ -1,30 +1,36 @@ -/** - * In mathematics and computational science, the Euler method (also called forward Euler method) is a first-order - * numerical procedure for solving ordinary differential equations (ODEs) with a given initial value. It is the most - * basic explicit method for numerical integration of ordinary differential equations. The method proceeds in a series - * of steps. At each step the y-value is calculated by evaluating the differential equation at the previous step, - * multiplying the result with the step-size and adding it to the last y-value: y_n+1 = y_n + stepSize * f(x_n, y_n). - * - * (description adapted from https://en.wikipedia.org/wiki/Euler_method) - * @see https://www.geeksforgeeks.org/euler-method-solving-differential-equation/ - */ -export function eulerStep (xCurrent, stepSize, yCurrent, differentialEquation) { - // calculates the next y-value based on the current value of x, y and the stepSize - return yCurrent + stepSize * differentialEquation(xCurrent, yCurrent) -} - -export function eulerFull (xStart, xEnd, stepSize, yStart, differentialEquation) { - // loops through all the steps until xEnd is reached, adds a point for each step and then returns all the points - const points = [{ x: xStart, y: yStart }] - let yCurrent = yStart - let xCurrent = xStart - - while (xCurrent < xEnd) { - // Euler method for next step - yCurrent = eulerStep(xCurrent, stepSize, yCurrent, differentialEquation) - xCurrent += stepSize - points.push({ x: xCurrent, y: yCurrent }) - } - - return points -} +/** + * In mathematics and computational science, the Euler method (also called forward Euler method) is a first-order + * numerical procedure for solving ordinary differential equations (ODEs) with a given initial value. It is the most + * basic explicit method for numerical integration of ordinary differential equations. The method proceeds in a series + * of steps. At each step the y-value is calculated by evaluating the differential equation at the previous step, + * multiplying the result with the step-size and adding it to the last y-value: y_n+1 = y_n + stepSize * f(x_n, y_n). + * + * (description adapted from https://en.wikipedia.org/wiki/Euler_method) + * @see https://www.geeksforgeeks.org/euler-method-solving-differential-equation/ + */ +export function eulerStep(xCurrent, stepSize, yCurrent, differentialEquation) { + // calculates the next y-value based on the current value of x, y and the stepSize + return yCurrent + stepSize * differentialEquation(xCurrent, yCurrent) +} + +export function eulerFull( + xStart, + xEnd, + stepSize, + yStart, + differentialEquation +) { + // loops through all the steps until xEnd is reached, adds a point for each step and then returns all the points + const points = [{ x: xStart, y: yStart }] + let yCurrent = yStart + let xCurrent = xStart + + while (xCurrent < xEnd) { + // Euler method for next step + yCurrent = eulerStep(xCurrent, stepSize, yCurrent, differentialEquation) + xCurrent += stepSize + points.push({ x: xCurrent, y: yCurrent }) + } + + return points +} diff --git a/Maths/ExponentialFunction.js b/Maths/ExponentialFunction.js index 4212693810..11da977575 100644 --- a/Maths/ExponentialFunction.js +++ b/Maths/ExponentialFunction.js @@ -6,20 +6,20 @@ * @returns exponentialFunction(2,20) = 7.3890560989301735 * @url https://en.wikipedia.org/wiki/Exponential_function */ -function exponentialFunction (power, n) { +function exponentialFunction(power, n) { let output = 0 let fac = 1 if (isNaN(power) || isNaN(n) || n < 0) { throw new TypeError('Invalid Input') } - if (n === 0) { return 1 } + if (n === 0) { + return 1 + } for (let i = 0; i < n; i++) { - output += (power ** i) / fac - fac *= (i + 1) + output += power ** i / fac + fac *= i + 1 } return output } -export { - exponentialFunction -} +export { exponentialFunction } diff --git a/Maths/ExtendedEuclideanGCD.js b/Maths/ExtendedEuclideanGCD.js index 80812351ee..82317668de 100644 --- a/Maths/ExtendedEuclideanGCD.js +++ b/Maths/ExtendedEuclideanGCD.js @@ -25,7 +25,8 @@ * @returns Array with GCD and first and second Bézout coefficients */ const extendedEuclideanGCD = (arg1, arg2) => { - if (typeof arg1 !== 'number' || typeof arg2 !== 'number') throw new TypeError('Not a Number') + if (typeof arg1 !== 'number' || typeof arg2 !== 'number') + throw new TypeError('Not a Number') if (arg1 < 1 || arg2 < 1) throw new TypeError('Must be positive numbers') // Make the order of coefficients correct, as the algorithm assumes r0 > r1 diff --git a/Maths/Factorial.js b/Maths/Factorial.js index 9b77b8d8f3..7dc6fd6d6f 100644 --- a/Maths/Factorial.js +++ b/Maths/Factorial.js @@ -14,7 +14,7 @@ 'use strict' const calcRange = (num) => { - return [...Array(num).keys()].map(i => i + 1) + return [...Array(num).keys()].map((i) => i + 1) } const calcFactorial = (num) => { @@ -25,7 +25,9 @@ const calcFactorial = (num) => { throw Error('Sorry, factorial does not exist for negative numbers.') } if (!num) { - throw Error('Sorry, factorial does not exist for null or undefined numbers.') + throw Error( + 'Sorry, factorial does not exist for null or undefined numbers.' + ) } if (num > 0) { const range = calcRange(num) diff --git a/Maths/FareyApproximation.js b/Maths/FareyApproximation.js index 2c698e2ff2..3667879d42 100644 --- a/Maths/FareyApproximation.js +++ b/Maths/FareyApproximation.js @@ -1,41 +1,46 @@ /* -* Reference: https://en.wikipedia.org/wiki/Farey_sequence -* Inspiration: https://www.youtube.com/watch?v=7LKy3lrkTRA -* -* Farey Approximation algorithm is an algorithm to -* approximate a reduced fraction value for a certain -* decimal number x where 0 < x < 1. -* -* The algorithm works by keeping two fractional upper and -* lower bounds which start at 0 / 1 and 1 / 1. These values -* are then used to find the "mediate" which is a value between -* the two fractions. -* -* For any two fractions a / b and c / d, -* mediate = a + c / b + d -* -* Then it is checked if the decimal is greater than or less -* than the mediate and then the lower or the upper value is -* set to be the mediate respectively. -* -* This is repeated for n times and then the mediate is -* returned. -* -* This is explained in a greater detail in the "Inspiration" -* link. -*/ + * Reference: https://en.wikipedia.org/wiki/Farey_sequence + * Inspiration: https://www.youtube.com/watch?v=7LKy3lrkTRA + * + * Farey Approximation algorithm is an algorithm to + * approximate a reduced fraction value for a certain + * decimal number x where 0 < x < 1. + * + * The algorithm works by keeping two fractional upper and + * lower bounds which start at 0 / 1 and 1 / 1. These values + * are then used to find the "mediate" which is a value between + * the two fractions. + * + * For any two fractions a / b and c / d, + * mediate = a + c / b + d + * + * Then it is checked if the decimal is greater than or less + * than the mediate and then the lower or the upper value is + * set to be the mediate respectively. + * + * This is repeated for n times and then the mediate is + * returned. + * + * This is explained in a greater detail in the "Inspiration" + * link. + */ -function fareyApproximation (decimal, repeat = 20) { - let a = 0; let b = 1; let c = 1; let d = 1; let numerator; let denominator +function fareyApproximation(decimal, repeat = 20) { + let a = 0 + let b = 1 + let c = 1 + let d = 1 + let numerator + let denominator for (let i = 0; i < repeat; i++) { numerator = a + c denominator = b + d if (decimal > numerator / denominator) { - [a, b] = [numerator, denominator] + ;[a, b] = [numerator, denominator] } else { - [c, d] = [numerator, denominator] + ;[c, d] = [numerator, denominator] } } diff --git a/Maths/Fibonacci.js b/Maths/Fibonacci.js index 998c753027..2b6881cc3b 100644 --- a/Maths/Fibonacci.js +++ b/Maths/Fibonacci.js @@ -16,13 +16,13 @@ const FibonacciIterative = (num) => { return sequence } -const FibonacciGenerator = function * (neg) { +const FibonacciGenerator = function* (neg) { let a = 0 let b = 1 yield a while (true) { - yield b; - [a, b] = neg ? [b, a - b] : [b, a + b] + yield b + ;[a, b] = neg ? [b, a - b] : [b, a + b] } } @@ -55,9 +55,11 @@ const FibonacciRecursiveDP = (stairs) => { if (stairs <= 1) return stairs // Memoize stair count - if (dict.has(stairs)) return (isNeg ? (-1) ** (stairs + 1) : 1) * dict.get(stairs) + if (dict.has(stairs)) + return (isNeg ? (-1) ** (stairs + 1) : 1) * dict.get(stairs) - const res = FibonacciRecursiveDP(stairs - 1) + FibonacciRecursiveDP(stairs - 2) + const res = + FibonacciRecursiveDP(stairs - 1) + FibonacciRecursiveDP(stairs - 2) dict.set(stairs, res) @@ -82,9 +84,7 @@ const FibonacciDpWithoutRecursion = (num) => { table.push(1) table.push(isNeg ? -1 : 1) for (let i = 2; i < num; ++i) { - table.push( - isNeg ? table[i - 1] - table[i] : table[i] + table[i - 1] - ) + table.push(isNeg ? table[i - 1] - table[i] : table[i] + table[i - 1]) } return table } @@ -92,7 +92,7 @@ const FibonacciDpWithoutRecursion = (num) => { // Using Matrix exponentiation to find n-th fibonacci in O(log n) time const copyMatrix = (A) => { - return A.map(row => row.map(cell => cell)) + return A.map((row) => row.map((cell) => cell)) } const Identity = (size) => { @@ -100,10 +100,14 @@ const Identity = (size) => { const ZERO = isBigInt ? 0n : 0 const ONE = isBigInt ? 1n : 1 size = Number(size) - const I = Array(size).fill(null).map(() => Array(size).fill()) - return I.map((row, rowIdx) => row.map((_col, colIdx) => { - return rowIdx === colIdx ? ONE : ZERO - })) + const I = Array(size) + .fill(null) + .map(() => Array(size).fill()) + return I.map((row, rowIdx) => + row.map((_col, colIdx) => { + return rowIdx === colIdx ? ONE : ZERO + }) + ) } // A of size (l x m) and B of size (m x n) @@ -117,7 +121,9 @@ const matrixMultiply = (A, B) => { const l = A.length const m = B.length const n = B[0].length // Assuming non-empty matrices - const C = Array(l).fill(null).map(() => Array(n).fill()) + const C = Array(l) + .fill(null) + .map(() => Array(n).fill()) for (let i = 0; i < l; i++) { for (let j = 0; j < n; j++) { C[i][j] = isBigInt ? 0n : 0 @@ -179,10 +185,7 @@ const FibonacciMatrixExpo = (num) => { ] const poweredA = matrixExpo(A, num - ONE) // A raised to the power n-1 - let F = [ - [ONE], - [ZERO] - ] + let F = [[ONE], [ZERO]] F = matrixMultiply(poweredA, F) return F[0][0] * (isNeg ? (-ONE) ** (num + ONE) : ONE) } @@ -195,7 +198,7 @@ const sqrt5 = Math.sqrt(5) const phi = (1 + sqrt5) / 2 const psi = (1 - sqrt5) / 2 -const FibonacciUsingFormula = n => Math.round((phi ** n - psi ** n) / sqrt5) +const FibonacciUsingFormula = (n) => Math.round((phi ** n - psi ** n) / sqrt5) export { FibonacciDpWithoutRecursion } export { FibonacciIterative } diff --git a/Maths/FindLcm.js b/Maths/FindLcm.js index e75a89fd76..95ae2dc7f5 100644 --- a/Maths/FindLcm.js +++ b/Maths/FindLcm.js @@ -47,7 +47,7 @@ const findLcmWithHcf = (num1, num2) => { throw Error('Numbers must be whole.') } - return num1 * num2 / findHCF(num1, num2) + return (num1 * num2) / findHCF(num1, num2) } export { findLcm, findLcmWithHcf } diff --git a/Maths/FindMaxRecursion.js b/Maths/FindMaxRecursion.js index db2325f4f5..9ef2982fed 100644 --- a/Maths/FindMaxRecursion.js +++ b/Maths/FindMaxRecursion.js @@ -1,42 +1,42 @@ -/** - * @function findMaxRecursion - * @description This algorithm will find the maximum value of a array of numbers. - * - * @param {Integer[]} arr Array of numbers - * @param {Integer} left Index of the first element - * @param {Integer} right Index of the last element - * - * @return {Integer} Maximum value of the array - * - * @see [Maximum value](https://en.wikipedia.org/wiki/Maximum_value) - * - * @example findMaxRecursion([1, 2, 4, 5]) = 5 - * @example findMaxRecursion([10, 40, 100, 20]) = 100 - * @example findMaxRecursion([-1, -2, -4, -5]) = -1 - */ -function findMaxRecursion (arr, left, right) { - const len = arr.length - - if (len === 0 || !arr) { - return undefined - } - - if (left >= len || left < -len || right >= len || right < -len) { - throw new Error('Index out of range') - } - - if (left === right) { - return arr[left] - } - - // n >> m is equivalent to floor(n / pow(2, m)), floor(n / 2) in this case, which is the mid index - const mid = (left + right) >> 1 - - const leftMax = findMaxRecursion(arr, left, mid) - const rightMax = findMaxRecursion(arr, mid + 1, right) - - // Return the maximum - return Math.max(leftMax, rightMax) -} - -export { findMaxRecursion } +/** + * @function findMaxRecursion + * @description This algorithm will find the maximum value of a array of numbers. + * + * @param {Integer[]} arr Array of numbers + * @param {Integer} left Index of the first element + * @param {Integer} right Index of the last element + * + * @return {Integer} Maximum value of the array + * + * @see [Maximum value](https://en.wikipedia.org/wiki/Maximum_value) + * + * @example findMaxRecursion([1, 2, 4, 5]) = 5 + * @example findMaxRecursion([10, 40, 100, 20]) = 100 + * @example findMaxRecursion([-1, -2, -4, -5]) = -1 + */ +function findMaxRecursion(arr, left, right) { + const len = arr.length + + if (len === 0 || !arr) { + return undefined + } + + if (left >= len || left < -len || right >= len || right < -len) { + throw new Error('Index out of range') + } + + if (left === right) { + return arr[left] + } + + // n >> m is equivalent to floor(n / pow(2, m)), floor(n / 2) in this case, which is the mid index + const mid = (left + right) >> 1 + + const leftMax = findMaxRecursion(arr, left, mid) + const rightMax = findMaxRecursion(arr, mid + 1, right) + + // Return the maximum + return Math.max(leftMax, rightMax) +} + +export { findMaxRecursion } diff --git a/Maths/FindMinIterator.js b/Maths/FindMinIterator.js index fc1c7d0073..658ac9a5cb 100644 --- a/Maths/FindMinIterator.js +++ b/Maths/FindMinIterator.js @@ -9,24 +9,32 @@ const FindMinIterator = (_iterable, _selector = undefined) => { const iterator = _iterable[Symbol.iterator]() if (!_selector) { let current = iterator.next() - if (current.done) { return undefined } + if (current.done) { + return undefined + } min = current.value current = iterator.next() while (!current.done) { const x = current.value - if (x < min) { min = x } + if (x < min) { + min = x + } current = iterator.next() } } else { let current = iterator.next() - if (current.done) { return undefined } + if (current.done) { + return undefined + } min = _selector(current.value) current = iterator.next() while (!current.done) { const x = _selector(current.value) - if (x < min) { min = x } + if (x < min) { + min = x + } current = iterator.next() } } diff --git a/Maths/FriendlyNumbers.js b/Maths/FriendlyNumbers.js index a9b6b37ec9..f7440384b4 100644 --- a/Maths/FriendlyNumbers.js +++ b/Maths/FriendlyNumbers.js @@ -10,18 +10,24 @@ export const FriendlyNumbers = (firstNumber, secondNumber) => { // output: true if the two integers are friendly numbers, false if they are not friendly numbers // First, check that the parameters are valid - if (!Number.isInteger(firstNumber) || !Number.isInteger(secondNumber) || firstNumber === 0 || secondNumber === 0 || firstNumber === secondNumber) { + if ( + !Number.isInteger(firstNumber) || + !Number.isInteger(secondNumber) || + firstNumber === 0 || + secondNumber === 0 || + firstNumber === secondNumber + ) { throw new Error('The two parameters must be distinct, non-null integers') } return abundancyIndex(firstNumber) === abundancyIndex(secondNumber) } -function abundancyIndex (number) { +function abundancyIndex(number) { return sumDivisors(number) / number } -function sumDivisors (number) { +function sumDivisors(number) { let runningSumDivisors = number for (let i = 0; i < number / 2; i++) { if (Number.isInteger(number / i)) { diff --git a/Maths/GetEuclidGCD.js b/Maths/GetEuclidGCD.js index aa77acbcc1..5499057d78 100644 --- a/Maths/GetEuclidGCD.js +++ b/Maths/GetEuclidGCD.js @@ -4,7 +4,7 @@ * @param {Number} b integer (may be negative) * @returns {Number} Greatest Common Divisor gcd(a, b) */ -export function GetEuclidGCD (a, b) { +export function GetEuclidGCD(a, b) { if (typeof a !== 'number' || typeof b !== 'number') { throw new TypeError('Arguments must be numbers') } diff --git a/Maths/IsOdd.js b/Maths/IsOdd.js index faf14e5096..f68e2a6077 100644 --- a/Maths/IsOdd.js +++ b/Maths/IsOdd.js @@ -39,7 +39,7 @@ const isOdd = (number) => Boolean(number % 2) // 1 -> true, 0 -> false * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_AND * @param {number} number * @returns {boolean} -*/ + */ const isOddBitwise = (number) => Boolean(number & 1) // 1 -> true, 0 -> false export { isOdd, isOddBitwise } diff --git a/Maths/JugglerSequence.js b/Maths/JugglerSequence.js index 96a2a35150..7c56f3b6dd 100644 --- a/Maths/JugglerSequence.js +++ b/Maths/JugglerSequence.js @@ -10,7 +10,7 @@ * jugglerSequence(15) // returns [15, 58, 7, 18, 4, 2, 1] */ -function jugglerSequence (n) { +function jugglerSequence(n) { const sequence = [] sequence.push(n) // Calculate terms until last term is not 1 diff --git a/Maths/LeapYear.js b/Maths/LeapYear.js index 4aa94024e6..fb53f12001 100644 --- a/Maths/LeapYear.js +++ b/Maths/LeapYear.js @@ -14,5 +14,5 @@ * @returns {boolean} true if this is a leap year, false otherwise. */ export const isLeapYear = (year) => { - return ((year % 400) === 0) || (((year % 100) !== 0) && ((year % 4) === 0)) + return year % 400 === 0 || (year % 100 !== 0 && year % 4 === 0) } diff --git a/Maths/LucasSeries.js b/Maths/LucasSeries.js index 11156d7210..e645872e2d 100644 --- a/Maths/LucasSeries.js +++ b/Maths/LucasSeries.js @@ -13,12 +13,13 @@ /** * @param {Number} index The position of the number you want to get from the Lucas Series */ -function lucas (index) { +function lucas(index) { // index can't be negative if (index < 0) throw new TypeError('Index cannot be Negative') // index can't be a decimal - if (Math.floor(index) !== index) throw new TypeError('Index cannot be a Decimal') + if (Math.floor(index) !== index) + throw new TypeError('Index cannot be a Decimal') let a = 2 let b = 1 diff --git a/Maths/Mandelbrot.js b/Maths/Mandelbrot.js index c724a81a1c..9b9f311c9b 100644 --- a/Maths/Mandelbrot.js +++ b/Maths/Mandelbrot.js @@ -27,14 +27,15 @@ * @param {boolean} useDistanceColorCoding Render in color or black and white. * @return {object} The RGB-data of the rendered Mandelbrot set. */ -export function getRGBData ( +export function getRGBData( imageWidth = 800, imageHeight = 600, figureCenterX = -0.6, figureCenterY = 0, figureWidth = 3.2, maxStep = 50, - useDistanceColorCoding = true) { + useDistanceColorCoding = true +) { if (imageWidth <= 0) { throw new Error('imageWidth should be greater than zero') } @@ -48,7 +49,7 @@ export function getRGBData ( } const rgbData = [] - const figureHeight = figureWidth / imageWidth * imageHeight + const figureHeight = (figureWidth / imageWidth) * imageHeight // loop through the image-coordinates for (let imageX = 0; imageX < imageWidth; imageX++) { @@ -56,15 +57,15 @@ export function getRGBData ( for (let imageY = 0; imageY < imageHeight; imageY++) { // determine the figure-coordinates based on the image-coordinates const figureX = figureCenterX + (imageX / imageWidth - 0.5) * figureWidth - const figureY = figureCenterY + (imageY / imageHeight - 0.5) * figureHeight + const figureY = + figureCenterY + (imageY / imageHeight - 0.5) * figureHeight const distance = getDistance(figureX, figureY, maxStep) // color the corresponding pixel based on the selected coloring-function - rgbData[imageX][imageY] = - useDistanceColorCoding - ? colorCodedColorMap(distance) - : blackAndWhiteColorMap(distance) + rgbData[imageX][imageY] = useDistanceColorCoding + ? colorCodedColorMap(distance) + : blackAndWhiteColorMap(distance) } } @@ -79,7 +80,7 @@ export function getRGBData ( * @param {number} distance Distance until divergence threshold * @return {object} The RGB-value corresponding to the distance. */ -function blackAndWhiteColorMap (distance) { +function blackAndWhiteColorMap(distance) { return distance >= 1 ? [0, 0, 0] : [255, 255, 255] } @@ -91,7 +92,7 @@ function blackAndWhiteColorMap (distance) { * @param {number} distance Distance until divergence threshold * @return {object} The RGB-value corresponding to the distance. */ -function colorCodedColorMap (distance) { +function colorCodedColorMap(distance) { if (distance >= 1) { return [0, 0, 0] } else { @@ -100,7 +101,7 @@ function colorCodedColorMap (distance) { const hue = 360 * distance const saturation = 1 const val = 255 - const hi = (Math.floor(hue / 60)) % 6 + const hi = Math.floor(hue / 60) % 6 const f = hue / 60 - Math.floor(hue / 60) const v = val @@ -136,7 +137,7 @@ function colorCodedColorMap (distance) { * @param {number} maxStep Maximum number of steps to check for divergent behavior. * @return {number} The relative distance as the ratio of steps taken to maxStep. */ -function getDistance (figureX, figureY, maxStep) { +function getDistance(figureX, figureY, maxStep) { let a = figureX let b = figureY let currentStep = 0 diff --git a/Maths/MatrixMultiplication.js b/Maths/MatrixMultiplication.js index bddb5b1ec4..b6626d0190 100644 --- a/Maths/MatrixMultiplication.js +++ b/Maths/MatrixMultiplication.js @@ -19,10 +19,17 @@ const matrixCheck = (matrix) => { // tests to see if the matrices have a like side, i.e. the row length on the first matrix matches the column length on the second matrix, or vice versa. const twoMatricesCheck = (first, second) => { - const [firstRowLength, secondRowLength, firstColLength, secondColLength] = [first.length, second.length, matrixCheck(first), matrixCheck(second)] + const [firstRowLength, secondRowLength, firstColLength, secondColLength] = [ + first.length, + second.length, + matrixCheck(first), + matrixCheck(second) + ] // These matrices do not have a common side - return firstRowLength === secondColLength && secondRowLength === firstColLength + return ( + firstRowLength === secondColLength && secondRowLength === firstColLength + ) } // returns an empty array that has the same number of rows as the left matrix being multiplied. diff --git a/Maths/MeanAbsoluteDeviation.js b/Maths/MeanAbsoluteDeviation.js index 14248dd482..55585592b6 100644 --- a/Maths/MeanAbsoluteDeviation.js +++ b/Maths/MeanAbsoluteDeviation.js @@ -6,7 +6,7 @@ import { mean } from './AverageMean.js' * @returns meanAbsoluteDeviation([2,34,5,0,-2]) = 10.480 * @url https://en.wikipedia.org/wiki/Average_absolute_deviation */ -function meanAbsoluteDeviation (data) { +function meanAbsoluteDeviation(data) { if (!Array.isArray(data)) { throw new TypeError('Invalid Input') } @@ -18,6 +18,4 @@ function meanAbsoluteDeviation (data) { return absoluteSum / data.length } -export { - meanAbsoluteDeviation -} +export { meanAbsoluteDeviation } diff --git a/Maths/MidpointIntegration.js b/Maths/MidpointIntegration.js index 8e3fa61eb2..08bfeba954 100644 --- a/Maths/MidpointIntegration.js +++ b/Maths/MidpointIntegration.js @@ -1,27 +1,33 @@ /** -* -* @title Midpoint rule for definite integral evaluation -* @author [ggkogkou](https://github.com/ggkogkou) -* @brief Calculate definite integrals with midpoint method -* -* @details The idea is to split the interval in a number N of intervals and use as interpolation points the xi -* for which it applies that xi = x0 + i*h, where h is a step defined as h = (b-a)/N where a and b are the -* first and last points of the interval of the integration [a, b]. -* -* We create a table of the xi and their corresponding f(xi) values and we evaluate the integral by the formula: -* I = h * {f(x0+h/2) + f(x1+h/2) + ... + f(xN-1+h/2)} -* -* N must be > 0 and a 0 and a= 2') } // check if N > 0 - if (a > b) { throw Error('a must be less or equal than b') } // Check if a < b + if (!Number.isInteger(N) || Number.isNaN(a) || Number.isNaN(b)) { + throw new TypeError('Expected integer N and finite a, b') + } + if (N <= 0) { + throw Error('N has to be >= 2') + } // check if N > 0 + if (a > b) { + throw Error('a must be less or equal than b') + } // Check if a < b if (a === b) return 0 // If a === b integral is zero // Calculate the step h @@ -45,7 +51,11 @@ function integralEvaluation (N, a, b, func) { result *= temp - if (Number.isNaN(result)) { throw Error('Result is NaN. The input interval does not belong to the functions domain') } + if (Number.isNaN(result)) { + throw Error( + 'Result is NaN. The input interval does not belong to the functions domain' + ) + } return result } diff --git a/Maths/MobiusFunction.js b/Maths/MobiusFunction.js index cde05792eb..bd268b8bbd 100644 --- a/Maths/MobiusFunction.js +++ b/Maths/MobiusFunction.js @@ -25,5 +25,9 @@ export const mobiusFunction = (number) => { if (number <= 0) { throw new Error('Number must be greater than zero.') } - return primeFactorsArray.length !== new Set(primeFactorsArray).size ? 0 : primeFactorsArray.length % 2 === 0 ? 1 : -1 + return primeFactorsArray.length !== new Set(primeFactorsArray).size + ? 0 + : primeFactorsArray.length % 2 === 0 + ? 1 + : -1 } diff --git a/Maths/ModularArithmetic.js b/Maths/ModularArithmetic.js index 26c54ebbb4..e0570d8b3c 100644 --- a/Maths/ModularArithmetic.js +++ b/Maths/ModularArithmetic.js @@ -8,7 +8,7 @@ import { extendedEuclideanGCD } from './ExtendedEuclideanGCD' */ export class ModRing { - constructor (MOD) { + constructor(MOD) { this.MOD = MOD } @@ -23,7 +23,7 @@ export class ModRing { /** * Modulus is Distributive property, * As a result, we separate it into numbers in order to keep it within MOD's range - */ + */ add = (arg1, arg2) => { this.isInputValid(arg1, arg2) diff --git a/Maths/ModularBinaryExponentiationRecursive.js b/Maths/ModularBinaryExponentiationRecursive.js index 434215c358..54665a3142 100644 --- a/Maths/ModularBinaryExponentiationRecursive.js +++ b/Maths/ModularBinaryExponentiationRecursive.js @@ -1,22 +1,22 @@ -/* - Modified from: - https://github.com/TheAlgorithms/Python/blob/master/maths/binary_exp_mod.py - - Explanation: - https://en.wikipedia.org/wiki/Exponentiation_by_squaring -*/ - -const modularBinaryExponentiation = (a, n, m) => { - // input: a: int, n: int, m: int - // returns: (a^n) % m: int - if (n === 0) { - return 1 - } else if (n % 2 === 1) { - return (modularBinaryExponentiation(a, n - 1, m) * a) % m - } else { - const b = modularBinaryExponentiation(a, n / 2, m) - return (b * b) % m - } -} - -export { modularBinaryExponentiation } +/* + Modified from: + https://github.com/TheAlgorithms/Python/blob/master/maths/binary_exp_mod.py + + Explanation: + https://en.wikipedia.org/wiki/Exponentiation_by_squaring +*/ + +const modularBinaryExponentiation = (a, n, m) => { + // input: a: int, n: int, m: int + // returns: (a^n) % m: int + if (n === 0) { + return 1 + } else if (n % 2 === 1) { + return (modularBinaryExponentiation(a, n - 1, m) * a) % m + } else { + const b = modularBinaryExponentiation(a, n / 2, m) + return (b * b) % m + } +} + +export { modularBinaryExponentiation } diff --git a/Maths/NumberOfDigits.js b/Maths/NumberOfDigits.js index f2ef656433..8a3e2b3c6a 100644 --- a/Maths/NumberOfDigits.js +++ b/Maths/NumberOfDigits.js @@ -17,6 +17,7 @@ const numberOfDigit = (n) => Math.abs(n).toString().length * @see https://math.stackexchange.com/questions/2145480/how-does-the-logarithm-returns-the-number-of-digits-of-a-number * @author dev-madhurendra */ -const numberOfDigitsUsingLog = (n) => n === 0 ? 1 : Math.floor(Math.log10(Math.abs(n))) + 1 +const numberOfDigitsUsingLog = (n) => + n === 0 ? 1 : Math.floor(Math.log10(Math.abs(n))) + 1 export { numberOfDigit, numberOfDigitsUsingLog } diff --git a/Maths/Palindrome.js b/Maths/Palindrome.js index f31e6aab15..094faf9606 100644 --- a/Maths/Palindrome.js +++ b/Maths/Palindrome.js @@ -56,6 +56,7 @@ const PalindromeIterative = (string) => { * const isPalindrome = checkPalindrome('racecar'); // Returns true * const isNotPalindrome = checkPalindrome('hello'); // Returns false */ -const checkPalindrome = (str) => str.replace(/\s/g, '') === str.replace(/\s/g, '').split('').reverse().join('') +const checkPalindrome = (str) => + str.replace(/\s/g, '') === str.replace(/\s/g, '').split('').reverse().join('') export { PalindromeIterative, PalindromeRecursive, checkPalindrome } diff --git a/Maths/ParityOutlier.js b/Maths/ParityOutlier.js index 7642541ffb..8afb427e0c 100644 --- a/Maths/ParityOutlier.js +++ b/Maths/ParityOutlier.js @@ -12,13 +12,16 @@ const parityOutlier = (integers) => { let odd, even for (const e of integers) { - if (!Number.isInteger(e)) { // detect non-integer elements + if (!Number.isInteger(e)) { + // detect non-integer elements return null } - if (e % 2 === 0) { // an even number + if (e % 2 === 0) { + // an even number even = e evensCount++ - } else { // an odd number + } else { + // an odd number odd = e oddsCount++ } diff --git a/Maths/PerfectCube.js b/Maths/PerfectCube.js index 67e119305f..202cddafa5 100644 --- a/Maths/PerfectCube.js +++ b/Maths/PerfectCube.js @@ -5,6 +5,7 @@ * This uses `round` instead of `floor` or `trunc`, to guard against potential `cbrt` accuracy errors */ -const perfectCube = (num) => Number.isFinite(num) && Math.round(Math.cbrt(num)) ** 3 === num +const perfectCube = (num) => + Number.isFinite(num) && Math.round(Math.cbrt(num)) ** 3 === num export { perfectCube } diff --git a/Maths/PerfectSquare.js b/Maths/PerfectSquare.js index 9003ec1416..4d26323939 100644 --- a/Maths/PerfectSquare.js +++ b/Maths/PerfectSquare.js @@ -5,6 +5,7 @@ * This uses `round` instead of `floor` or `trunc`, to guard against potential `sqrt` accuracy errors */ -const perfectSquare = (num) => Number.isFinite(num) && Math.round(Math.sqrt(num)) ** 2 === num +const perfectSquare = (num) => + Number.isFinite(num) && Math.round(Math.sqrt(num)) ** 2 === num export { perfectSquare } diff --git a/Maths/Polynomial.js b/Maths/Polynomial.js index 5df31fdc00..00f96761c6 100644 --- a/Maths/Polynomial.js +++ b/Maths/Polynomial.js @@ -9,7 +9,7 @@ * The members of array are coefficients and their indexes as exponents. */ class Polynomial { - constructor (array) { + constructor(array) { this.coefficientArray = array // array of coefficients this.polynomial = '' // in terms of x e.g. (2x) + (1) this.construct() @@ -18,7 +18,7 @@ class Polynomial { /** * Function to construct the polynomial in terms of x using the coefficientArray */ - construct () { + construct() { this.polynomial = this.coefficientArray .map((coefficient, exponent) => { if (coefficient === 0) { @@ -32,9 +32,7 @@ class Polynomial { return `(${coefficient}x^${exponent})` } }) - .filter((x) => - x !== '0' - ) + .filter((x) => x !== '0') .reverse() .join(' + ') } @@ -43,7 +41,7 @@ class Polynomial { * Function to display polynomial in terms of x * @returns {String} of polynomial representation in terms of x */ - display () { + display() { return this.polynomial } @@ -51,7 +49,7 @@ class Polynomial { * Function to calculate the value of the polynomial by substituting variable x * @param {Number} value */ - evaluate (value) { + evaluate(value) { return this.coefficientArray.reduce((result, coefficient, exponent) => { return result + coefficient * Math.pow(value, exponent) }, 0) diff --git a/Maths/Pow.js b/Maths/Pow.js index 44ce31e8ac..992c68a19d 100644 --- a/Maths/Pow.js +++ b/Maths/Pow.js @@ -15,7 +15,8 @@ const powLinear = (base, exponent) => { let result = 1 - while (exponent--) { // Break the execution while the exponent will 0 + while (exponent--) { + // Break the execution while the exponent will 0 result *= base } @@ -32,11 +33,13 @@ const powLinear = (base, exponent) => { * @example - powFaster(3, 3) => 27 --> 3 * 3 * 3 */ const powFaster = (base, exponent) => { - if (exponent < 2) { // explanation below - 1 + if (exponent < 2) { + // explanation below - 1 return base && ([1, base][exponent] || powFaster(1 / base, -exponent)) } - if (exponent & 1) { // if the existing exponent is odd + if (exponent & 1) { + // if the existing exponent is odd return base * powFaster(base * base, exponent >> 1) // explanation below - 2 } diff --git a/Maths/PrimeCheck.js b/Maths/PrimeCheck.js index 0922c97ab9..1d0b18ed43 100644 --- a/Maths/PrimeCheck.js +++ b/Maths/PrimeCheck.js @@ -1,25 +1,25 @@ -/* - Modified from: - https://github.com/TheAlgorithms/Python/blob/master/maths/prime_check.py - - Complexity: - O(sqrt(n)) -*/ - -const PrimeCheck = (n) => { - // input: n: int - // output: boolean - if (n === 1) return false - if (n === 0) return false - if (n === 2) return true - if (n % 2 === 0) return false - - for (let i = 3; i * i <= n; i += 2) { - if (n % i === 0) { - return false - } - } - return true -} - -export { PrimeCheck } +/* + Modified from: + https://github.com/TheAlgorithms/Python/blob/master/maths/prime_check.py + + Complexity: + O(sqrt(n)) +*/ + +const PrimeCheck = (n) => { + // input: n: int + // output: boolean + if (n === 1) return false + if (n === 0) return false + if (n === 2) return true + if (n % 2 === 0) return false + + for (let i = 3; i * i <= n; i += 2) { + if (n % i === 0) { + return false + } + } + return true +} + +export { PrimeCheck } diff --git a/Maths/PrimeFactors.js b/Maths/PrimeFactors.js index d4f3750f5e..a593826b36 100644 --- a/Maths/PrimeFactors.js +++ b/Maths/PrimeFactors.js @@ -1,20 +1,20 @@ -/* - Modified from: - https://github.com/TheAlgorithms/Python/blob/master/maths/prime_factors.py -*/ - -export const PrimeFactors = (n) => { - // input: n: int - // output: primeFactors: Array of all prime factors of n - const primeFactors = [] - for (let i = 2; i * i <= n; i++) { - while (n % i === 0) { - primeFactors.push(i) - n = Math.floor(n / i) - } - } - if (n > 1) { - primeFactors.push(n) - } - return primeFactors -} +/* + Modified from: + https://github.com/TheAlgorithms/Python/blob/master/maths/prime_factors.py +*/ + +export const PrimeFactors = (n) => { + // input: n: int + // output: primeFactors: Array of all prime factors of n + const primeFactors = [] + for (let i = 2; i * i <= n; i++) { + while (n % i === 0) { + primeFactors.push(i) + n = Math.floor(n / i) + } + } + if (n > 1) { + primeFactors.push(n) + } + return primeFactors +} diff --git a/Maths/ShorsAlgorithm.js b/Maths/ShorsAlgorithm.js index f4480749ca..302a7ac644 100644 --- a/Maths/ShorsAlgorithm.js +++ b/Maths/ShorsAlgorithm.js @@ -22,7 +22,7 @@ * are a multiple of N, either g^(p/2) + 1 or g^(p/2) - 1 must share a * factor with N, which can then be found using Euclid's GCD algorithm. */ -function ShorsAlgorithm (num) { +function ShorsAlgorithm(num) { const N = BigInt(num) while (true) { @@ -61,7 +61,7 @@ function ShorsAlgorithm (num) { * @param {BigInt} B * @returns The value p. */ -function findP (A, B) { +function findP(A, B) { let p = 1n while (!isValidP(A, B, p)) p++ return p @@ -75,7 +75,7 @@ function findP (A, B) { * @param {BigInt} p * @returns Whether A, B, and p fulfill A^p = mB + 1. */ -function isValidP (A, B, p) { +function isValidP(A, B, p) { // A^p = mB + 1 => A^p - 1 = 0 (mod B) return (A ** p - 1n) % B === 0n } @@ -87,9 +87,9 @@ function isValidP (A, B, p) { * @param {BigInt} B * @returns Greatest Common Divisor between A and B. */ -function gcd (A, B) { +function gcd(A, B) { while (B !== 0n) { - [A, B] = [B, A % B] + ;[A, B] = [B, A % B] } return Number(A) diff --git a/Maths/SieveOfEratosthenesIntArray.js b/Maths/SieveOfEratosthenesIntArray.js index 7de49ffb73..56336ce7d8 100644 --- a/Maths/SieveOfEratosthenesIntArray.js +++ b/Maths/SieveOfEratosthenesIntArray.js @@ -4,14 +4,16 @@ * @see {@link https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes} */ -function sieveOfEratosthenes (max) { +function sieveOfEratosthenes(max) { const sieve = [] const primes = [] for (let i = 2; i <= max; ++i) { - if (!sieve[i]) { // If i has not been marked then it is prime + if (!sieve[i]) { + // If i has not been marked then it is prime primes.push(i) - for (let j = i << 1; j <= max; j += i) { // Mark all multiples of i as non-prime + for (let j = i << 1; j <= max; j += i) { + // Mark all multiples of i as non-prime sieve[j] = true } } diff --git a/Maths/Signum.js b/Maths/Signum.js index 35047cac18..76f5521bff 100644 --- a/Maths/Signum.js +++ b/Maths/Signum.js @@ -14,7 +14,7 @@ * @param {Number} input * @returns {-1 | 0 | 1 | NaN} sign of input (and NaN if the input is not a number) */ -function signum (input) { +function signum(input) { if (input === 0) return 0 if (input > 0) return 1 if (input < 0) return -1 diff --git a/Maths/SimpsonIntegration.js b/Maths/SimpsonIntegration.js index 5ec41a89f3..e7082a9212 100644 --- a/Maths/SimpsonIntegration.js +++ b/Maths/SimpsonIntegration.js @@ -1,37 +1,45 @@ /* -* -* @file -* @title Composite Simpson's rule for definite integral evaluation -* @author: [ggkogkou](https://github.com/ggkogkou) -* @brief Calculate definite integrals using composite Simpson's numerical method -* -* @details The idea is to split the interval in an EVEN number N of intervals and use as interpolation points the xi -* for which it applies that xi = x0 + i*h, where h is a step defined as h = (b-a)/N where a and b are the -* first and last points of the interval of the integration [a, b]. -* -* We create a table of the xi and their corresponding f(xi) values and we evaluate the integral by the formula: -* I = h/3 * {f(x0) + 4*f(x1) + 2*f(x2) + ... + 2*f(xN-2) + 4*f(xN-1) + f(xN)} -* -* That means that the first and last indexed i f(xi) are multiplied by 1, -* the odd indexed f(xi) by 4 and the even by 2. -* -* N must be even number and a= 2') } + if (!Number.isInteger(N) || Number.isNaN(a) || Number.isNaN(b)) { + throw new TypeError('Expected integer N and finite a, b') + } + if (!isNEven) { + throw Error('N is not an even number') + } + if (N <= 0) { + throw Error('N has to be >= 2') + } // Check if a < b - if (a > b) { throw Error('a must be less or equal than b') } + if (a > b) { + throw Error('a must be less or equal than b') + } if (a === b) return 0 // Calculate the step h @@ -58,7 +66,11 @@ function integralEvaluation (N, a, b, func) { result *= temp - if (Number.isNaN(result)) { throw Error("Result is NaN. The input interval doesn't belong to the functions domain") } + if (Number.isNaN(result)) { + throw Error( + "Result is NaN. The input interval doesn't belong to the functions domain" + ) + } return result } diff --git a/Maths/Softmax.js b/Maths/Softmax.js index baeb9fad36..66363c4436 100644 --- a/Maths/Softmax.js +++ b/Maths/Softmax.js @@ -1,7 +1,7 @@ // Wikipedia: https://en.wikipedia.org/wiki/Softmax_function const Softmax = (inputs) => { - const eulerExpOfAllInputs = inputs.map(input => Math.exp(input)) + const eulerExpOfAllInputs = inputs.map((input) => Math.exp(input)) const sumOfEulerExpOfAllInputs = eulerExpOfAllInputs.reduce((a, b) => a + b) return inputs.map((input) => { diff --git a/Maths/SquareRoot.js b/Maths/SquareRoot.js index a5a7108360..0c50d9d3d7 100644 --- a/Maths/SquareRoot.js +++ b/Maths/SquareRoot.js @@ -1,14 +1,18 @@ /* -* Author: Rak Laptudirm -* -* https://en.wikipedia.org/wiki/Newton%27s_method -* -* Finding the square root of a number using Newton's method. -*/ + * Author: Rak Laptudirm + * + * https://en.wikipedia.org/wiki/Newton%27s_method + * + * Finding the square root of a number using Newton's method. + */ -function sqrt (num, precision = 4) { - if (!Number.isFinite(num)) { throw new TypeError(`Expected a number, received ${typeof num}`) } - if (!Number.isFinite(precision)) { throw new TypeError(`Expected a number, received ${typeof precision}`) } +function sqrt(num, precision = 4) { + if (!Number.isFinite(num)) { + throw new TypeError(`Expected a number, received ${typeof num}`) + } + if (!Number.isFinite(precision)) { + throw new TypeError(`Expected a number, received ${typeof precision}`) + } let sqrt = 1 for (let i = 0; i < precision; i++) { sqrt -= (sqrt * sqrt - num) / (2 * sqrt) diff --git a/Maths/SumOfDigits.js b/Maths/SumOfDigits.js index 4b1d7264bc..9fedf0d2b8 100644 --- a/Maths/SumOfDigits.js +++ b/Maths/SumOfDigits.js @@ -9,17 +9,20 @@ The given input is converted to a string, split into an array of characters. This array is reduced to a number using the method .reduce */ -function sumOfDigitsUsingString (number) { +function sumOfDigitsUsingString(number) { if (number < 0) number = -number - return +(number.toString().split('').reduce((a, b) => (+a) + (+b))) + return +number + .toString() + .split('') + .reduce((a, b) => +a + +b) } /* The input is divided by 10 in each iteration, till the input is equal to 0 The sum of all the digits is returned (The res variable acts as a collector, taking the remainders on each iteration) */ -function sumOfDigitsUsingLoop (number) { +function sumOfDigitsUsingLoop(number) { if (number < 0) number = -number let res = 0 @@ -34,7 +37,7 @@ function sumOfDigitsUsingLoop (number) { /* We use the fact that the sum of the digits of a one digit number is itself, and check whether the number is less than 10. If so, then we return the number. Else, we take the number divided by 10 and floored, and recursively call the function, while adding it with the number mod 10 */ -function sumOfDigitsUsingRecursion (number) { +function sumOfDigitsUsingRecursion(number) { if (number < 0) number = -number if (number < 10) return number @@ -42,4 +45,8 @@ function sumOfDigitsUsingRecursion (number) { return (number % 10) + sumOfDigitsUsingRecursion(Math.floor(number / 10)) } -export { sumOfDigitsUsingRecursion, sumOfDigitsUsingLoop, sumOfDigitsUsingString } +export { + sumOfDigitsUsingRecursion, + sumOfDigitsUsingLoop, + sumOfDigitsUsingString +} diff --git a/Maths/SumOfGeometricProgression.js b/Maths/SumOfGeometricProgression.js index 2b172cf5b8..0b91412c45 100644 --- a/Maths/SumOfGeometricProgression.js +++ b/Maths/SumOfGeometricProgression.js @@ -16,19 +16,23 @@ * @param {Number} commonRatio The common ratio of the geometric progression * @param {Number} numOfTerms The number of terms in the progression */ -function sumOfGeometricProgression (firstTerm, commonRatio, numOfTerms) { +function sumOfGeometricProgression(firstTerm, commonRatio, numOfTerms) { if (!Number.isFinite(numOfTerms)) { /* If the number of Terms is Infinity, the common ratio needs to be less than 1 to be a convergent geometric progression Article on Convergent Series: https://en.wikipedia.org/wiki/Convergent_series */ if (Math.abs(commonRatio) < 1) return firstTerm / (1 - commonRatio) - throw new Error('The geometric progression is diverging, and its sum cannot be calculated') + throw new Error( + 'The geometric progression is diverging, and its sum cannot be calculated' + ) } if (commonRatio === 1) return firstTerm * numOfTerms - return (firstTerm * (Math.pow(commonRatio, numOfTerms) - 1)) / (commonRatio - 1) + return ( + (firstTerm * (Math.pow(commonRatio, numOfTerms) - 1)) / (commonRatio - 1) + ) } export { sumOfGeometricProgression } diff --git a/Maths/TwinPrime.js b/Maths/TwinPrime.js index 871b1eab70..0bb17e0ebe 100644 --- a/Maths/TwinPrime.js +++ b/Maths/TwinPrime.js @@ -11,8 +11,8 @@ import { PrimeCheck } from './PrimeCheck' * * @example twinPrime(5) = 7 * @example twinPrime(4) = -1 -*/ -function twinPrime (n) { + */ +function twinPrime(n) { const prime = PrimeCheck(n) if (!prime) { diff --git a/Maths/Volume.js b/Maths/Volume.js index a539cda052..a043001f29 100644 --- a/Maths/Volume.js +++ b/Maths/Volume.js @@ -21,7 +21,7 @@ const volCuboid = (width, length, height) => { isNumber(width, 'Width') isNumber(length, 'Length') isNumber(height, 'Height') - return (width * length * height) + return width * length * height } /* @@ -31,7 +31,7 @@ const volCuboid = (width, length, height) => { */ const volCube = (length) => { isNumber(length, 'Length') - return (length ** 3) + return length ** 3 } /* @@ -42,7 +42,7 @@ const volCube = (length) => { const volCone = (radius, height) => { isNumber(radius, 'Radius') isNumber(height, 'Height') - return (Math.PI * radius ** 2 * height / 3.0) + return (Math.PI * radius ** 2 * height) / 3.0 } /* @@ -65,7 +65,7 @@ const volPyramid = (baseLength, baseWidth, height) => { const volCylinder = (radius, height) => { isNumber(radius, 'Radius') isNumber(height, 'Height') - return (Math.PI * radius ** 2 * height) + return Math.PI * radius ** 2 * height } /* @@ -77,7 +77,7 @@ const volTriangularPrism = (baseLengthTriangle, heightTriangle, height) => { isNumber(baseLengthTriangle, 'BaseLengthTriangle') isNumber(heightTriangle, 'HeightTriangle') isNumber(height, 'Height') - return (1 / 2 * baseLengthTriangle * heightTriangle * height) + return (1 / 2) * baseLengthTriangle * heightTriangle * height } /* @@ -89,7 +89,7 @@ const volPentagonalPrism = (pentagonalLength, pentagonalBaseLength, height) => { isNumber(pentagonalLength, 'PentagonalLength') isNumber(pentagonalBaseLength, 'PentagonalBaseLength') isNumber(height, 'Height') - return (5 / 2 * pentagonalLength * pentagonalBaseLength * height) + return (5 / 2) * pentagonalLength * pentagonalBaseLength * height } /* @@ -99,7 +99,7 @@ const volPentagonalPrism = (pentagonalLength, pentagonalBaseLength, height) => { */ const volSphere = (radius) => { isNumber(radius, 'Radius') - return (4 / 3 * Math.PI * radius ** 3) + return (4 / 3) * Math.PI * radius ** 3 } /* @@ -115,9 +115,19 @@ const volHemisphere = (radius) => { const isNumber = (number, noName = 'number') => { if (typeof number !== 'number') { throw new TypeError('The ' + noName + ' should be Number type') - } else if (number < 0 || (!Number.isFinite(number))) { + } else if (number < 0 || !Number.isFinite(number)) { throw new Error('The ' + noName + ' only accepts positive values') } } -export { volCuboid, volCube, volCone, volPyramid, volCylinder, volTriangularPrism, volPentagonalPrism, volSphere, volHemisphere } +export { + volCuboid, + volCube, + volCone, + volPyramid, + volCylinder, + volTriangularPrism, + volPentagonalPrism, + volSphere, + volHemisphere +} diff --git a/Maths/ZellersCongruenceAlgorithm.js b/Maths/ZellersCongruenceAlgorithm.js index 728fc9cc16..e188af7592 100644 --- a/Maths/ZellersCongruenceAlgorithm.js +++ b/Maths/ZellersCongruenceAlgorithm.js @@ -1,6 +1,10 @@ // Zeller's Congruence Algorithm finds the day of the week from the Gregorian Date. Wikipedia: https://en.wikipedia.org/wiki/Zeller%27s_congruence export const zellersCongruenceAlgorithm = (day, month, year) => { - if (typeof day !== 'number' || typeof month !== 'number' || typeof year !== 'number') { + if ( + typeof day !== 'number' || + typeof month !== 'number' || + typeof year !== 'number' + ) { throw new TypeError('Arguments are not all numbers.') } const q = day @@ -11,8 +15,13 @@ export const zellersCongruenceAlgorithm = (day, month, year) => { y -= 1 } day = - (q + Math.floor(26 * (m + 1) / 10) + (y % 100) + Math.floor((y % 100) / 4) + Math.floor(Math.floor(y / 100) / 4) + (5 * Math.floor(y / 100))) % - 7 + (q + + Math.floor((26 * (m + 1)) / 10) + + (y % 100) + + Math.floor((y % 100) / 4) + + Math.floor(Math.floor(y / 100) / 4) + + 5 * Math.floor(y / 100)) % + 7 const days = [ 'Saturday', 'Sunday', diff --git a/Maths/isPalindromeIntegerNumber.js b/Maths/isPalindromeIntegerNumber.js index c310b73f63..2aceb3ed76 100644 --- a/Maths/isPalindromeIntegerNumber.js +++ b/Maths/isPalindromeIntegerNumber.js @@ -6,7 +6,7 @@ * time complexity : O(log_10(N)) * space complexity : O(1) */ -export function isPalindromeIntegerNumber (x) { +export function isPalindromeIntegerNumber(x) { if (typeof x !== 'number') { throw new TypeError('Input must be a integer number') } diff --git a/Maths/test/BinomialCoefficient.test.js b/Maths/test/BinomialCoefficient.test.js index 0ac46ab1c2..26960b6ab4 100644 --- a/Maths/test/BinomialCoefficient.test.js +++ b/Maths/test/BinomialCoefficient.test.js @@ -12,18 +12,26 @@ describe('Testing findBinomialCoefficient function', () => { }) it('should throw error when supplied arguments other than number', () => { - expect(() => { findBinomialCoefficient('eight', 'three') }).toThrow(Error) + expect(() => { + findBinomialCoefficient('eight', 'three') + }).toThrow(Error) }) it('should throw error when n is less than zero', () => { - expect(() => { findBinomialCoefficient(-1, 3) }).toThrow(Error) + expect(() => { + findBinomialCoefficient(-1, 3) + }).toThrow(Error) }) it('should throw error when k is less than zero', () => { - expect(() => { findBinomialCoefficient(1, -3) }).toThrow(Error) + expect(() => { + findBinomialCoefficient(1, -3) + }).toThrow(Error) }) it('should throw error when n and k are less than zero', () => { - expect(() => { findBinomialCoefficient(-1, -3) }).toThrow(Error) + expect(() => { + findBinomialCoefficient(-1, -3) + }).toThrow(Error) }) }) diff --git a/Maths/test/BisectionMethod.test.js b/Maths/test/BisectionMethod.test.js index 9c34a79dd2..ad865b6ad6 100644 --- a/Maths/test/BisectionMethod.test.js +++ b/Maths/test/BisectionMethod.test.js @@ -1,16 +1,37 @@ import { findRoot } from '../BisectionMethod' test('Equation f(x) = x^2 - 3*x + 2 = 0, has root x = 1 in [a, b] = [0, 1.5]', () => { - const root = findRoot(0, 1.5, (x) => { return Math.pow(x, 2) - 3 * x + 2 }, 8) + const root = findRoot( + 0, + 1.5, + (x) => { + return Math.pow(x, 2) - 3 * x + 2 + }, + 8 + ) expect(root).toBe(0.9990234375) }) test('Equation f(x) = ln(x) + sqrt(x) + π*x^2 = 0, has root x = 0.36247037 in [a, b] = [0, 10]', () => { - const root = findRoot(0, 10, (x) => { return Math.log(x) + Math.sqrt(x) + Math.PI * Math.pow(x, 2) }, 32) + const root = findRoot( + 0, + 10, + (x) => { + return Math.log(x) + Math.sqrt(x) + Math.PI * Math.pow(x, 2) + }, + 32 + ) expect(Number(Number(root).toPrecision(8))).toBe(0.36247037) }) test('Equation f(x) = sqrt(x) + e^(2*x) - 8*x = 0, has root x = 0.93945851 in [a, b] = [0.5, 100]', () => { - const root = findRoot(0.5, 100, (x) => { return Math.exp(2 * x) + Math.sqrt(x) - 8 * x }, 32) + const root = findRoot( + 0.5, + 100, + (x) => { + return Math.exp(2 * x) + Math.sqrt(x) - 8 * x + }, + 32 + ) expect(Number(Number(root).toPrecision(8))).toBe(0.93945851) }) diff --git a/Maths/test/Coordinate.test.js b/Maths/test/Coordinate.test.js index d32b2c3c47..48c0e57bcc 100644 --- a/Maths/test/Coordinate.test.js +++ b/Maths/test/Coordinate.test.js @@ -6,7 +6,12 @@ describe('Testing euclideanDistance calculations', () => { expect(euclideanDistance).toBe(15) }) it('Should not give any output given non-numeric argument', () => { - const euclideanDistance = coordinate.euclideanDistance('ABC', '123', '', '###') + const euclideanDistance = coordinate.euclideanDistance( + 'ABC', + '123', + '', + '###' + ) expect(euclideanDistance).toBeNaN() }) it('Should not give any output given any number of numeric arguments less than 4', () => { @@ -27,7 +32,12 @@ describe('Testing manhattanDistance calculations', () => { expect(manhattanDistance).toBe(21) }) it('Should not give any output given non-numeric argument', () => { - const manhattanDistance = coordinate.manhattanDistance('ABC', '123', '', '###') + const manhattanDistance = coordinate.manhattanDistance( + 'ABC', + '123', + '', + '###' + ) expect(manhattanDistance).toBeNaN() }) it('Should not give any output given any number of numeric arguments less than 4', () => { diff --git a/Maths/test/CountNumbersDivisible.test.js b/Maths/test/CountNumbersDivisible.test.js index e521828b19..f497cfe726 100644 --- a/Maths/test/CountNumbersDivisible.test.js +++ b/Maths/test/CountNumbersDivisible.test.js @@ -7,14 +7,25 @@ describe('Count the numbers divisible', () => { [25, 100, 30, 3], [25, 70, 10, 5], [1, 23, 30, 0] - ])('Total number(s) divisible between %i to %i by %i is/are %i', (n1, n2, m, expected) => { - expect(countNumbersDivisible(n1, n2, m)).toBe(expected) - }) + ])( + 'Total number(s) divisible between %i to %i by %i is/are %i', + (n1, n2, m, expected) => { + expect(countNumbersDivisible(n1, n2, m)).toBe(expected) + } + ) test.each([ ['test', 23, 10, 'Invalid input, please pass only numbers'], - [44, 30, 10, 'Invalid number range, please provide numbers such that num1 < num2'] - ])('Should throw an error for input %i, %i, %i, %i', (n1, n2, m, expected) => { - expect(() => countNumbersDivisible(n1, n2, m)).toThrowError(expected) - }) + [ + 44, + 30, + 10, + 'Invalid number range, please provide numbers such that num1 < num2' + ] + ])( + 'Should throw an error for input %i, %i, %i, %i', + (n1, n2, m, expected) => { + expect(() => countNumbersDivisible(n1, n2, m)).toThrowError(expected) + } + ) }) diff --git a/Maths/test/EulerMethod.manual-test.js b/Maths/test/EulerMethod.manual-test.js index 49d6abe34d..27b4631a80 100644 --- a/Maths/test/EulerMethod.manual-test.js +++ b/Maths/test/EulerMethod.manual-test.js @@ -1,6 +1,6 @@ import { eulerFull } from '../EulerMethod' -function plotLine (label, points, width, height) { +function plotLine(label, points, width, height) { // utility function to plot the results // container needed to control the size of the canvas @@ -14,17 +14,20 @@ function plotLine (label, points, width, height) { container.append(canvas) // Chart-class from chartjs - const chart = new Chart(canvas, { // eslint-disable-line + const chart = new Chart(canvas, { + // eslint-disable-line type: 'scatter', data: { - datasets: [{ - label, - data: points, - showLine: true, - fill: false, - tension: 0, - borderColor: 'black' - }] + datasets: [ + { + label, + data: points, + showLine: true, + fill: false, + tension: 0, + borderColor: 'black' + } + ] }, options: { maintainAspectRatio: false, @@ -33,17 +36,17 @@ function plotLine (label, points, width, height) { }) } -function exampleEquation1 (x, y) { +function exampleEquation1(x, y) { return x } // example from https://en.wikipedia.org/wiki/Euler_method -function exampleEquation2 (x, y) { +function exampleEquation2(x, y) { return y } // example from https://www.geeksforgeeks.org/euler-method-solving-differential-equation/ -function exampleEquation3 (x, y) { +function exampleEquation3(x, y) { return x + y + x * y } diff --git a/Maths/test/EulerMethod.test.js b/Maths/test/EulerMethod.test.js index b0b161ceec..47bd68b2af 100644 --- a/Maths/test/EulerMethod.test.js +++ b/Maths/test/EulerMethod.test.js @@ -2,17 +2,40 @@ import { eulerFull, eulerStep } from '../EulerMethod' describe('eulerStep', () => { it('should calculate the next y value correctly', () => { - expect(eulerStep(0, 0.1, 0, function (x, y) { return x })).toBe(0) - expect(eulerStep(2, 1, 1, function (x, y) { return x * x })).toBe(5) + expect( + eulerStep(0, 0.1, 0, function (x, y) { + return x + }) + ).toBe(0) + expect( + eulerStep(2, 1, 1, function (x, y) { + return x * x + }) + ).toBe(5) }) }) describe('eulerFull', () => { it('should return all the points found', () => { - expect(eulerFull(0, 3, 1, 0, function (x, y) { return x })) - .toEqual([{ x: 0, y: 0 }, { x: 1, y: 0 }, { x: 2, y: 1 }, { x: 3, y: 3 }]) + expect( + eulerFull(0, 3, 1, 0, function (x, y) { + return x + }) + ).toEqual([ + { x: 0, y: 0 }, + { x: 1, y: 0 }, + { x: 2, y: 1 }, + { x: 3, y: 3 } + ]) - expect(eulerFull(3, 4, 0.5, 1, function (x, y) { return x * x })) - .toEqual([{ x: 3, y: 1 }, { x: 3.5, y: 5.5 }, { x: 4, y: 11.625 }]) + expect( + eulerFull(3, 4, 0.5, 1, function (x, y) { + return x * x + }) + ).toEqual([ + { x: 3, y: 1 }, + { x: 3.5, y: 5.5 }, + { x: 4, y: 11.625 } + ]) }) }) diff --git a/Maths/test/ExtendedEuclideanGCD.test.js b/Maths/test/ExtendedEuclideanGCD.test.js index 28acf151cf..c962c31c84 100644 --- a/Maths/test/ExtendedEuclideanGCD.test.js +++ b/Maths/test/ExtendedEuclideanGCD.test.js @@ -6,11 +6,19 @@ describe('extendedEuclideanGCD', () => { expect(extendedEuclideanGCD(46, 240)).toMatchObject([2, 47, -9]) }) it('should give error on non-positive arguments', () => { - expect(() => extendedEuclideanGCD(0, 240)).toThrowError(new TypeError('Must be positive numbers')) - expect(() => extendedEuclideanGCD(46, -240)).toThrowError(new TypeError('Must be positive numbers')) + expect(() => extendedEuclideanGCD(0, 240)).toThrowError( + new TypeError('Must be positive numbers') + ) + expect(() => extendedEuclideanGCD(46, -240)).toThrowError( + new TypeError('Must be positive numbers') + ) }) it('should give error on non-numeric arguments', () => { - expect(() => extendedEuclideanGCD('240', 46)).toThrowError(new TypeError('Not a Number')) - expect(() => extendedEuclideanGCD([240, 46])).toThrowError(new TypeError('Not a Number')) + expect(() => extendedEuclideanGCD('240', 46)).toThrowError( + new TypeError('Not a Number') + ) + expect(() => extendedEuclideanGCD([240, 46])).toThrowError( + new TypeError('Not a Number') + ) }) }) diff --git a/Maths/test/Factorial.test.js b/Maths/test/Factorial.test.js index 1f5da42bb6..5126b2fcb0 100644 --- a/Maths/test/Factorial.test.js +++ b/Maths/test/Factorial.test.js @@ -6,12 +6,18 @@ describe('calcFactorial', () => { }) it('should throw error for "null" and "undefined"', () => { - expect(() => { calcFactorial(null) }).toThrow(Error) - expect(() => { calcFactorial(undefined) }).toThrow(Error) + expect(() => { + calcFactorial(null) + }).toThrow(Error) + expect(() => { + calcFactorial(undefined) + }).toThrow(Error) }) it('should throw error for negative numbers', () => { - expect(() => { calcFactorial(-1) }).toThrow(Error) + expect(() => { + calcFactorial(-1) + }).toThrow(Error) }) it('should return the factorial of a positive number', () => { diff --git a/Maths/test/Fibonacci.test.js b/Maths/test/Fibonacci.test.js index f91aef73d2..3ebb8b8c9b 100644 --- a/Maths/test/Fibonacci.test.js +++ b/Maths/test/Fibonacci.test.js @@ -100,7 +100,10 @@ describe('Fibonacci', () => { [0, 0], [1, 1], [15, 610] - ])('should calculate the correct Fibonacci number for n = %i', (n, expected) => { - expect(FibonacciUsingFormula(n)).toBe(expected) - }) + ])( + 'should calculate the correct Fibonacci number for n = %i', + (n, expected) => { + expect(FibonacciUsingFormula(n)).toBe(expected) + } + ) }) diff --git a/Maths/test/FindLcm.test.js b/Maths/test/FindLcm.test.js index 0a744cf5ae..4c6c80779a 100644 --- a/Maths/test/FindLcm.test.js +++ b/Maths/test/FindLcm.test.js @@ -2,16 +2,24 @@ import { findLcm, findLcmWithHcf } from '../FindLcm' describe('findLcm', () => { it('should throw a statement for values less than 1', () => { - expect(() => { findLcm(0, 0) }).toThrow(Error) + expect(() => { + findLcm(0, 0) + }).toThrow(Error) }) it('should throw a statement for one value less than 1', () => { - expect(() => { findLcm(1, 0) }).toThrow(Error) - expect(() => { findLcm(0, 1) }).toThrow(Error) + expect(() => { + findLcm(1, 0) + }).toThrow(Error) + expect(() => { + findLcm(0, 1) + }).toThrow(Error) }) it('should return an error for values non-integer values', () => { - expect(() => { findLcm(4.564, 7.39) }).toThrow(Error) + expect(() => { + findLcm(4.564, 7.39) + }).toThrow(Error) }) it('should return the LCM of two given integers', () => { @@ -21,16 +29,24 @@ describe('findLcm', () => { describe('findLcmWithHcf', () => { it('should throw a statement for values less than 1', () => { - expect(() => { findLcmWithHcf(0, 0) }).toThrow(Error) + expect(() => { + findLcmWithHcf(0, 0) + }).toThrow(Error) }) it('should throw a statement for one value less than 1', () => { - expect(() => { findLcmWithHcf(1, 0) }).toThrow(Error) - expect(() => { findLcmWithHcf(0, 1) }).toThrow(Error) + expect(() => { + findLcmWithHcf(1, 0) + }).toThrow(Error) + expect(() => { + findLcmWithHcf(0, 1) + }).toThrow(Error) }) it('should return an error for values non-integer values', () => { - expect(() => { findLcmWithHcf(4.564, 7.39) }).toThrow(Error) + expect(() => { + findLcmWithHcf(4.564, 7.39) + }).toThrow(Error) }) it('should return the LCM of two given integers', () => { diff --git a/Maths/test/FindMaxRecursion.test.js b/Maths/test/FindMaxRecursion.test.js index 4772eeb1d3..fec40bd281 100644 --- a/Maths/test/FindMaxRecursion.test.js +++ b/Maths/test/FindMaxRecursion.test.js @@ -1,58 +1,58 @@ -import { findMaxRecursion } from '../FindMaxRecursion' - -describe('Test findMaxRecursion function', () => { - const positiveAndNegativeArray = [1, 2, 4, 5, -1, -2, -4, -5] - const positiveAndNegativeArray1 = [10, 40, 100, 20, -10, -40, -100, -20] - - const positiveArray = [1, 2, 4, 5] - const positiveArray1 = [10, 40, 100, 20] - - const negativeArray = [-1, -2, -4, -5] - const negativeArray1 = [-10, -40, -100, -20] - - const zeroArray = [0, 0, 0, 0] - const emptyArray = [] - - it('Testing with positive arrays', () => { - expect(findMaxRecursion(positiveArray, 0, positiveArray.length - 1)).toBe(5) - expect(findMaxRecursion(positiveArray1, 0, positiveArray1.length - 1)).toBe( - 100 - ) - }) - - it('Testing with negative arrays', () => { - expect(findMaxRecursion(negativeArray, 0, negativeArray.length - 1)).toBe( - -1 - ) - expect(findMaxRecursion(negativeArray1, 0, negativeArray1.length - 1)).toBe( - -10 - ) - }) - - it('Testing with positive and negative arrays', () => { - expect( - findMaxRecursion( - positiveAndNegativeArray, - 0, - positiveAndNegativeArray.length - 1 - ) - ).toBe(5) - expect( - findMaxRecursion( - positiveAndNegativeArray1, - 0, - positiveAndNegativeArray1.length - 1 - ) - ).toBe(100) - }) - - it('Testing with zero arrays', () => { - expect(findMaxRecursion(zeroArray, 0, zeroArray.length - 1)).toBe(0) - }) - - it('Testing with empty arrays', () => { - expect(findMaxRecursion(emptyArray, 0, emptyArray.length - 1)).toBe( - undefined - ) - }) -}) +import { findMaxRecursion } from '../FindMaxRecursion' + +describe('Test findMaxRecursion function', () => { + const positiveAndNegativeArray = [1, 2, 4, 5, -1, -2, -4, -5] + const positiveAndNegativeArray1 = [10, 40, 100, 20, -10, -40, -100, -20] + + const positiveArray = [1, 2, 4, 5] + const positiveArray1 = [10, 40, 100, 20] + + const negativeArray = [-1, -2, -4, -5] + const negativeArray1 = [-10, -40, -100, -20] + + const zeroArray = [0, 0, 0, 0] + const emptyArray = [] + + it('Testing with positive arrays', () => { + expect(findMaxRecursion(positiveArray, 0, positiveArray.length - 1)).toBe(5) + expect(findMaxRecursion(positiveArray1, 0, positiveArray1.length - 1)).toBe( + 100 + ) + }) + + it('Testing with negative arrays', () => { + expect(findMaxRecursion(negativeArray, 0, negativeArray.length - 1)).toBe( + -1 + ) + expect(findMaxRecursion(negativeArray1, 0, negativeArray1.length - 1)).toBe( + -10 + ) + }) + + it('Testing with positive and negative arrays', () => { + expect( + findMaxRecursion( + positiveAndNegativeArray, + 0, + positiveAndNegativeArray.length - 1 + ) + ).toBe(5) + expect( + findMaxRecursion( + positiveAndNegativeArray1, + 0, + positiveAndNegativeArray1.length - 1 + ) + ).toBe(100) + }) + + it('Testing with zero arrays', () => { + expect(findMaxRecursion(zeroArray, 0, zeroArray.length - 1)).toBe(0) + }) + + it('Testing with empty arrays', () => { + expect(findMaxRecursion(emptyArray, 0, emptyArray.length - 1)).toBe( + undefined + ) + }) +}) diff --git a/Maths/test/FindMinIterator.test.js b/Maths/test/FindMinIterator.test.js index 9f4200dc1f..7b7229b106 100644 --- a/Maths/test/FindMinIterator.test.js +++ b/Maths/test/FindMinIterator.test.js @@ -16,16 +16,19 @@ describe('FindMinIterator', () => { expect(FindMinIterator([-1, 10])).toBe(-1) expect(FindMinIterator([0, 100])).toBe(0) expect(FindMinIterator([100, 0])).toBe(0) - expect(FindMinIterator([100, 50, 20, 0, -100, 0, 2, 30, 45, 99, 104, 23])).toBe(-100) + expect( + FindMinIterator([100, 50, 20, 0, -100, 0, 2, 30, 45, 99, 104, 23]) + ).toBe(-100) }) test('given empty generator then min is undefined', () => { - const src = function* () { } // eslint-disable-line + const src = function* () {} // eslint-disable-line expect(FindMinIterator(src())).toBeUndefined() }) test('given generator then min is found', () => { - const src = function* () { // eslint-disable-line + const src = function* () { + // eslint-disable-line yield 1 yield -1 yield 0 @@ -34,12 +37,13 @@ describe('FindMinIterator', () => { }) test('given string generator then min string length is found', () => { - const src = function* () { // eslint-disable-line + const src = function* () { + // eslint-disable-line yield 'abc' yield 'de' yield 'qwerty' } - expect(FindMinIterator(src(), _x => _x.length)).toBe(2) + expect(FindMinIterator(src(), (_x) => _x.length)).toBe(2) }) test('given array of objects then min accessor is found', () => { @@ -48,7 +52,7 @@ describe('FindMinIterator', () => { { name: 'Item #2', price: 0.0 }, { name: 'Item #3', price: -1.0 } ] - expect(FindMinIterator(array, _x => _x.price)).toBe(-1) - expect(FindMinIterator(array, _x => _x.name)).toBe('Item #1') + expect(FindMinIterator(array, (_x) => _x.price)).toBe(-1) + expect(FindMinIterator(array, (_x) => _x.name)).toBe('Item #1') }) }) diff --git a/Maths/test/GetEuclidGCD.test.js b/Maths/test/GetEuclidGCD.test.js index bcc2a6c2bf..1639d9cb7f 100644 --- a/Maths/test/GetEuclidGCD.test.js +++ b/Maths/test/GetEuclidGCD.test.js @@ -1,6 +1,6 @@ import { GetEuclidGCD } from '../GetEuclidGCD' -function testEuclidGCD (n, m, expected) { +function testEuclidGCD(n, m, expected) { test('Testing on ' + n + ' and ' + m + '!', () => { expect(GetEuclidGCD(n, m)).toBe(expected) }) diff --git a/Maths/test/HexagonalNumber.test.js b/Maths/test/HexagonalNumber.test.js index ebfc1cc738..eab2ea0043 100644 --- a/Maths/test/HexagonalNumber.test.js +++ b/Maths/test/HexagonalNumber.test.js @@ -1,19 +1,29 @@ import { hexagonalNumber } from '../HexagonalNumber' -const expectedValuesArray = [1, 6, 15, 28, 45, 66, 91, 120, 153, 190, 231, 276, 325, 378, 435, 496, 561, 630, 703, 780, 861, 946] +const expectedValuesArray = [ + 1, 6, 15, 28, 45, 66, 91, 120, 153, 190, 231, 276, 325, 378, 435, 496, 561, + 630, 703, 780, 861, 946 +] describe('Testing hexagonalNumber', () => { for (let i = 1; i <= 22; i++) { - it('Testing for number = ' + i + ', should return ' + expectedValuesArray[i], () => { - expect(hexagonalNumber(i)).toBe(expectedValuesArray[i - 1]) - }) + it( + 'Testing for number = ' + i + ', should return ' + expectedValuesArray[i], + () => { + expect(hexagonalNumber(i)).toBe(expectedValuesArray[i - 1]) + } + ) } it('should throw error when supplied negative numbers', () => { - expect(() => { hexagonalNumber(-1) }).toThrow(Error) + expect(() => { + hexagonalNumber(-1) + }).toThrow(Error) }) it('should throw error when supplied zero', () => { - expect(() => { hexagonalNumber(0) }).toThrow(Error) + expect(() => { + hexagonalNumber(0) + }).toThrow(Error) }) }) diff --git a/Maths/test/IsDivisible.test.js b/Maths/test/IsDivisible.test.js index 80ece0a0d7..76e6769958 100644 --- a/Maths/test/IsDivisible.test.js +++ b/Maths/test/IsDivisible.test.js @@ -17,9 +17,12 @@ describe('isDivisible', () => { [5, -0, false] ] - test.each(testCases)('if parameters are (%i, %i) it returns %p', (dividend, divisor, expected) => { - expect(isDivisible(dividend, divisor)).toBe(expected) - }) + test.each(testCases)( + 'if parameters are (%i, %i) it returns %p', + (dividend, divisor, expected) => { + expect(isDivisible(dividend, divisor)).toBe(expected) + } + ) const errorCases = [ [NaN, NaN], @@ -31,9 +34,12 @@ describe('isDivisible', () => { [false, 2] ] - test.each(errorCases)('throws an error if parameters are (%p, %p)', (dividend, divisor) => { - expect(() => { - isDivisible(dividend, divisor) - }).toThrow() - }) + test.each(errorCases)( + 'throws an error if parameters are (%p, %p)', + (dividend, divisor) => { + expect(() => { + isDivisible(dividend, divisor) + }).toThrow() + } + ) }) diff --git a/Maths/test/IsPronic.test.js b/Maths/test/IsPronic.test.js index 7ec957ce39..f46aef69f1 100644 --- a/Maths/test/IsPronic.test.js +++ b/Maths/test/IsPronic.test.js @@ -1,6 +1,11 @@ import { isPronic } from '../IsPronic' -const pronicNumbers = [0, 2, 6, 12, 20, 30, 42, 56, 72, 90, 110, 132, 156, 182, 210, 240, 272, 306, 342, 380, 420, 462, 506, 552, 600, 650, 702, 756, 812, 870, 930, 992, 1056, 1122, 1190, 1260, 1332, 1406, 1482, 1560, 1640, 1722, 1806, 1892, 1980, 2070, 2162, 2256, 2352, 2450, 2550] +const pronicNumbers = [ + 0, 2, 6, 12, 20, 30, 42, 56, 72, 90, 110, 132, 156, 182, 210, 240, 272, 306, + 342, 380, 420, 462, 506, 552, 600, 650, 702, 756, 812, 870, 930, 992, 1056, + 1122, 1190, 1260, 1332, 1406, 1482, 1560, 1640, 1722, 1806, 1892, 1980, 2070, + 2162, 2256, 2352, 2450, 2550 +] describe('Testing isPronic function', () => { for (let i = 0; i <= 2500; i++) { diff --git a/Maths/test/IsSquareFree.test.js b/Maths/test/IsSquareFree.test.js index 90f47c2d62..17bc67018c 100644 --- a/Maths/test/IsSquareFree.test.js +++ b/Maths/test/IsSquareFree.test.js @@ -1,6 +1,117 @@ import { isSquareFree } from '../IsSquareFree' -const squareFreeNumbers = [1, 2, 3, 5, 6, 7, 10, 11, 13, 14, 15, 17, 19, 21, 22, 23, 26, 29, 30, 31, 33, 34, 35, 37, 38, 39, 41, 42, 43, 46, 47, 51, 53, 55, 57, 58, 59, 61, 62, 65, 66, 67, 69, 70, 71, 73, 74, 77, 78, 79, 82, 83, 85, 86, 87, 89, 91, 93, 94, 95, 97, 101, 102, 103, 105, 106, 107, 109, 110, 111, 113, 114, 115, 118, 119, 122, 123, 127, 129, 130, 131, 133, 134, 137, 138, 139, 141, 142, 143, 145, 146, 149, 151, 154, 155, 157, 158, 159, 161, 163, 165, 166, 167, 170, 173, 174, 177, 178, 179, 181, 182, 183, 185, 186, 187, 190, 191, 193, 194, 195, 197, 199, 201, 202, 203, 205, 206, 209, 210, 211, 213, 214, 215, 217, 218, 219, 221, 222, 223, 226, 227, 229, 230, 231, 233, 235, 237, 238, 239, 241, 246, 247, 249, 251, 253, 254, 255, 257, 258, 259, 262, 263, 265, 266, 267, 269, 271, 273, 274, 277, 278, 281, 282, 283, 285, 286, 287, 290, 291, 293, 295, 298, 299, 301, 302, 303, 305, 307, 309, 310, 311, 313, 314, 317, 318, 319, 321, 322, 323, 326, 327, 329, 330, 331, 334, 335, 337, 339, 341, 345, 346, 347, 349, 353, 354, 355, 357, 358, 359, 362, 365, 366, 367, 370, 371, 373, 374, 377, 379, 381, 382, 383, 385, 386, 389, 390, 391, 393, 394, 395, 397, 398, 399, 401, 402, 403, 406, 407, 409, 410, 411, 413, 415, 417, 418, 419, 421, 422, 426, 427, 429, 430, 431, 433, 434, 435, 437, 438, 439, 442, 443, 445, 446, 447, 449, 451, 453, 454, 455, 457, 458, 461, 462, 463, 465, 466, 467, 469, 470, 471, 473, 474, 478, 479, 481, 482, 483, 485, 487, 489, 491, 493, 494, 497, 498, 499, 501, 502, 503, 505, 506, 509, 510, 511, 514, 515, 517, 518, 519, 521, 523, 526, 527, 530, 533, 534, 535, 537, 538, 541, 542, 543, 545, 546, 547, 551, 553, 554, 555, 557, 559, 561, 562, 563, 565, 566, 569, 570, 571, 573, 574, 577, 579, 581, 582, 583, 586, 587, 589, 590, 591, 593, 595, 597, 598, 599, 601, 602, 606, 607, 609, 610, 611, 613, 614, 615, 617, 618, 619, 622, 623, 626, 627, 629, 631, 633, 634, 635, 638, 641, 642, 643, 645, 646, 647, 649, 651, 653, 654, 655, 658, 659, 661, 662, 663, 665, 667, 669, 670, 671, 673, 674, 677, 678, 679, 681, 682, 683, 685, 687, 689, 690, 691, 694, 695, 697, 698, 699, 701, 703, 705, 706, 707, 709, 710, 713, 714, 715, 717, 718, 719, 721, 723, 727, 730, 731, 733, 734, 737, 739, 741, 742, 743, 745, 746, 749, 751, 753, 754, 755, 757, 758, 759, 761, 762, 763, 766, 767, 769, 770, 771, 773, 777, 778, 779, 781, 782, 785, 786, 787, 789, 790, 791, 793, 794, 795, 797, 798, 799, 802, 803, 805, 806, 807, 809, 811, 813, 814, 815, 817, 818, 821, 822, 823, 826, 827, 829, 830, 831, 834, 835, 838, 839, 842, 843, 849, 851, 853, 854, 857, 858, 859, 861, 862, 863, 865, 866, 869, 870, 871, 874, 877, 878, 879, 881, 883, 885, 886, 887, 889, 890, 893, 894, 895, 897, 898, 899, 901, 902, 903, 905, 906, 907, 910, 911, 913, 914, 915, 917, 919, 921, 922, 923, 926, 929, 930, 933, 934, 935, 937, 938, 939, 941, 942, 943, 946, 947, 949, 951, 953, 955, 957, 958, 959, 962, 965, 966, 967, 969, 970, 971, 973, 974, 977, 978, 979, 982, 983, 985, 986, 987, 989, 991, 993, 994, 995, 997, 998, 1001, 1002, 1003, 1005, 1006, 1007, 1009, 1010, 1011, 1013, 1015, 1018, 1019, 1021, 1022, 1023, 1027, 1030, 1031, 1033, 1034, 1037, 1038, 1039, 1041, 1042, 1043, 1045, 1046, 1047, 1049, 1051, 1054, 1055, 1057, 1059, 1061, 1063, 1065, 1066, 1067, 1069, 1070, 1073, 1074, 1077, 1079, 1081, 1082, 1085, 1086, 1087, 1090, 1091, 1093, 1094, 1095, 1097, 1099, 1101, 1102, 1103, 1105, 1106, 1109, 1110, 1111, 1113, 1114, 1115, 1117, 1118, 1119, 1121, 1122, 1123, 1126, 1129, 1130, 1131, 1133, 1135, 1137, 1138, 1139, 1141, 1142, 1145, 1146, 1147, 1149, 1151, 1153, 1154, 1155, 1157, 1158, 1159, 1162, 1163, 1165, 1166, 1167, 1169, 1171, 1173, 1174, 1177, 1178, 1181, 1182, 1185, 1186, 1187, 1189, 1190, 1191, 1193, 1194, 1195, 1198, 1199, 1201, 1202, 1203, 1205, 1207, 1209, 1211, 1213, 1214, 1217, 1218, 1219, 1221, 1222, 1223, 1226, 1227, 1229, 1230, 1231, 1234, 1235, 1237, 1238, 1239, 1241, 1243, 1245, 1246, 1247, 1249, 1253, 1254, 1255, 1257, 1258, 1259, 1261, 1262, 1263, 1265, 1266, 1267, 1270, 1271, 1273, 1277, 1279, 1281, 1282, 1283, 1285, 1286, 1289, 1290, 1291, 1293, 1294, 1295, 1297, 1298, 1299, 1301, 1302, 1303, 1306, 1307, 1309, 1310, 1311, 1313, 1315, 1317, 1318, 1319, 1321, 1322, 1326, 1327, 1329, 1330, 1333, 1334, 1335, 1337, 1338, 1339, 1342, 1343, 1345, 1346, 1347, 1349, 1351, 1353, 1354, 1355, 1357, 1358, 1361, 1362, 1363, 1365, 1366, 1367, 1370, 1371, 1373, 1374, 1378, 1379, 1381, 1382, 1383, 1385, 1387, 1389, 1390, 1391, 1393, 1394, 1397, 1398, 1399, 1401, 1402, 1403, 1405, 1406, 1407, 1409, 1410, 1411, 1414, 1415, 1417, 1418, 1419, 1423, 1426, 1427, 1429, 1430, 1433, 1434, 1435, 1437, 1438, 1439, 1441, 1442, 1443, 1446, 1447, 1451, 1453, 1454, 1455, 1457, 1459, 1461, 1462, 1463, 1465, 1466, 1469, 1471, 1473, 1474, 1477, 1478, 1479, 1481, 1482, 1483, 1486, 1487, 1489, 1490, 1491, 1493, 1495, 1497, 1498, 1499, 1501, 1502, 1505, 1506, 1507, 1509, 1510, 1511, 1513, 1514, 1515, 1517, 1518, 1522, 1523, 1526, 1527, 1529, 1531, 1533, 1534, 1535, 1537, 1538, 1541, 1542, 1543, 1545, 1546, 1547, 1549, 1551, 1553, 1554, 1555, 1558, 1559, 1561, 1562, 1563, 1565, 1567, 1569, 1570, 1571, 1574, 1577, 1578, 1579, 1581, 1582, 1583, 1585, 1586, 1589, 1590, 1591, 1594, 1595, 1597, 1598, 1599, 1601, 1603, 1605, 1606, 1607, 1609, 1610, 1613, 1614, 1615, 1618, 1619, 1621, 1622, 1623, 1626, 1627, 1630, 1631, 1633, 1634, 1635, 1637, 1639, 1641, 1642, 1643, 1645, 1646, 1649, 1651, 1653, 1654, 1655, 1657, 1658, 1659, 1661, 1662, 1663, 1667, 1669, 1670, 1671, 1673, 1677, 1678, 1679, 1685, 1686, 1687, 1689, 1691, 1693, 1695, 1697, 1698, 1699, 1702, 1703, 1705, 1706, 1707, 1709, 1711, 1713, 1714, 1717, 1718, 1721, 1722, 1723, 1726, 1727, 1729, 1730, 1731, 1733, 1735, 1738, 1739, 1741, 1742, 1743, 1745, 1747, 1749, 1751, 1753, 1754, 1757, 1758, 1759, 1761, 1762, 1763, 1765, 1766, 1767, 1769, 1770, 1771, 1774, 1777, 1778, 1779, 1781, 1783, 1785, 1786, 1787, 1789, 1790, 1793, 1794, 1795, 1797, 1798, 1799, 1801, 1802, 1803, 1806, 1807, 1810, 1811, 1814, 1817, 1819, 1821, 1822, 1823, 1826, 1829, 1830, 1831, 1833, 1834, 1835, 1837, 1838, 1839, 1841, 1842, 1843, 1846, 1847, 1851, 1853, 1855, 1857, 1858, 1861, 1865, 1866, 1867, 1869, 1870, 1871, 1873, 1874, 1877, 1878, 1879, 1882, 1883, 1885, 1886, 1887, 1889, 1891, 1893, 1894, 1895, 1897, 1898, 1901, 1902, 1903, 1905, 1906, 1907, 1909, 1910, 1913, 1914, 1915, 1918, 1919, 1921, 1923, 1927, 1929, 1930, 1931, 1933, 1934, 1937, 1938, 1939, 1941, 1942, 1943, 1945, 1946, 1947, 1949, 1951, 1954, 1955, 1957, 1958, 1959, 1961, 1963, 1965, 1966, 1967, 1969, 1970, 1973, 1974, 1977, 1978, 1979, 1981, 1982, 1983, 1985, 1986, 1987, 1990, 1991, 1993, 1994, 1995, 1997, 1999, 2001, 2002, 2003, 2005, 2006, 2010, 2011, 2013, 2014, 2015, 2017, 2018, 2019, 2021, 2022, 2026, 2027, 2029, 2030, 2031, 2033, 2035, 2037, 2038, 2039, 2041, 2042, 2045, 2046, 2047, 2049, 2051, 2053, 2054, 2055, 2059, 2062, 2063, 2065, 2066, 2067, 2069, 2071, 2073, 2074, 2077, 2078, 2081, 2082, 2083, 2085, 2086, 2087, 2089, 2090, 2091, 2093, 2094, 2095, 2098, 2099, 2101, 2102, 2103, 2105, 2109, 2110, 2111, 2113, 2114, 2117, 2118, 2119, 2121, 2122, 2123, 2126, 2127, 2129, 2130, 2131, 2134, 2135, 2137, 2138, 2139, 2141, 2143, 2145, 2146, 2147, 2149, 2153, 2154, 2155, 2157, 2158, 2159, 2161, 2162, 2163, 2165, 2167, 2170, 2171, 2173, 2174, 2177, 2179, 2181, 2182, 2183, 2185, 2186, 2189, 2190, 2191, 2193, 2194, 2195, 2198, 2199, 2201, 2202, 2203, 2206, 2207, 2210, 2211, 2213, 2215, 2217, 2218, 2219, 2221, 2222, 2226, 2227, 2229, 2230, 2231, 2233, 2234, 2235, 2237, 2238, 2239, 2242, 2243, 2245, 2246, 2247, 2249, 2251, 2253, 2255, 2257, 2258, 2261, 2262, 2263, 2265, 2266, 2267, 2269, 2270, 2271, 2273, 2274, 2278, 2279, 2281, 2282, 2283, 2285, 2287, 2289, 2290, 2291, 2293, 2294, 2297, 2298, 2301, 2302, 2305, 2306, 2307, 2309, 2310, 2311, 2314, 2315, 2317, 2318, 2319, 2321, 2323, 2326, 2327, 2329, 2330, 2333, 2334, 2335, 2337, 2338, 2339, 2341, 2342, 2343, 2345, 2346, 2347, 2351, 2353, 2354, 2355, 2357, 2359, 2361, 2362, 2363, 2365, 2369, 2370, 2371, 2373, 2374, 2377, 2378, 2379, 2381, 2382, 2383, 2386, 2387, 2389, 2390, 2391, 2393, 2395, 2397, 2398, 2399, 2402, 2405, 2406, 2407, 2409, 2410, 2411, 2413, 2414, 2415, 2417, 2418, 2419, 2422, 2423, 2426, 2427, 2429, 2431, 2433, 2434, 2435, 2437, 2438, 2441, 2442, 2443, 2445, 2446, 2447, 2449, 2451, 2453, 2454, 2455, 2458, 2459, 2461, 2462, 2463, 2465, 2467, 2469, 2470, 2471, 2473, 2474, 2477, 2478, 2479, 2481, 2482, 2483, 2485, 2486, 2487, 2489, 2490, 2491, 2494, 2495, 2497, 2498] +const squareFreeNumbers = [ + 1, 2, 3, 5, 6, 7, 10, 11, 13, 14, 15, 17, 19, 21, 22, 23, 26, 29, 30, 31, 33, + 34, 35, 37, 38, 39, 41, 42, 43, 46, 47, 51, 53, 55, 57, 58, 59, 61, 62, 65, + 66, 67, 69, 70, 71, 73, 74, 77, 78, 79, 82, 83, 85, 86, 87, 89, 91, 93, 94, + 95, 97, 101, 102, 103, 105, 106, 107, 109, 110, 111, 113, 114, 115, 118, 119, + 122, 123, 127, 129, 130, 131, 133, 134, 137, 138, 139, 141, 142, 143, 145, + 146, 149, 151, 154, 155, 157, 158, 159, 161, 163, 165, 166, 167, 170, 173, + 174, 177, 178, 179, 181, 182, 183, 185, 186, 187, 190, 191, 193, 194, 195, + 197, 199, 201, 202, 203, 205, 206, 209, 210, 211, 213, 214, 215, 217, 218, + 219, 221, 222, 223, 226, 227, 229, 230, 231, 233, 235, 237, 238, 239, 241, + 246, 247, 249, 251, 253, 254, 255, 257, 258, 259, 262, 263, 265, 266, 267, + 269, 271, 273, 274, 277, 278, 281, 282, 283, 285, 286, 287, 290, 291, 293, + 295, 298, 299, 301, 302, 303, 305, 307, 309, 310, 311, 313, 314, 317, 318, + 319, 321, 322, 323, 326, 327, 329, 330, 331, 334, 335, 337, 339, 341, 345, + 346, 347, 349, 353, 354, 355, 357, 358, 359, 362, 365, 366, 367, 370, 371, + 373, 374, 377, 379, 381, 382, 383, 385, 386, 389, 390, 391, 393, 394, 395, + 397, 398, 399, 401, 402, 403, 406, 407, 409, 410, 411, 413, 415, 417, 418, + 419, 421, 422, 426, 427, 429, 430, 431, 433, 434, 435, 437, 438, 439, 442, + 443, 445, 446, 447, 449, 451, 453, 454, 455, 457, 458, 461, 462, 463, 465, + 466, 467, 469, 470, 471, 473, 474, 478, 479, 481, 482, 483, 485, 487, 489, + 491, 493, 494, 497, 498, 499, 501, 502, 503, 505, 506, 509, 510, 511, 514, + 515, 517, 518, 519, 521, 523, 526, 527, 530, 533, 534, 535, 537, 538, 541, + 542, 543, 545, 546, 547, 551, 553, 554, 555, 557, 559, 561, 562, 563, 565, + 566, 569, 570, 571, 573, 574, 577, 579, 581, 582, 583, 586, 587, 589, 590, + 591, 593, 595, 597, 598, 599, 601, 602, 606, 607, 609, 610, 611, 613, 614, + 615, 617, 618, 619, 622, 623, 626, 627, 629, 631, 633, 634, 635, 638, 641, + 642, 643, 645, 646, 647, 649, 651, 653, 654, 655, 658, 659, 661, 662, 663, + 665, 667, 669, 670, 671, 673, 674, 677, 678, 679, 681, 682, 683, 685, 687, + 689, 690, 691, 694, 695, 697, 698, 699, 701, 703, 705, 706, 707, 709, 710, + 713, 714, 715, 717, 718, 719, 721, 723, 727, 730, 731, 733, 734, 737, 739, + 741, 742, 743, 745, 746, 749, 751, 753, 754, 755, 757, 758, 759, 761, 762, + 763, 766, 767, 769, 770, 771, 773, 777, 778, 779, 781, 782, 785, 786, 787, + 789, 790, 791, 793, 794, 795, 797, 798, 799, 802, 803, 805, 806, 807, 809, + 811, 813, 814, 815, 817, 818, 821, 822, 823, 826, 827, 829, 830, 831, 834, + 835, 838, 839, 842, 843, 849, 851, 853, 854, 857, 858, 859, 861, 862, 863, + 865, 866, 869, 870, 871, 874, 877, 878, 879, 881, 883, 885, 886, 887, 889, + 890, 893, 894, 895, 897, 898, 899, 901, 902, 903, 905, 906, 907, 910, 911, + 913, 914, 915, 917, 919, 921, 922, 923, 926, 929, 930, 933, 934, 935, 937, + 938, 939, 941, 942, 943, 946, 947, 949, 951, 953, 955, 957, 958, 959, 962, + 965, 966, 967, 969, 970, 971, 973, 974, 977, 978, 979, 982, 983, 985, 986, + 987, 989, 991, 993, 994, 995, 997, 998, 1001, 1002, 1003, 1005, 1006, 1007, + 1009, 1010, 1011, 1013, 1015, 1018, 1019, 1021, 1022, 1023, 1027, 1030, 1031, + 1033, 1034, 1037, 1038, 1039, 1041, 1042, 1043, 1045, 1046, 1047, 1049, 1051, + 1054, 1055, 1057, 1059, 1061, 1063, 1065, 1066, 1067, 1069, 1070, 1073, 1074, + 1077, 1079, 1081, 1082, 1085, 1086, 1087, 1090, 1091, 1093, 1094, 1095, 1097, + 1099, 1101, 1102, 1103, 1105, 1106, 1109, 1110, 1111, 1113, 1114, 1115, 1117, + 1118, 1119, 1121, 1122, 1123, 1126, 1129, 1130, 1131, 1133, 1135, 1137, 1138, + 1139, 1141, 1142, 1145, 1146, 1147, 1149, 1151, 1153, 1154, 1155, 1157, 1158, + 1159, 1162, 1163, 1165, 1166, 1167, 1169, 1171, 1173, 1174, 1177, 1178, 1181, + 1182, 1185, 1186, 1187, 1189, 1190, 1191, 1193, 1194, 1195, 1198, 1199, 1201, + 1202, 1203, 1205, 1207, 1209, 1211, 1213, 1214, 1217, 1218, 1219, 1221, 1222, + 1223, 1226, 1227, 1229, 1230, 1231, 1234, 1235, 1237, 1238, 1239, 1241, 1243, + 1245, 1246, 1247, 1249, 1253, 1254, 1255, 1257, 1258, 1259, 1261, 1262, 1263, + 1265, 1266, 1267, 1270, 1271, 1273, 1277, 1279, 1281, 1282, 1283, 1285, 1286, + 1289, 1290, 1291, 1293, 1294, 1295, 1297, 1298, 1299, 1301, 1302, 1303, 1306, + 1307, 1309, 1310, 1311, 1313, 1315, 1317, 1318, 1319, 1321, 1322, 1326, 1327, + 1329, 1330, 1333, 1334, 1335, 1337, 1338, 1339, 1342, 1343, 1345, 1346, 1347, + 1349, 1351, 1353, 1354, 1355, 1357, 1358, 1361, 1362, 1363, 1365, 1366, 1367, + 1370, 1371, 1373, 1374, 1378, 1379, 1381, 1382, 1383, 1385, 1387, 1389, 1390, + 1391, 1393, 1394, 1397, 1398, 1399, 1401, 1402, 1403, 1405, 1406, 1407, 1409, + 1410, 1411, 1414, 1415, 1417, 1418, 1419, 1423, 1426, 1427, 1429, 1430, 1433, + 1434, 1435, 1437, 1438, 1439, 1441, 1442, 1443, 1446, 1447, 1451, 1453, 1454, + 1455, 1457, 1459, 1461, 1462, 1463, 1465, 1466, 1469, 1471, 1473, 1474, 1477, + 1478, 1479, 1481, 1482, 1483, 1486, 1487, 1489, 1490, 1491, 1493, 1495, 1497, + 1498, 1499, 1501, 1502, 1505, 1506, 1507, 1509, 1510, 1511, 1513, 1514, 1515, + 1517, 1518, 1522, 1523, 1526, 1527, 1529, 1531, 1533, 1534, 1535, 1537, 1538, + 1541, 1542, 1543, 1545, 1546, 1547, 1549, 1551, 1553, 1554, 1555, 1558, 1559, + 1561, 1562, 1563, 1565, 1567, 1569, 1570, 1571, 1574, 1577, 1578, 1579, 1581, + 1582, 1583, 1585, 1586, 1589, 1590, 1591, 1594, 1595, 1597, 1598, 1599, 1601, + 1603, 1605, 1606, 1607, 1609, 1610, 1613, 1614, 1615, 1618, 1619, 1621, 1622, + 1623, 1626, 1627, 1630, 1631, 1633, 1634, 1635, 1637, 1639, 1641, 1642, 1643, + 1645, 1646, 1649, 1651, 1653, 1654, 1655, 1657, 1658, 1659, 1661, 1662, 1663, + 1667, 1669, 1670, 1671, 1673, 1677, 1678, 1679, 1685, 1686, 1687, 1689, 1691, + 1693, 1695, 1697, 1698, 1699, 1702, 1703, 1705, 1706, 1707, 1709, 1711, 1713, + 1714, 1717, 1718, 1721, 1722, 1723, 1726, 1727, 1729, 1730, 1731, 1733, 1735, + 1738, 1739, 1741, 1742, 1743, 1745, 1747, 1749, 1751, 1753, 1754, 1757, 1758, + 1759, 1761, 1762, 1763, 1765, 1766, 1767, 1769, 1770, 1771, 1774, 1777, 1778, + 1779, 1781, 1783, 1785, 1786, 1787, 1789, 1790, 1793, 1794, 1795, 1797, 1798, + 1799, 1801, 1802, 1803, 1806, 1807, 1810, 1811, 1814, 1817, 1819, 1821, 1822, + 1823, 1826, 1829, 1830, 1831, 1833, 1834, 1835, 1837, 1838, 1839, 1841, 1842, + 1843, 1846, 1847, 1851, 1853, 1855, 1857, 1858, 1861, 1865, 1866, 1867, 1869, + 1870, 1871, 1873, 1874, 1877, 1878, 1879, 1882, 1883, 1885, 1886, 1887, 1889, + 1891, 1893, 1894, 1895, 1897, 1898, 1901, 1902, 1903, 1905, 1906, 1907, 1909, + 1910, 1913, 1914, 1915, 1918, 1919, 1921, 1923, 1927, 1929, 1930, 1931, 1933, + 1934, 1937, 1938, 1939, 1941, 1942, 1943, 1945, 1946, 1947, 1949, 1951, 1954, + 1955, 1957, 1958, 1959, 1961, 1963, 1965, 1966, 1967, 1969, 1970, 1973, 1974, + 1977, 1978, 1979, 1981, 1982, 1983, 1985, 1986, 1987, 1990, 1991, 1993, 1994, + 1995, 1997, 1999, 2001, 2002, 2003, 2005, 2006, 2010, 2011, 2013, 2014, 2015, + 2017, 2018, 2019, 2021, 2022, 2026, 2027, 2029, 2030, 2031, 2033, 2035, 2037, + 2038, 2039, 2041, 2042, 2045, 2046, 2047, 2049, 2051, 2053, 2054, 2055, 2059, + 2062, 2063, 2065, 2066, 2067, 2069, 2071, 2073, 2074, 2077, 2078, 2081, 2082, + 2083, 2085, 2086, 2087, 2089, 2090, 2091, 2093, 2094, 2095, 2098, 2099, 2101, + 2102, 2103, 2105, 2109, 2110, 2111, 2113, 2114, 2117, 2118, 2119, 2121, 2122, + 2123, 2126, 2127, 2129, 2130, 2131, 2134, 2135, 2137, 2138, 2139, 2141, 2143, + 2145, 2146, 2147, 2149, 2153, 2154, 2155, 2157, 2158, 2159, 2161, 2162, 2163, + 2165, 2167, 2170, 2171, 2173, 2174, 2177, 2179, 2181, 2182, 2183, 2185, 2186, + 2189, 2190, 2191, 2193, 2194, 2195, 2198, 2199, 2201, 2202, 2203, 2206, 2207, + 2210, 2211, 2213, 2215, 2217, 2218, 2219, 2221, 2222, 2226, 2227, 2229, 2230, + 2231, 2233, 2234, 2235, 2237, 2238, 2239, 2242, 2243, 2245, 2246, 2247, 2249, + 2251, 2253, 2255, 2257, 2258, 2261, 2262, 2263, 2265, 2266, 2267, 2269, 2270, + 2271, 2273, 2274, 2278, 2279, 2281, 2282, 2283, 2285, 2287, 2289, 2290, 2291, + 2293, 2294, 2297, 2298, 2301, 2302, 2305, 2306, 2307, 2309, 2310, 2311, 2314, + 2315, 2317, 2318, 2319, 2321, 2323, 2326, 2327, 2329, 2330, 2333, 2334, 2335, + 2337, 2338, 2339, 2341, 2342, 2343, 2345, 2346, 2347, 2351, 2353, 2354, 2355, + 2357, 2359, 2361, 2362, 2363, 2365, 2369, 2370, 2371, 2373, 2374, 2377, 2378, + 2379, 2381, 2382, 2383, 2386, 2387, 2389, 2390, 2391, 2393, 2395, 2397, 2398, + 2399, 2402, 2405, 2406, 2407, 2409, 2410, 2411, 2413, 2414, 2415, 2417, 2418, + 2419, 2422, 2423, 2426, 2427, 2429, 2431, 2433, 2434, 2435, 2437, 2438, 2441, + 2442, 2443, 2445, 2446, 2447, 2449, 2451, 2453, 2454, 2455, 2458, 2459, 2461, + 2462, 2463, 2465, 2467, 2469, 2470, 2471, 2473, 2474, 2477, 2478, 2479, 2481, + 2482, 2483, 2485, 2486, 2487, 2489, 2490, 2491, 2494, 2495, 2497, 2498 +] describe('Testing isSquareFree function', () => { for (let i = 1; i <= 2500; i++) { @@ -11,10 +122,14 @@ describe('Testing isSquareFree function', () => { } it('should throw error when supplied negative numbers', () => { - expect(() => { isSquareFree(-1) }).toThrow(Error) + expect(() => { + isSquareFree(-1) + }).toThrow(Error) }) it('should throw error when supplied zero', () => { - expect(() => { isSquareFree(0) }).toThrow(Error) + expect(() => { + isSquareFree(0) + }).toThrow(Error) }) }) diff --git a/Maths/test/LinearSieve.test.js b/Maths/test/LinearSieve.test.js index b719043492..738d04d930 100644 --- a/Maths/test/LinearSieve.test.js +++ b/Maths/test/LinearSieve.test.js @@ -3,7 +3,10 @@ import { PrimeCheck } from '../PrimeCheck' describe('LinearSieve', () => { it('should return primes below 100', () => { - expect(LinearSieve(100)).toEqual([2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]) + expect(LinearSieve(100)).toEqual([ + 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, + 71, 73, 79, 83, 89, 97 + ]) }) it('should return primes only', () => { diff --git a/Maths/test/LiouvilleFunction.test.js b/Maths/test/LiouvilleFunction.test.js index 58a79c9cc2..9de92d234b 100644 --- a/Maths/test/LiouvilleFunction.test.js +++ b/Maths/test/LiouvilleFunction.test.js @@ -1,19 +1,32 @@ import { liouvilleFunction } from '../LiouvilleFunction' -const expectedValuesArray = [1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1] +const expectedValuesArray = [ + 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, + -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, + -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, + -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, + -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1 +] describe('Testing liouville function', () => { for (let i = 1; i <= 100; i++) { - it('Testing for number = ' + i + ', should return ' + expectedValuesArray[i], () => { - expect(liouvilleFunction(i)).toBe(expectedValuesArray[i - 1]) - }) + it( + 'Testing for number = ' + i + ', should return ' + expectedValuesArray[i], + () => { + expect(liouvilleFunction(i)).toBe(expectedValuesArray[i - 1]) + } + ) } it('should throw error when supplied negative numbers', () => { - expect(() => { liouvilleFunction(-1) }).toThrow(Error) + expect(() => { + liouvilleFunction(-1) + }).toThrow(Error) }) it('should throw error when supplied zero', () => { - expect(() => { liouvilleFunction(0) }).toThrow(Error) + expect(() => { + liouvilleFunction(0) + }).toThrow(Error) }) }) diff --git a/Maths/test/MidpointIntegration.test.js b/Maths/test/MidpointIntegration.test.js index 4e2d625780..6bf9da28ea 100644 --- a/Maths/test/MidpointIntegration.test.js +++ b/Maths/test/MidpointIntegration.test.js @@ -1,16 +1,22 @@ import { integralEvaluation } from '../MidpointIntegration' test('Should return the integral of f(x) = sqrt(x) in [1, 3] to be equal 2.797434', () => { - const result = integralEvaluation(10000, 1, 3, (x) => { return Math.sqrt(x) }) + const result = integralEvaluation(10000, 1, 3, (x) => { + return Math.sqrt(x) + }) expect(Number(result.toPrecision(6))).toBe(2.79743) }) test('Should return the integral of f(x) = sqrt(x) + x^2 in [1, 3] to be equal 11.46410161', () => { - const result = integralEvaluation(10000, 1, 3, (x) => { return Math.sqrt(x) + Math.pow(x, 2) }) + const result = integralEvaluation(10000, 1, 3, (x) => { + return Math.sqrt(x) + Math.pow(x, 2) + }) expect(Number(result.toPrecision(10))).toBe(11.46410161) }) test('Should return the integral of f(x) = log(x) + Pi*x^3 in [5, 12] to be equal 15809.9141543', () => { - const result = integralEvaluation(20000, 5, 12, (x) => { return Math.log(x) + Math.PI * Math.pow(x, 3) }) + const result = integralEvaluation(20000, 5, 12, (x) => { + return Math.log(x) + Math.PI * Math.pow(x, 3) + }) expect(Number(result.toPrecision(10))).toBe(15809.91415) }) diff --git a/Maths/test/MobiusFunction.test.js b/Maths/test/MobiusFunction.test.js index 78b87261c4..11de678212 100644 --- a/Maths/test/MobiusFunction.test.js +++ b/Maths/test/MobiusFunction.test.js @@ -1,19 +1,32 @@ import { mobiusFunction } from '../MobiusFunction' -const expectedValuesArray = [1, -1, -1, 0, -1, 1, -1, 0, 0, 1, -1, 0, -1, 1, 1, 0, -1, 0, -1, 0, 1, 1, -1, 0, 0, 1, 0, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, 1, 1, 0, -1, -1, -1, 0, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 1, 0, 1, 1, -1, 0, -1, 1, 0, 0, 1, -1, -1, 0, 1, -1, -1, 0, -1, 1, 0, 0, 1, -1, -1, 0, 0, 1, -1, 0, 1, 1, 1, 0, -1, 0, 1, 0, 1, 1, 1, 0, -1, 0, 0, 0] +const expectedValuesArray = [ + 1, -1, -1, 0, -1, 1, -1, 0, 0, 1, -1, 0, -1, 1, 1, 0, -1, 0, -1, 0, 1, 1, -1, + 0, 0, 1, 0, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, 1, 1, 0, -1, -1, -1, 0, 0, 1, + -1, 0, 0, 0, 1, 0, -1, 0, 1, 0, 1, 1, -1, 0, -1, 1, 0, 0, 1, -1, -1, 0, 1, -1, + -1, 0, -1, 1, 0, 0, 1, -1, -1, 0, 0, 1, -1, 0, 1, 1, 1, 0, -1, 0, 1, 0, 1, 1, + 1, 0, -1, 0, 0, 0 +] describe('Testing mobius function', () => { for (let i = 1; i <= 100; i++) { - it('Testing for number = ' + i + ', should return ' + expectedValuesArray[i], () => { - expect(mobiusFunction(i)).toBe(expectedValuesArray[i - 1]) - }) + it( + 'Testing for number = ' + i + ', should return ' + expectedValuesArray[i], + () => { + expect(mobiusFunction(i)).toBe(expectedValuesArray[i - 1]) + } + ) } it('should throw error when supplied negative numbers', () => { - expect(() => { mobiusFunction(-1) }).toThrow(Error) + expect(() => { + mobiusFunction(-1) + }).toThrow(Error) }) it('should throw error when supplied zero', () => { - expect(() => { mobiusFunction(0) }).toThrow(Error) + expect(() => { + mobiusFunction(0) + }).toThrow(Error) }) }) diff --git a/Maths/test/NumberOfDigits.test.js b/Maths/test/NumberOfDigits.test.js index bf832c8691..e3495eb9ea 100644 --- a/Maths/test/NumberOfDigits.test.js +++ b/Maths/test/NumberOfDigits.test.js @@ -14,7 +14,10 @@ describe('NumberOfDigits', () => { [123423232, 9], [-123423232, 9], [9999, 4] - ])('should return the correct number of digits in an integer', (value, expected) => { - expect(numberOfDigitsUsingLog(value)).toBe(expected) - }) + ])( + 'should return the correct number of digits in an integer', + (value, expected) => { + expect(numberOfDigitsUsingLog(value)).toBe(expected) + } + ) }) diff --git a/Maths/test/Palindrome.test.js b/Maths/test/Palindrome.test.js index a8310e0a26..76e3ada66b 100644 --- a/Maths/test/Palindrome.test.js +++ b/Maths/test/Palindrome.test.js @@ -1,4 +1,8 @@ -import { PalindromeRecursive, PalindromeIterative, checkPalindrome } from '../Palindrome' +import { + PalindromeRecursive, + PalindromeIterative, + checkPalindrome +} from '../Palindrome' describe('Palindrome', () => { it('should return true for a palindrome for PalindromeRecursive', () => { diff --git a/Maths/test/PermutationAndCombination.test.js b/Maths/test/PermutationAndCombination.test.js index 92fc576c19..0468366f36 100644 --- a/Maths/test/PermutationAndCombination.test.js +++ b/Maths/test/PermutationAndCombination.test.js @@ -1,4 +1,8 @@ -import { factorial, permutation, combination } from '../PermutationAndCombination' +import { + factorial, + permutation, + combination +} from '../PermutationAndCombination' describe('Factorial', () => { it('factorial(5)', () => { diff --git a/Maths/test/SieveOfEratosthenesIntArray.test.js b/Maths/test/SieveOfEratosthenesIntArray.test.js index eeb6dd9d8b..e3a3be3002 100644 --- a/Maths/test/SieveOfEratosthenesIntArray.test.js +++ b/Maths/test/SieveOfEratosthenesIntArray.test.js @@ -5,7 +5,7 @@ describe('should return an array of prime numbers', () => { it('should have each element in the array as a prime numbers', () => { const n = 100 const primes = sieveOfEratosthenes(n) - primes.forEach(prime => { + primes.forEach((prime) => { expect(PrimeCheck(prime)).toBeTruthy() }) }) diff --git a/Maths/test/SimpsonIntegration.test.js b/Maths/test/SimpsonIntegration.test.js index c5ebf6a837..97963614e2 100644 --- a/Maths/test/SimpsonIntegration.test.js +++ b/Maths/test/SimpsonIntegration.test.js @@ -1,16 +1,22 @@ import { integralEvaluation } from '../SimpsonIntegration' test('Should return the integral of f(x) = sqrt(x) in [1, 3] to be equal 2.797434', () => { - const result = integralEvaluation(16, 1, 3, (x) => { return Math.sqrt(x) }) + const result = integralEvaluation(16, 1, 3, (x) => { + return Math.sqrt(x) + }) expect(Number(result.toPrecision(7))).toBe(2.797434) }) test('Should return the integral of f(x) = sqrt(x) + x^2 in [1, 3] to be equal 11.46410161', () => { - const result = integralEvaluation(64, 1, 3, (x) => { return Math.sqrt(x) + Math.pow(x, 2) }) + const result = integralEvaluation(64, 1, 3, (x) => { + return Math.sqrt(x) + Math.pow(x, 2) + }) expect(Number(result.toPrecision(10))).toBe(11.46410161) }) test('Should return the integral of f(x) = log(x) + Pi*x^3 in [5, 12] to be equal 15809.9141543', () => { - const result = integralEvaluation(128, 5, 12, (x) => { return Math.log(x) + Math.PI * Math.pow(x, 3) }) + const result = integralEvaluation(128, 5, 12, (x) => { + return Math.log(x) + Math.PI * Math.pow(x, 3) + }) expect(Number(result.toPrecision(12))).toBe(15809.9141543) }) diff --git a/Maths/test/SumOfDigits.test.js b/Maths/test/SumOfDigits.test.js index c72ed26138..f73891d677 100644 --- a/Maths/test/SumOfDigits.test.js +++ b/Maths/test/SumOfDigits.test.js @@ -1,4 +1,8 @@ -import { sumOfDigitsUsingLoop, sumOfDigitsUsingRecursion, sumOfDigitsUsingString } from '../SumOfDigits' +import { + sumOfDigitsUsingLoop, + sumOfDigitsUsingRecursion, + sumOfDigitsUsingString +} from '../SumOfDigits' test('Testing on sumOfDigitsUsingLoop', () => { const sum = sumOfDigitsUsingLoop(123) diff --git a/Maths/test/WhileLoopFactorial.test.js b/Maths/test/WhileLoopFactorial.test.js index 6cec49f36d..1f8c9a8749 100644 --- a/Maths/test/WhileLoopFactorial.test.js +++ b/Maths/test/WhileLoopFactorial.test.js @@ -1,6 +1,6 @@ import { factorialize } from '../WhileLoopFactorial' -function testFactorial (n, expected) { +function testFactorial(n, expected) { test('Testing on ' + n + '!', () => { expect(factorialize(n)).toBe(expected) }) diff --git a/Maths/test/ZellersCongruenceAlgorithm.test.js b/Maths/test/ZellersCongruenceAlgorithm.test.js index 931a9348a0..0e0d30ec4b 100644 --- a/Maths/test/ZellersCongruenceAlgorithm.test.js +++ b/Maths/test/ZellersCongruenceAlgorithm.test.js @@ -1,6 +1,6 @@ import { zellersCongruenceAlgorithm } from '../ZellersCongruenceAlgorithm' -function testZeller (day, month, year, expected) { +function testZeller(day, month, year, expected) { test('Testing on ' + day + '/' + month + '/' + year, () => { expect(zellersCongruenceAlgorithm(day, month, year)).toBe(expected) }) diff --git a/Navigation/Haversine.js b/Navigation/Haversine.js index 7a6254a9dd..0013f2098b 100644 --- a/Navigation/Haversine.js +++ b/Navigation/Haversine.js @@ -8,24 +8,34 @@ * @return {Integer} Haversine Distance. * @see [Haversine_Distance](https://pt.wikipedia.org/wiki/F%C3%B3rmula_de_Haversine) */ -const haversineDistance = (latitude1 = 0, longitude1 = 0, latitude2 = 0, longitude2 = 0) => { +const haversineDistance = ( + latitude1 = 0, + longitude1 = 0, + latitude2 = 0, + longitude2 = 0 +) => { validateLatOrLong(latitude1) validateLatOrLong(latitude2) validateLatOrLong(longitude1) validateLatOrLong(longitude2) const earthRadius = 6371e3 // 6,371km const pi = Math.PI - const cos1 = latitude1 * pi / 180.0 - const cos2 = latitude2 * pi / 180.0 - const deltaLatitude = (latitude2 - latitude1) * pi / 180.0 - const deltaLongitude = (longitude2 - longitude1) * pi / 180.0 + const cos1 = (latitude1 * pi) / 180.0 + const cos2 = (latitude2 * pi) / 180.0 + const deltaLatitude = ((latitude2 - latitude1) * pi) / 180.0 + const deltaLongitude = ((longitude2 - longitude1) * pi) / 180.0 - const alpha = Math.sin(deltaLatitude / 2) * Math.sin(deltaLatitude / 2) + Math.cos(cos1) * Math.cos(cos2) * Math.sin(deltaLongitude / 2) * Math.sin(deltaLongitude / 2) + const alpha = + Math.sin(deltaLatitude / 2) * Math.sin(deltaLatitude / 2) + + Math.cos(cos1) * + Math.cos(cos2) * + Math.sin(deltaLongitude / 2) * + Math.sin(deltaLongitude / 2) const constant = 2 * Math.atan2(Math.sqrt(alpha), Math.sqrt(1 - alpha)) return earthRadius * constant } -const validateLatOrLong = value => { +const validateLatOrLong = (value) => { if (typeof value !== 'number') { throw new TypeError('The value of latitude or longitude should be a number') } diff --git a/Navigation/test/Haversine.test.js b/Navigation/test/Haversine.test.js index 3d89dcfda1..5448a6143a 100644 --- a/Navigation/test/Haversine.test.js +++ b/Navigation/test/Haversine.test.js @@ -2,10 +2,12 @@ import { haversineDistance } from '../Haversine' describe('Testing the haversine distance calculator', () => { it('Calculate distance', () => { - const distance = haversineDistance(64.1265, -21.8174, 40.7128, -74.0060) + const distance = haversineDistance(64.1265, -21.8174, 40.7128, -74.006) expect(distance).toBe(4208198.758424171) }) it('Test validation, expect throw', () => { - expect(() => haversineDistance(64.1265, -21.8174, 40.7128, '74.0060')).toThrow() + expect(() => + haversineDistance(64.1265, -21.8174, 40.7128, '74.0060') + ).toThrow() }) }) diff --git a/Project-Euler/Problem002.js b/Project-Euler/Problem002.js index 065a3a9f63..f1d4c3eee5 100644 --- a/Project-Euler/Problem002.js +++ b/Project-Euler/Problem002.js @@ -5,10 +5,14 @@ const PHI = (1 + SQ5) / 2 // definition of PHI // theoretically it should take O(1) constant amount of time as long // arithmetic calculations are considered to be in constant amount of time export const EvenFibonacci = (limit) => { - if (limit < 1) throw new Error('Fibonacci sequence limit can\'t be less than 1') + if (limit < 1) + throw new Error("Fibonacci sequence limit can't be less than 1") const highestIndex = Math.floor(Math.log(limit * SQ5) / Math.log(PHI)) const n = Math.floor(highestIndex / 3) - return Math.floor(((PHI ** (3 * n + 3) - 1) / (PHI ** 3 - 1) - - ((1 - PHI) ** (3 * n + 3) - 1) / ((1 - PHI) ** 3 - 1)) / SQ5) + return Math.floor( + ((PHI ** (3 * n + 3) - 1) / (PHI ** 3 - 1) - + ((1 - PHI) ** (3 * n + 3) - 1) / ((1 - PHI) ** 3 - 1)) / + SQ5 + ) } diff --git a/Project-Euler/Problem005.js b/Project-Euler/Problem005.js index 9b0020a754..fe8901c94c 100644 --- a/Project-Euler/Problem005.js +++ b/Project-Euler/Problem005.js @@ -6,7 +6,9 @@ What is the smallest positive number that is evenly divisible by all of the numb */ export const findSmallestMultiple = () => { - const divisors = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2] + const divisors = [ + 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2 + ] let num = 21 let result diff --git a/Project-Euler/Problem006.js b/Project-Euler/Problem006.js index 673202acf7..58f5e2fbc1 100644 --- a/Project-Euler/Problem006.js +++ b/Project-Euler/Problem006.js @@ -7,5 +7,5 @@ export const squareDifference = (num = 100) => { sumOfSquares += i ** 2 // add squares to the sum of squares sums += i // add number to sum to square later } - return (sums ** 2) - sumOfSquares // difference of square of the total sum and sum of squares + return sums ** 2 - sumOfSquares // difference of square of the total sum and sum of squares } diff --git a/Project-Euler/Problem008.js b/Project-Euler/Problem008.js index 5012dc3e50..66c50d12b9 100644 --- a/Project-Euler/Problem008.js +++ b/Project-Euler/Problem008.js @@ -6,7 +6,7 @@ const largestAdjacentNumber = (grid, consecutive) => { let largestProd = 0 for (const row in splitGrid) { - const currentRow = splitGrid[row].split('').map(x => Number(x)) + const currentRow = splitGrid[row].split('').map((x) => Number(x)) for (let i = 0; i < currentRow.length - consecutive; i++) { const combine = currentRow.slice(i, i + consecutive) diff --git a/Project-Euler/Problem009.js b/Project-Euler/Problem009.js index 60422f89e5..0ab5ae61d3 100644 --- a/Project-Euler/Problem009.js +++ b/Project-Euler/Problem009.js @@ -10,7 +10,8 @@ There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. */ -const isPythagoreanTriplet = (a, b, c) => Math.pow(a, 2) + Math.pow(b, 2) === Math.pow(c, 2) +const isPythagoreanTriplet = (a, b, c) => + Math.pow(a, 2) + Math.pow(b, 2) === Math.pow(c, 2) export const findSpecialPythagoreanTriplet = () => { for (let a = 0; a < 1000; a++) { diff --git a/Project-Euler/Problem011.js b/Project-Euler/Problem011.js index 190295c8ae..3f6c177db4 100644 --- a/Project-Euler/Problem011.js +++ b/Project-Euler/Problem011.js @@ -27,9 +27,9 @@ * * What is the greatest product of four adjacent numbers in the * same direction (up, down, left, right, or diagonally) in the 20×20 grid? -*/ + */ -export function largestProductInAGrid (arr) { +export function largestProductInAGrid(arr) { let max = 0 const k = 4 @@ -50,7 +50,7 @@ export function largestProductInAGrid (arr) { return max } -function get (arr, y, x) { +function get(arr, y, x) { if (y >= 0 && y < arr.length && x >= 0 && x < arr[y].length) { return arr[y][x] } diff --git a/Project-Euler/Problem012.js b/Project-Euler/Problem012.js index 9fb4ceb3b8..ec76bda4e4 100644 --- a/Project-Euler/Problem012.js +++ b/Project-Euler/Problem012.js @@ -20,7 +20,7 @@ * We can see that 28 is the first triangle number to have over five divisors. * * What is the value of the first triangle number to have over five hundred divisors? -*/ + */ /** * Gets number of divisors of a given number diff --git a/Project-Euler/Problem013.js b/Project-Euler/Problem013.js index da05cfd11e..8748a8ee17 100644 --- a/Project-Euler/Problem013.js +++ b/Project-Euler/Problem013.js @@ -1,8 +1,8 @@ /** * Work out the first ten digits of the sum of the following one-hundred 50-digit numbers. -*/ + */ -export function largeSum (bignum) { +export function largeSum(bignum) { const nums = [] for (let i = 0; i < bignum.length; i += 50) { nums.push(bignum.slice(i, i + 50)) @@ -13,11 +13,11 @@ export function largeSum (bignum) { let num = 0 while (pos--) { - for (let i = nums.length; i--;) { + for (let i = nums.length; i--; ) { num += +nums[i].charAt(pos) } - ret = num % 10 + ret - num = num / 10 | 0 + ret = (num % 10) + ret + num = (num / 10) | 0 } if (num > 0) { diff --git a/Project-Euler/Problem014.js b/Project-Euler/Problem014.js index d2d53fcfab..10556c5cb6 100644 --- a/Project-Euler/Problem014.js +++ b/Project-Euler/Problem014.js @@ -24,7 +24,7 @@ const getCollatzSequenceLength = (num, seqLength) => { if (num % 2 === 0) { newElement = num / 2 } else { - newElement = (3 * num) + 1 + newElement = 3 * num + 1 } seqLength++ return getCollatzSequenceLength(newElement, seqLength) diff --git a/Project-Euler/Problem015.js b/Project-Euler/Problem015.js index 1861376244..9e63c75705 100644 --- a/Project-Euler/Problem015.js +++ b/Project-Euler/Problem015.js @@ -9,7 +9,7 @@ How many such routes are there through a 20×20 grid? export const latticePath = (gridSize) => { let paths for (let i = 1, paths = 1; i <= gridSize; i++) { - paths = paths * (gridSize + i) / i + paths = (paths * (gridSize + i)) / i } // The total number of paths can be found using the binomial coefficient (b+a)/a. return paths diff --git a/Project-Euler/Problem017.js b/Project-Euler/Problem017.js index 14096b6ec6..65674188a4 100644 --- a/Project-Euler/Problem017.js +++ b/Project-Euler/Problem017.js @@ -51,7 +51,7 @@ const numberToWordLength = (n) => { */ if (n >= 20 && n < 100) { const unit = n % 10 - return tens[Math.floor(n / 10 - 2)] + ((unit !== 0) ? ones[unit] : 0) + return tens[Math.floor(n / 10 - 2)] + (unit !== 0 ? ones[unit] : 0) } // Find thousand, hundred and sub part diff --git a/Project-Euler/Problem018.js b/Project-Euler/Problem018.js index 43e8a9e629..6f57479b66 100644 --- a/Project-Euler/Problem018.js +++ b/Project-Euler/Problem018.js @@ -100,7 +100,10 @@ export const maxPathSum = function (grid = triangle) { * sub-problems in a recursive manner, this is called Dynamic Programming. */ - grid = grid.split(/\r\n|\n/).filter(l => l).map(r => r.split(' ').map(n => +n)) + grid = grid + .split(/\r\n|\n/) + .filter((l) => l) + .map((r) => r.split(' ').map((n) => +n)) for (let i = grid.length - 2; i >= 0; i--) { for (let j = 0; j < grid[i].length; j++) { diff --git a/Project-Euler/Problem021.js b/Project-Euler/Problem021.js index 34a5517bdf..dce2cd8a04 100644 --- a/Project-Euler/Problem021.js +++ b/Project-Euler/Problem021.js @@ -14,7 +14,7 @@ import { aliquotSum } from '../Maths/AliquotSum.js' * @author PraneethJain */ -function problem21 (n) { +function problem21(n) { if (n < 2) { throw new Error('Invalid Input') } diff --git a/Project-Euler/Problem023.js b/Project-Euler/Problem023.js index 32f35a8bff..2adda7b2eb 100644 --- a/Project-Euler/Problem023.js +++ b/Project-Euler/Problem023.js @@ -1,62 +1,65 @@ -/** - * Problem 23 - Non-Abundant Sums - * - * @see {@link https://projecteuler.net/problem=23} - * - * A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number. - * - * A number n is called deficient if the sum of its proper divisors is less than n and it is called abundant if this sum exceeds n. - * - * As 12 is the smallest abundant number, 1 + 2 + 3 + 4 + 6 = 16, the smallest number that can be written as the sum of two abundant numbers is 24. By mathematical analysis, it can be shown that all integers greater than 28123 can be written as the sum of two abundant numbers. However, this upper limit cannot be reduced any further by analysis even though it is known that the greatest number that cannot be expressed as the sum of two abundant numbers is less than this limit. - * - * Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers. - * - */ - -/** - * collect the abundant numbers, generate and store their sums with each other, and check for numbers not in the list of sums, adds them and returns their sum. - * @param {number} [n = 28123] - * @returns {number} - */ - -function sumOfNonAbundantNumbers (n = 28123) { - const abundantNumbers = [] // array to store the abundant numbers - const sumOfAbundantNumbers = {} // instead of an array, checking an object takes way less time. sets may be used as well. - let sum = 0 - - for (let i = 1; i <= n; i++) { - if (isAbundant(i)) { - abundantNumbers.push(i) // collect the abundant numbers - abundantNumbers.forEach(num => { // collect their sums - const sum = num + i - sumOfAbundantNumbers[sum] = true - }) - } - } - - for (let i = 1; i <= n; i++) { - if (!sumOfAbundantNumbers[i]) { // if the number is not found in the list of sums, then it is added - sum += i - } - } - - return sum -} - -/** - * generates the divisors of the number and checks if it is abundant - * @param {number} number - * @returns {bool} - */ - -function isAbundant (number) { - let sum = 0 - for (let i = 1; i <= number / 2; i++) { - if (number % i === 0) { // generate divisors - sum += i // calculate their sums - } - } - return sum > number -} - -export { sumOfNonAbundantNumbers } +/** + * Problem 23 - Non-Abundant Sums + * + * @see {@link https://projecteuler.net/problem=23} + * + * A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number. + * + * A number n is called deficient if the sum of its proper divisors is less than n and it is called abundant if this sum exceeds n. + * + * As 12 is the smallest abundant number, 1 + 2 + 3 + 4 + 6 = 16, the smallest number that can be written as the sum of two abundant numbers is 24. By mathematical analysis, it can be shown that all integers greater than 28123 can be written as the sum of two abundant numbers. However, this upper limit cannot be reduced any further by analysis even though it is known that the greatest number that cannot be expressed as the sum of two abundant numbers is less than this limit. + * + * Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers. + * + */ + +/** + * collect the abundant numbers, generate and store their sums with each other, and check for numbers not in the list of sums, adds them and returns their sum. + * @param {number} [n = 28123] + * @returns {number} + */ + +function sumOfNonAbundantNumbers(n = 28123) { + const abundantNumbers = [] // array to store the abundant numbers + const sumOfAbundantNumbers = {} // instead of an array, checking an object takes way less time. sets may be used as well. + let sum = 0 + + for (let i = 1; i <= n; i++) { + if (isAbundant(i)) { + abundantNumbers.push(i) // collect the abundant numbers + abundantNumbers.forEach((num) => { + // collect their sums + const sum = num + i + sumOfAbundantNumbers[sum] = true + }) + } + } + + for (let i = 1; i <= n; i++) { + if (!sumOfAbundantNumbers[i]) { + // if the number is not found in the list of sums, then it is added + sum += i + } + } + + return sum +} + +/** + * generates the divisors of the number and checks if it is abundant + * @param {number} number + * @returns {bool} + */ + +function isAbundant(number) { + let sum = 0 + for (let i = 1; i <= number / 2; i++) { + if (number % i === 0) { + // generate divisors + sum += i // calculate their sums + } + } + return sum > number +} + +export { sumOfNonAbundantNumbers } diff --git a/Project-Euler/Problem025.js b/Project-Euler/Problem025.js index 3934e23c96..8d88edf8ee 100644 --- a/Project-Euler/Problem025.js +++ b/Project-Euler/Problem025.js @@ -1,45 +1,46 @@ -/** -* Problem 25 - 1000-digit Fibonacci number -* -* @see {@link https://projecteuler.net/problem=25} -* -* The Fibonacci sequence is defined by the recurrence relation: -* -* Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1. -* -* Hence the first 12 terms will be: -* -* F1 = 1 -* F2 = 1 -* F3 = 2 -* F4 = 3 -* F5 = 5 -* F6 = 8 -* F7 = 13 -* F8 = 21 -* F9 = 34 -* F10 = 55 -* F11 = 89 -* F12 = 144 -* The 12th term, F12, is the first term to contain three digits. - -* What is the index of the first term in the Fibonacci sequence to contain 1000 digits? -*/ - -// brute force method - -function fibonacciIndex (t = 1000) { - const digits = 10n ** BigInt(t - 1) - let fib0 = BigInt(0) - let fib1 = BigInt(1) - let index = 1 - while (fib1 < digits) { // using this to compare number of digits instead of .toString() significantly improved run time - const tempfib = fib1 - fib1 = fib1 + fib0 - fib0 = tempfib - index += 1 - } - return (index) -} - -export { fibonacciIndex } +/** +* Problem 25 - 1000-digit Fibonacci number +* +* @see {@link https://projecteuler.net/problem=25} +* +* The Fibonacci sequence is defined by the recurrence relation: +* +* Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1. +* +* Hence the first 12 terms will be: +* +* F1 = 1 +* F2 = 1 +* F3 = 2 +* F4 = 3 +* F5 = 5 +* F6 = 8 +* F7 = 13 +* F8 = 21 +* F9 = 34 +* F10 = 55 +* F11 = 89 +* F12 = 144 +* The 12th term, F12, is the first term to contain three digits. + +* What is the index of the first term in the Fibonacci sequence to contain 1000 digits? +*/ + +// brute force method + +function fibonacciIndex(t = 1000) { + const digits = 10n ** BigInt(t - 1) + let fib0 = BigInt(0) + let fib1 = BigInt(1) + let index = 1 + while (fib1 < digits) { + // using this to compare number of digits instead of .toString() significantly improved run time + const tempfib = fib1 + fib1 = fib1 + fib0 + fib0 = tempfib + index += 1 + } + return index +} + +export { fibonacciIndex } diff --git a/Project-Euler/Problem028.js b/Project-Euler/Problem028.js index 998f0f2fb1..48d00e1f91 100644 --- a/Project-Euler/Problem028.js +++ b/Project-Euler/Problem028.js @@ -17,7 +17,7 @@ * @author ddaniel27 */ -function problem28 (dim) { +function problem28(dim) { if (dim % 2 === 0) { throw new Error('Dimension must be odd') } @@ -28,24 +28,24 @@ function problem28 (dim) { let result = 1 for (let i = 3; i <= dim; i += 2) { /** - * Adding more dimensions to the matrix, we will find at the top-right corner the follow sequence: - * 01, 09, 25, 49, 81, 121, 169, ... - * So this can be expressed as: - * i^2, where i is all odd numbers - * - * Also, we can know which numbers are in each corner dimension - * Just develop the sequence counter clockwise from top-right corner like this: - * First corner: i^2 - * Second corner: i^2 - (i - 1) | The "i - 1" is the distance between corners in each dimension - * Third corner: i^2 - 2 * (i - 1) - * Fourth corner: i^2 - 3 * (i - 1) - * - * Doing the sum of each corner and simplifying, we found that the result for each dimension is: - * sumDim = 4 * i^2 + 6 * (1 - i) - * - * In this case I skip the 1x1 dim matrix because is trivial, that's why I start in a 3x3 matrix - */ - result += (4 * i * i) + 6 * (1 - i) // Calculate sum of each dimension corner + * Adding more dimensions to the matrix, we will find at the top-right corner the follow sequence: + * 01, 09, 25, 49, 81, 121, 169, ... + * So this can be expressed as: + * i^2, where i is all odd numbers + * + * Also, we can know which numbers are in each corner dimension + * Just develop the sequence counter clockwise from top-right corner like this: + * First corner: i^2 + * Second corner: i^2 - (i - 1) | The "i - 1" is the distance between corners in each dimension + * Third corner: i^2 - 2 * (i - 1) + * Fourth corner: i^2 - 3 * (i - 1) + * + * Doing the sum of each corner and simplifying, we found that the result for each dimension is: + * sumDim = 4 * i^2 + 6 * (1 - i) + * + * In this case I skip the 1x1 dim matrix because is trivial, that's why I start in a 3x3 matrix + */ + result += 4 * i * i + 6 * (1 - i) // Calculate sum of each dimension corner } return result } diff --git a/Project-Euler/Problem035.js b/Project-Euler/Problem035.js index f422defcde..c877acba5a 100644 --- a/Project-Euler/Problem035.js +++ b/Project-Euler/Problem035.js @@ -11,18 +11,22 @@ */ import { sieveOfEratosthenes } from '../Maths/SieveOfEratosthenesIntArray' -function problem35 (n) { +function problem35(n) { if (n < 2) { throw new Error('Invalid input') } // Get a list of primes without 0, 2, 4, 5, 6, 8; this discards the circular primes 2 & 5 - const list = sieveOfEratosthenes(n).filter(prime => !prime.toString().match(/[024568]/)) + const list = sieveOfEratosthenes(n).filter( + (prime) => !prime.toString().match(/[024568]/) + ) const result = list.filter((number, _idx, arr) => { const str = String(number) - for (let i = 0; i < str.length; i++) { // Get all rotations of the number + for (let i = 0; i < str.length; i++) { + // Get all rotations of the number const rotation = str.slice(i) + str.slice(0, i) - if (!arr.includes(Number(rotation))) { // Check if the rotation is prime + if (!arr.includes(Number(rotation))) { + // Check if the rotation is prime return false } } diff --git a/Project-Euler/Problem044.js b/Project-Euler/Problem044.js index 04d531d569..7ffc0dbb6e 100644 --- a/Project-Euler/Problem044.js +++ b/Project-Euler/Problem044.js @@ -11,18 +11,19 @@ * @author ddaniel27 */ -function problem44 (k) { +function problem44(k) { if (k < 1) { throw new Error('Invalid Input') } while (true) { k++ - const n = k * (3 * k - 1) / 2 // calculate Pk + const n = (k * (3 * k - 1)) / 2 // calculate Pk for (let j = k - 1; j > 0; j--) { - const m = j * (3 * j - 1) / 2 // calculate all Pj < Pk - if (isPentagonal(n - m) && isPentagonal(n + m)) { // Check sum and difference + const m = (j * (3 * j - 1)) / 2 // calculate all Pj < Pk + if (isPentagonal(n - m) && isPentagonal(n + m)) { + // Check sum and difference return n - m // return D } } @@ -36,7 +37,7 @@ function problem44 (k) { * @see {@link https://en.wikipedia.org/wiki/Quadratic_function} */ -function isPentagonal (n) { +function isPentagonal(n) { const pent = (Math.sqrt(24 * n + 1) + 1) / 6 return pent === Math.floor(pent) } diff --git a/Project-Euler/test/Problem001.test.js b/Project-Euler/test/Problem001.test.js index e6b5549a57..22f7628d6a 100644 --- a/Project-Euler/test/Problem001.test.js +++ b/Project-Euler/test/Problem001.test.js @@ -2,10 +2,14 @@ import { multiplesThreeAndFive } from '../Problem001.js' describe('Sum of multiples of 3 or 5', () => { it('should throw error when number is negative number', () => { - expect(() => multiplesThreeAndFive(-24)).toThrowError('No natural numbers exist below 1') + expect(() => multiplesThreeAndFive(-24)).toThrowError( + 'No natural numbers exist below 1' + ) }) it('should throw error when number is 0', () => { - expect(() => multiplesThreeAndFive(0)).toThrowError('No natural numbers exist below 1') + expect(() => multiplesThreeAndFive(0)).toThrowError( + 'No natural numbers exist below 1' + ) }) test('if the number is greater than 0', () => { expect(multiplesThreeAndFive(10)).toBe(23) diff --git a/Project-Euler/test/Problem002.test.js b/Project-Euler/test/Problem002.test.js index bccd770b4c..375a867e9d 100644 --- a/Project-Euler/test/Problem002.test.js +++ b/Project-Euler/test/Problem002.test.js @@ -2,7 +2,9 @@ import { EvenFibonacci } from '../Problem002' describe('Even Fibonacci numbers', () => { it('should throw error when limit is less than 1', () => { - expect(() => EvenFibonacci(-1)).toThrowError('Fibonacci sequence limit can\'t be less than 1') + expect(() => EvenFibonacci(-1)).toThrowError( + "Fibonacci sequence limit can't be less than 1" + ) }) test('when limit is greater than 0', () => { expect(EvenFibonacci(40)).toBe(44) diff --git a/Project-Euler/test/Problem011.test.js b/Project-Euler/test/Problem011.test.js index 921d1c7c39..3f86dd1d48 100644 --- a/Project-Euler/test/Problem011.test.js +++ b/Project-Euler/test/Problem011.test.js @@ -2,24 +2,56 @@ import { largestProductInAGrid } from '../Problem011.js' const arr = [ [8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8], - [49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 0], - [81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65], + [ + 49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 0 + ], + [ + 81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, + 65 + ], [52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, 56, 1, 32, 56, 71, 37, 2, 36, 91], - [22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, 80], - [24, 47, 32, 60, 99, 3, 45, 2, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50], - [32, 98, 81, 28, 64, 23, 67, 10, 26, 38, 40, 67, 59, 54, 70, 66, 18, 38, 64, 70], - [67, 26, 20, 68, 2, 62, 12, 20, 95, 63, 94, 39, 63, 8, 40, 91, 66, 49, 94, 21], - [24, 55, 58, 5, 66, 73, 99, 26, 97, 17, 78, 78, 96, 83, 14, 88, 34, 89, 63, 72], + [ + 22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, + 80 + ], + [ + 24, 47, 32, 60, 99, 3, 45, 2, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50 + ], + [ + 32, 98, 81, 28, 64, 23, 67, 10, 26, 38, 40, 67, 59, 54, 70, 66, 18, 38, 64, + 70 + ], + [ + 67, 26, 20, 68, 2, 62, 12, 20, 95, 63, 94, 39, 63, 8, 40, 91, 66, 49, 94, 21 + ], + [ + 24, 55, 58, 5, 66, 73, 99, 26, 97, 17, 78, 78, 96, 83, 14, 88, 34, 89, 63, + 72 + ], [21, 36, 23, 9, 75, 0, 76, 44, 20, 45, 35, 14, 0, 61, 33, 97, 34, 31, 33, 95], [78, 17, 53, 28, 22, 75, 31, 67, 15, 94, 3, 80, 4, 62, 16, 14, 9, 53, 56, 92], - [16, 39, 5, 42, 96, 35, 31, 47, 55, 58, 88, 24, 0, 17, 54, 24, 36, 29, 85, 57], + [ + 16, 39, 5, 42, 96, 35, 31, 47, 55, 58, 88, 24, 0, 17, 54, 24, 36, 29, 85, 57 + ], [86, 56, 0, 48, 35, 71, 89, 7, 5, 44, 44, 37, 44, 60, 21, 58, 51, 54, 17, 58], - [19, 80, 81, 68, 5, 94, 47, 69, 28, 73, 92, 13, 86, 52, 17, 77, 4, 89, 55, 40], + [ + 19, 80, 81, 68, 5, 94, 47, 69, 28, 73, 92, 13, 86, 52, 17, 77, 4, 89, 55, 40 + ], [4, 52, 8, 83, 97, 35, 99, 16, 7, 97, 57, 32, 16, 26, 26, 79, 33, 27, 98, 66], - [88, 36, 68, 87, 57, 62, 20, 72, 3, 46, 33, 67, 46, 55, 12, 32, 63, 93, 53, 69], - [4, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 8, 46, 29, 32, 40, 62, 76, 36], - [20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 4, 36, 16], - [20, 73, 35, 29, 78, 31, 90, 1, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 5, 54], + [ + 88, 36, 68, 87, 57, 62, 20, 72, 3, 46, 33, 67, 46, 55, 12, 32, 63, 93, 53, + 69 + ], + [ + 4, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 8, 46, 29, 32, 40, 62, 76, 36 + ], + [ + 20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 4, 36, + 16 + ], + [ + 20, 73, 35, 29, 78, 31, 90, 1, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 5, 54 + ], [1, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 1, 89, 19, 67, 48] ] diff --git a/Project-Euler/test/Problem013.test.js b/Project-Euler/test/Problem013.test.js index aaba114d77..7996ee1f29 100644 --- a/Project-Euler/test/Problem013.test.js +++ b/Project-Euler/test/Problem013.test.js @@ -1,6 +1,7 @@ import { largeSum } from '../Problem013.js' -const bignum = '37107287533902102798797998220837590246510135740250463769376774900097126481248969700780504170182605387432498619952474105947423330951305812372661730962991942213363574161572522430563301811072406154908250230675882075393461711719803104210475137780632466768926167069662363382013637841838368417873436172675728112879812849979408065481931592621691275889832738442742289174325203219235894228767964876702721893184745144573600130643909116721685684458871160315327670386486105843025439939619828917593665686757934951621764571418565606295021572231965867550793241933316490635246274190492910143244581382266334794475817892575867718337217661963751590579239728245598838407582035653253593990084026335689488301894586282278288018119938482628201427819413994056758715117009439035398664372827112653829987240784473053190104293586865155060062958648615320752733719591914205172558297169388870771546649911559348760353292171497005693854370070576826684624621495650076471787294438377604532826541087568284431911906346940378552177792951453612327252500029607107508256381565671088525835072145876576172410976447339110607218265236877223636045174237069058518606604482076212098132878607339694128114266041808683061932846081119106155694051268969251934325451728388641918047049293215058642563049483624672216484350762017279180399446930047329563406911573244438690812579451408905770622942919710792820955037687525678773091862540744969844508330393682126183363848253301546861961243487676812975343759465158038628759287849020152168555482871720121925776695478182833757993103614740356856449095527097864797581167263201004368978425535399209318374414978068609844840309812907779179908821879532736447567559084803087086987551392711854517078544161852424320693150332599594068957565367821070749269665376763262354472106979395067965269474259770973916669376304263398708541052684708299085211399427365734116182760315001271653786073615010808570091499395125570281987460043753582903531743471732693212357815498262974255273730794953759765105305946966067683156574377167401875275889028025717332296191766687138199318110487701902712526768027607800301367868099252546340106163286652636270218540497705585629946580636237993140746255962240744869082311749777923654662572469233228109171419143028819710328859780666976089293863828502533340334413065578016127815921815005561868836468420090470230530811728164304876237919698424872550366387845831148769693215490281042402013833512446218144177347063783299490636259666498587618221225225512486764533677201869716985443124195724099139590089523100588229554825530026352078153229679624948164195386821877476085327132285723110424803456124867697064507995236377742425354112916842768655389262050249103265729672370191327572567528565324825826546309220705859652229798860272258331913126375147341994889534765745501184957014548792889848568277260777137214037988797153829820378303147352772158034814451349137322665138134829543829199918180278916522431027392251122869539409579530664052326325380441000596549391598795936352974615218550237130764225512118369380358038858490341698116222072977186158236678424689157993532961922624679571944012690438771072750481023908955235974572318970677254791506150550495392297953090112996751986188088225875314529584099251203829009407770775672113067397083047244838165338735023408456470580773088295917476714036319800818712901187549131054712658197623331044818386269515456334926366572897563400500428462801835170705278318394258821455212272512503275512160354698120058176216521282765275169129689778932238195734329339946437501907836945765883352399886755061649651847751807381688378610915273579297013376217784275219262340194239963916804498399317331273132924185707147349566916674687634660915035914677504995186714302352196288948901024233251169136196266227326746080059154747183079839286853520694694454072476841822524674417161514036427982273348055556214818971426179103425986472045168939894221798260880768528778364618279934631376775430780936333301898264209010848802521674670883215120185883543223812876952786713296124747824645386369930090493103636197638780396218407357239979422340623539380833965132740801111666627891981488087797941876876144230030984490851411606618262936828367647447792391803351109890697907148578694408955299065364044742557608365997664579509666024396409905389607120198219976047599490197230297649139826800329731560371200413779037855660850892521673093931987275027546890690370753941304265231501194809377245048795150954100921645863754710598436791786391670211874924319957006419179697775990283006991536871371193661495281130587638027841075444973307840789923115535562561142322423255033685442488917353448899115014406480203690680639606723221932041495354150312888033953605329934036800697771065056663195481234880673210146739058568557934581403627822703280826165707739483275922328459417065250945123252306082291880205877731971983945018088807242966198081119777158542502016545090413245809786882778948721859617721078384350691861554356628840622574736922845095162084960398013400172393067166682355524525280460972253503534226472524250874054075591789781264330331690' +const bignum = + '37107287533902102798797998220837590246510135740250463769376774900097126481248969700780504170182605387432498619952474105947423330951305812372661730962991942213363574161572522430563301811072406154908250230675882075393461711719803104210475137780632466768926167069662363382013637841838368417873436172675728112879812849979408065481931592621691275889832738442742289174325203219235894228767964876702721893184745144573600130643909116721685684458871160315327670386486105843025439939619828917593665686757934951621764571418565606295021572231965867550793241933316490635246274190492910143244581382266334794475817892575867718337217661963751590579239728245598838407582035653253593990084026335689488301894586282278288018119938482628201427819413994056758715117009439035398664372827112653829987240784473053190104293586865155060062958648615320752733719591914205172558297169388870771546649911559348760353292171497005693854370070576826684624621495650076471787294438377604532826541087568284431911906346940378552177792951453612327252500029607107508256381565671088525835072145876576172410976447339110607218265236877223636045174237069058518606604482076212098132878607339694128114266041808683061932846081119106155694051268969251934325451728388641918047049293215058642563049483624672216484350762017279180399446930047329563406911573244438690812579451408905770622942919710792820955037687525678773091862540744969844508330393682126183363848253301546861961243487676812975343759465158038628759287849020152168555482871720121925776695478182833757993103614740356856449095527097864797581167263201004368978425535399209318374414978068609844840309812907779179908821879532736447567559084803087086987551392711854517078544161852424320693150332599594068957565367821070749269665376763262354472106979395067965269474259770973916669376304263398708541052684708299085211399427365734116182760315001271653786073615010808570091499395125570281987460043753582903531743471732693212357815498262974255273730794953759765105305946966067683156574377167401875275889028025717332296191766687138199318110487701902712526768027607800301367868099252546340106163286652636270218540497705585629946580636237993140746255962240744869082311749777923654662572469233228109171419143028819710328859780666976089293863828502533340334413065578016127815921815005561868836468420090470230530811728164304876237919698424872550366387845831148769693215490281042402013833512446218144177347063783299490636259666498587618221225225512486764533677201869716985443124195724099139590089523100588229554825530026352078153229679624948164195386821877476085327132285723110424803456124867697064507995236377742425354112916842768655389262050249103265729672370191327572567528565324825826546309220705859652229798860272258331913126375147341994889534765745501184957014548792889848568277260777137214037988797153829820378303147352772158034814451349137322665138134829543829199918180278916522431027392251122869539409579530664052326325380441000596549391598795936352974615218550237130764225512118369380358038858490341698116222072977186158236678424689157993532961922624679571944012690438771072750481023908955235974572318970677254791506150550495392297953090112996751986188088225875314529584099251203829009407770775672113067397083047244838165338735023408456470580773088295917476714036319800818712901187549131054712658197623331044818386269515456334926366572897563400500428462801835170705278318394258821455212272512503275512160354698120058176216521282765275169129689778932238195734329339946437501907836945765883352399886755061649651847751807381688378610915273579297013376217784275219262340194239963916804498399317331273132924185707147349566916674687634660915035914677504995186714302352196288948901024233251169136196266227326746080059154747183079839286853520694694454072476841822524674417161514036427982273348055556214818971426179103425986472045168939894221798260880768528778364618279934631376775430780936333301898264209010848802521674670883215120185883543223812876952786713296124747824645386369930090493103636197638780396218407357239979422340623539380833965132740801111666627891981488087797941876876144230030984490851411606618262936828367647447792391803351109890697907148578694408955299065364044742557608365997664579509666024396409905389607120198219976047599490197230297649139826800329731560371200413779037855660850892521673093931987275027546890690370753941304265231501194809377245048795150954100921645863754710598436791786391670211874924319957006419179697775990283006991536871371193661495281130587638027841075444973307840789923115535562561142322423255033685442488917353448899115014406480203690680639606723221932041495354150312888033953605329934036800697771065056663195481234880673210146739058568557934581403627822703280826165707739483275922328459417065250945123252306082291880205877731971983945018088807242966198081119777158542502016545090413245809786882778948721859617721078384350691861554356628840622574736922845095162084960398013400172393067166682355524525280460972253503534226472524250874054075591789781264330331690' describe('checking Large Sum', () => { // Project Euler Condition Check diff --git a/Project-Euler/test/Problem017.test.js b/Project-Euler/test/Problem017.test.js index 3688d7bb60..9310faa33a 100644 --- a/Project-Euler/test/Problem017.test.js +++ b/Project-Euler/test/Problem017.test.js @@ -1,7 +1,11 @@ import { countNumberWordLength } from '../Problem017.js' describe('Number letter count', () => { - test.each([[5, 19], [100, 864], [1000, 21124]])('Number letter count from 1 to %i', (n, expected) => { + test.each([ + [5, 19], + [100, 864], + [1000, 21124] + ])('Number letter count from 1 to %i', (n, expected) => { expect(countNumberWordLength(n)).toBe(expected) }) diff --git a/Project-Euler/test/Problem023.test.js b/Project-Euler/test/Problem023.test.js index 67a2302623..a62c4d8c42 100644 --- a/Project-Euler/test/Problem023.test.js +++ b/Project-Euler/test/Problem023.test.js @@ -1,23 +1,23 @@ -import { sumOfNonAbundantNumbers } from '../Problem023' - -describe('Check Problem 23 - Non-Abundant Sums', () => { - it('Sum of all positive integers <= 10000 which cannot be written as the sum of two abundant numbers', () => { - expect(sumOfNonAbundantNumbers(10000)).toBe(3731004) - }) - - it('Sum of all positive integers <= n which cannot be written as the sum of two abundant numbers', () => { - expect(sumOfNonAbundantNumbers(15000)).toBe(4039939) - }) - - it('Sum of all positive integers <= n which cannot be written as the sum of two abundant numbers', () => { - expect(sumOfNonAbundantNumbers(20000)).toBe(4159710) - }) - - it('Sum of all positive integers <= n which cannot be written as the sum of two abundant numbers', () => { - expect(sumOfNonAbundantNumbers(28123)).toBe(4179871) - }) - - it('Sum of all positive integers <= n which cannot be written as the sum of two abundant numbers', () => { - expect(sumOfNonAbundantNumbers(30000)).toBe(4179871) - }) -}) +import { sumOfNonAbundantNumbers } from '../Problem023' + +describe('Check Problem 23 - Non-Abundant Sums', () => { + it('Sum of all positive integers <= 10000 which cannot be written as the sum of two abundant numbers', () => { + expect(sumOfNonAbundantNumbers(10000)).toBe(3731004) + }) + + it('Sum of all positive integers <= n which cannot be written as the sum of two abundant numbers', () => { + expect(sumOfNonAbundantNumbers(15000)).toBe(4039939) + }) + + it('Sum of all positive integers <= n which cannot be written as the sum of two abundant numbers', () => { + expect(sumOfNonAbundantNumbers(20000)).toBe(4159710) + }) + + it('Sum of all positive integers <= n which cannot be written as the sum of two abundant numbers', () => { + expect(sumOfNonAbundantNumbers(28123)).toBe(4179871) + }) + + it('Sum of all positive integers <= n which cannot be written as the sum of two abundant numbers', () => { + expect(sumOfNonAbundantNumbers(30000)).toBe(4179871) + }) +}) diff --git a/Project-Euler/test/Problem025.test.js b/Project-Euler/test/Problem025.test.js index cea11e9471..3e5090a027 100644 --- a/Project-Euler/test/Problem025.test.js +++ b/Project-Euler/test/Problem025.test.js @@ -1,27 +1,27 @@ -import { fibonacciIndex } from '../Problem025' - -describe('Check Problem 25 - 1000 digit Fibonnaci number', () => { - it('First term of the Fibonnaci sequence containing 3 digits', () => { - expect(fibonacciIndex(3)).toBe(12) - }) - - it('First term of the Fibonnaci sequence containing 10 digits', () => { - expect(fibonacciIndex(10)).toBe(45) - }) - - it('First term of the Fibonnaci sequence containing 50 digits', () => { - expect(fibonacciIndex(50)).toBe(237) - }) - - it('First term of the Fibonnaci sequence containing 100 digits', () => { - expect(fibonacciIndex(100)).toBe(476) - }) - - it('First term of the Fibonnaci sequence containing 1000 digits', () => { - expect(fibonacciIndex(1000)).toBe(4782) - }) - - it('First term of the Fibonnaci sequence containing 10000 digits', () => { - expect(fibonacciIndex(10000)).toBe(47847) - }) -}) +import { fibonacciIndex } from '../Problem025' + +describe('Check Problem 25 - 1000 digit Fibonnaci number', () => { + it('First term of the Fibonnaci sequence containing 3 digits', () => { + expect(fibonacciIndex(3)).toBe(12) + }) + + it('First term of the Fibonnaci sequence containing 10 digits', () => { + expect(fibonacciIndex(10)).toBe(45) + }) + + it('First term of the Fibonnaci sequence containing 50 digits', () => { + expect(fibonacciIndex(50)).toBe(237) + }) + + it('First term of the Fibonnaci sequence containing 100 digits', () => { + expect(fibonacciIndex(100)).toBe(476) + }) + + it('First term of the Fibonnaci sequence containing 1000 digits', () => { + expect(fibonacciIndex(1000)).toBe(4782) + }) + + it('First term of the Fibonnaci sequence containing 10000 digits', () => { + expect(fibonacciIndex(10000)).toBe(47847) + }) +}) diff --git a/Project-Euler/test/Problem044.test.js b/Project-Euler/test/Problem044.test.js index e1eeae0e6c..b3522a7884 100644 --- a/Project-Euler/test/Problem044.test.js +++ b/Project-Euler/test/Problem044.test.js @@ -12,8 +12,7 @@ describe('checking nth prime number', () => { expect(problem44(1)).toBe(5482660) }) // Project Euler Second Value for Condition Check - // Skipping this by default as it makes CI runs take way too long - test.skip('if the number is greater or equal to 2167', () => { + test('if the number is greater or equal to 2167', () => { expect(problem44(2167)).toBe(8476206790) }) }) diff --git a/README.md b/README.md index 6db1c2266a..f6633bab06 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,17 @@ # The Algorithms - JavaScript + JavaScript Repository of TheAlgorithms, which implements various algorithms and data structures in JavaScript.
- [![JavaScript Banner][banner]](DIRECTORY.md) +[![JavaScript Banner][banner]](DIRECTORY.md) - [![Checks][checks]][actions] - [![Contributions Welcome][welcome]](CONTRIBUTING.md) - [![standard.js][standard-logo]][standard-js] - [![Discord chat][chat]][discord-server] +[![Checks][checks]][actions] +[![Contributions Welcome][welcome]](CONTRIBUTING.md) +[![standard.js][standard-logo]][standard-js] +[![Discord chat][chat]][discord-server]
@@ -39,15 +40,18 @@ many of the algorithms can be found in the [wiki][explanation]. --- + [banner]: https://user-images.githubusercontent.com/68542775/167072911-dc31eac8-6885-4a05-9c25-279ecce22a79.png + [standard-logo]: https://img.shields.io/badge/code%20style-standardjs-%23f3df49 [chat]: https://img.shields.io/discord/808045925556682782.svg?logo=discord&colorB=7289DA [welcome]: https://img.shields.io/static/v1.svg?label=Contributions&message=Welcome&color=0059b3 [checks]: https://img.shields.io/github/actions/workflow/status/TheAlgorithms/JavaScript/Ci.yml?branch=master&label=checks + [standard-js]: https://standardjs.com/ [discord-server]: https://the-algorithms.com/discord/ [actions]: https://github.com/TheAlgorithms/JavaScript/actions diff --git a/Recursive/EucledianGCD.js b/Recursive/EucledianGCD.js index 9f4c4a79a0..e0cc15ed56 100644 --- a/Recursive/EucledianGCD.js +++ b/Recursive/EucledianGCD.js @@ -1,4 +1,4 @@ -function euclideanGCDRecursive (first, second) { +function euclideanGCDRecursive(first, second) { /* Calculates GCD of two numbers using Euclidean Recursive Algorithm :param first: First number @@ -8,11 +8,11 @@ function euclideanGCDRecursive (first, second) { if (second === 0) { return first } else { - return euclideanGCDRecursive(second, (first % second)) + return euclideanGCDRecursive(second, first % second) } } -function euclideanGCDIterative (first, second) { +function euclideanGCDIterative(first, second) { /* Calculates GCD of two numbers using Euclidean Iterative Algorithm :param first: First number diff --git a/Recursive/FloodFill.js b/Recursive/FloodFill.js index b2916d9af0..33ea6025ad 100644 --- a/Recursive/FloodFill.js +++ b/Recursive/FloodFill.js @@ -1,103 +1,132 @@ -/** - * Flood fill. - * - * Flood fill, also called seed fill, is an algorithm that determines and alters the area connected to a given node in a - * multi-dimensional array with some matching attribute. It is used in the "bucket" fill tool of paint programs to fill - * connected, similarly-colored areas with a different color. - * - * (description adapted from https://en.wikipedia.org/wiki/Flood_fill) - * @see https://www.techiedelight.com/flood-fill-algorithm/ - */ - -const neighbors = [[-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 1], [1, -1], [1, 0], [1, 1]] - -/** - * Implements the flood fill algorithm through a breadth-first approach using a queue. - * - * @param rgbData The image to which the algorithm is applied. - * @param location The start location on the image. - * @param targetColor The old color to be replaced. - * @param replacementColor The new color to replace the old one. - */ -export function breadthFirstSearch (rgbData, location, targetColor, replacementColor) { - if (location[0] < 0 || - location[0] >= rgbData.length || - location[1] < 0 || - location[1] >= rgbData[0].length) { - throw new Error('location should point to a pixel within the rgbData') - } - - const queue = [] - queue.push(location) - - while (queue.length > 0) { - breadthFirstFill(rgbData, location, targetColor, replacementColor, queue) - } -} - -/** - * Implements the flood fill algorithm through a depth-first approach using recursion. - * - * @param rgbData The image to which the algorithm is applied. - * @param location The start location on the image. - * @param targetColor The old color to be replaced. - * @param replacementColor The new color to replace the old one. - */ -export function depthFirstSearch (rgbData, location, targetColor, replacementColor) { - if (location[0] < 0 || - location[0] >= rgbData.length || - location[1] < 0 || - location[1] >= rgbData[0].length) { - throw new Error('location should point to a pixel within the rgbData') - } - - depthFirstFill(rgbData, location, targetColor, replacementColor) -} - -/** - * Utility-function to implement the breadth-first loop. - * - * @param rgbData The image to which the algorithm is applied. - * @param location The start location on the image. - * @param targetColor The old color to be replaced. - * @param replacementColor The new color to replace the old one. - * @param queue The locations that still need to be visited. - */ -function breadthFirstFill (rgbData, location, targetColor, replacementColor, queue) { - const currentLocation = queue[0] - queue.shift() - - if (rgbData[currentLocation[0]][currentLocation[1]] === targetColor) { - rgbData[currentLocation[0]][currentLocation[1]] = replacementColor - - for (let i = 0; i < neighbors.length; i++) { - const x = currentLocation[0] + neighbors[i][0] - const y = currentLocation[1] + neighbors[i][1] - if (x >= 0 && x < rgbData.length && y >= 0 && y < rgbData[0].length) { - queue.push([x, y]) - } - } - } -} - -/** - * Utility-function to implement the depth-first loop. - * - * @param rgbData The image to which the algorithm is applied. - * @param location The start location on the image. - * @param targetColor The old color to be replaced. - * @param replacementColor The new color to replace the old one. - */ -function depthFirstFill (rgbData, location, targetColor, replacementColor) { - if (rgbData[location[0]][location[1]] === targetColor) { - rgbData[location[0]][location[1]] = replacementColor - - for (let i = 0; i < neighbors.length; i++) { - const x = location[0] + neighbors[i][0] - const y = location[1] + neighbors[i][1] - if (x >= 0 && x < rgbData.length && y >= 0 && y < rgbData[0].length) { - depthFirstFill(rgbData, [x, y], targetColor, replacementColor) - } - } - } -} +/** + * Flood fill. + * + * Flood fill, also called seed fill, is an algorithm that determines and alters the area connected to a given node in a + * multi-dimensional array with some matching attribute. It is used in the "bucket" fill tool of paint programs to fill + * connected, similarly-colored areas with a different color. + * + * (description adapted from https://en.wikipedia.org/wiki/Flood_fill) + * @see https://www.techiedelight.com/flood-fill-algorithm/ + */ + +const neighbors = [ + [-1, -1], + [-1, 0], + [-1, 1], + [0, -1], + [0, 1], + [1, -1], + [1, 0], + [1, 1] +] + +/** + * Implements the flood fill algorithm through a breadth-first approach using a queue. + * + * @param rgbData The image to which the algorithm is applied. + * @param location The start location on the image. + * @param targetColor The old color to be replaced. + * @param replacementColor The new color to replace the old one. + */ +export function breadthFirstSearch( + rgbData, + location, + targetColor, + replacementColor +) { + if ( + location[0] < 0 || + location[0] >= rgbData.length || + location[1] < 0 || + location[1] >= rgbData[0].length + ) { + throw new Error('location should point to a pixel within the rgbData') + } + + const queue = [] + queue.push(location) + + while (queue.length > 0) { + breadthFirstFill(rgbData, location, targetColor, replacementColor, queue) + } +} + +/** + * Implements the flood fill algorithm through a depth-first approach using recursion. + * + * @param rgbData The image to which the algorithm is applied. + * @param location The start location on the image. + * @param targetColor The old color to be replaced. + * @param replacementColor The new color to replace the old one. + */ +export function depthFirstSearch( + rgbData, + location, + targetColor, + replacementColor +) { + if ( + location[0] < 0 || + location[0] >= rgbData.length || + location[1] < 0 || + location[1] >= rgbData[0].length + ) { + throw new Error('location should point to a pixel within the rgbData') + } + + depthFirstFill(rgbData, location, targetColor, replacementColor) +} + +/** + * Utility-function to implement the breadth-first loop. + * + * @param rgbData The image to which the algorithm is applied. + * @param location The start location on the image. + * @param targetColor The old color to be replaced. + * @param replacementColor The new color to replace the old one. + * @param queue The locations that still need to be visited. + */ +function breadthFirstFill( + rgbData, + location, + targetColor, + replacementColor, + queue +) { + const currentLocation = queue[0] + queue.shift() + + if (rgbData[currentLocation[0]][currentLocation[1]] === targetColor) { + rgbData[currentLocation[0]][currentLocation[1]] = replacementColor + + for (let i = 0; i < neighbors.length; i++) { + const x = currentLocation[0] + neighbors[i][0] + const y = currentLocation[1] + neighbors[i][1] + if (x >= 0 && x < rgbData.length && y >= 0 && y < rgbData[0].length) { + queue.push([x, y]) + } + } + } +} + +/** + * Utility-function to implement the depth-first loop. + * + * @param rgbData The image to which the algorithm is applied. + * @param location The start location on the image. + * @param targetColor The old color to be replaced. + * @param replacementColor The new color to replace the old one. + */ +function depthFirstFill(rgbData, location, targetColor, replacementColor) { + if (rgbData[location[0]][location[1]] === targetColor) { + rgbData[location[0]][location[1]] = replacementColor + + for (let i = 0; i < neighbors.length; i++) { + const x = location[0] + neighbors[i][0] + const y = location[1] + neighbors[i][1] + if (x >= 0 && x < rgbData.length && y >= 0 && y < rgbData[0].length) { + depthFirstFill(rgbData, [x, y], targetColor, replacementColor) + } + } + } +} diff --git a/Recursive/KochSnowflake.js b/Recursive/KochSnowflake.js index 48d3e91296..7b104da6e4 100644 --- a/Recursive/KochSnowflake.js +++ b/Recursive/KochSnowflake.js @@ -15,7 +15,7 @@ /** Class to handle the vector calculations. */ export class Vector2 { - constructor (x, y) { + constructor(x, y) { this.x = x this.y = y } @@ -26,7 +26,7 @@ export class Vector2 { * @param vector The vector to be added. * @returns The sum-vector. */ - add (vector) { + add(vector) { const x = this.x + vector.x const y = this.y + vector.y return new Vector2(x, y) @@ -38,7 +38,7 @@ export class Vector2 { * @param vector The vector to be subtracted. * @returns The difference-vector. */ - subtract (vector) { + subtract(vector) { const x = this.x - vector.x const y = this.y - vector.y return new Vector2(x, y) @@ -50,7 +50,7 @@ export class Vector2 { * @param scalar The factor by which to multiply the vector. * @returns The scaled vector. */ - multiply (scalar) { + multiply(scalar) { const x = this.x * scalar const y = this.y * scalar return new Vector2(x, y) @@ -62,8 +62,8 @@ export class Vector2 { * @param angleInDegrees The angle by which to rotate the vector. * @returns The rotated vector. */ - rotate (angleInDegrees) { - const radians = angleInDegrees * Math.PI / 180 + rotate(angleInDegrees) { + const radians = (angleInDegrees * Math.PI) / 180 const ca = Math.cos(radians) const sa = Math.sin(radians) const x = ca * this.x - sa * this.y @@ -81,7 +81,7 @@ export class Vector2 { * @param steps The number of iterations. * @returns The transformed vectors after the iteration-steps. */ -export function iterate (initialVectors, steps) { +export function iterate(initialVectors, steps) { let vectors = initialVectors for (let i = 0; i < steps; i++) { vectors = iterationStep(vectors) @@ -99,7 +99,7 @@ export function iterate (initialVectors, steps) { * @param vectors The vectors composing the shape to which the algorithm is applied. * @returns The transformed vectors after the iteration-step. */ -function iterationStep (vectors) { +function iterationStep(vectors) { const newVectors = [] for (let i = 0; i < vectors.length - 1; i++) { const startVector = vectors[i] @@ -107,7 +107,9 @@ function iterationStep (vectors) { newVectors.push(startVector) const differenceVector = endVector.subtract(startVector).multiply(1 / 3) newVectors.push(startVector.add(differenceVector)) - newVectors.push(startVector.add(differenceVector).add(differenceVector.rotate(60))) + newVectors.push( + startVector.add(differenceVector).add(differenceVector.rotate(60)) + ) newVectors.push(startVector.add(differenceVector.multiply(2))) } diff --git a/Recursive/KochSnowflake.manual-test.js b/Recursive/KochSnowflake.manual-test.js index 4d9003fd66..720e26b828 100644 --- a/Recursive/KochSnowflake.manual-test.js +++ b/Recursive/KochSnowflake.manual-test.js @@ -7,7 +7,7 @@ import { Vector2, iterate } from './KochSnowflake' * @param steps The number of iterations. * @returns The canvas of the rendered Koch snowflake. */ -function getKochSnowflake (canvasWidth = 600, steps = 5) { +function getKochSnowflake(canvasWidth = 600, steps = 5) { if (canvasWidth <= 0) { throw new Error('canvasWidth should be greater than zero') } @@ -15,7 +15,10 @@ function getKochSnowflake (canvasWidth = 600, steps = 5) { const offsetX = canvasWidth / 10.0 const offsetY = canvasWidth / 3.7 const vector1 = new Vector2(offsetX, offsetY) - const vector2 = new Vector2(canvasWidth / 2, Math.sin(Math.PI / 3) * canvasWidth * 0.8 + offsetY) + const vector2 = new Vector2( + canvasWidth / 2, + Math.sin(Math.PI / 3) * canvasWidth * 0.8 + offsetY + ) const vector3 = new Vector2(canvasWidth - offsetX, offsetY) const initialVectors = [] initialVectors.push(vector1) @@ -34,7 +37,7 @@ function getKochSnowflake (canvasWidth = 600, steps = 5) { * @param canvasHeight The height of the canvas. * @returns The canvas of the rendered edges. */ -function drawToCanvas (vectors, canvasWidth, canvasHeight) { +function drawToCanvas(vectors, canvasWidth, canvasHeight) { const canvas = document.createElement('canvas') canvas.width = canvasWidth canvas.height = canvasHeight diff --git a/Recursive/TowerOfHanoi.js b/Recursive/TowerOfHanoi.js index e43c426d33..57c4db716c 100644 --- a/Recursive/TowerOfHanoi.js +++ b/Recursive/TowerOfHanoi.js @@ -1,7 +1,7 @@ // wiki - https://en.wikipedia.org/wiki/Tower_of_Hanoi // Recursive Javascript function to solve tower of hanoi -export function TowerOfHanoi (n, from, to, aux, output = []) { +export function TowerOfHanoi(n, from, to, aux, output = []) { if (n === 1) { output.push(`Move disk 1 from rod ${from} to rod ${to}`) return output diff --git a/Recursive/test/FloodFill.test.js b/Recursive/test/FloodFill.test.js index 0468d84732..291788addd 100644 --- a/Recursive/test/FloodFill.test.js +++ b/Recursive/test/FloodFill.test.js @@ -30,7 +30,12 @@ describe('FloodFill', () => { * @param testLocation The location of the color to be checked. * @return The color at testLocation. */ -function testBreadthFirst (fillLocation, targetColor, replacementColor, testLocation) { +function testBreadthFirst( + fillLocation, + targetColor, + replacementColor, + testLocation +) { const rgbData = generateTestRgbData() breadthFirstSearch(rgbData, fillLocation, targetColor, replacementColor) return rgbData[testLocation[0]][testLocation[1]] @@ -45,7 +50,13 @@ function testBreadthFirst (fillLocation, targetColor, replacementColor, testLoca * @param testLocation The location of the color to be checked. * @return The color at testLocation. */ -function testDepthFirst (fillLocation, targetColor, replacementColor, testLocation) {// eslint-disable-line +function testDepthFirst( + fillLocation, + targetColor, + replacementColor, + testLocation +) { + // eslint-disable-line const rgbData = generateTestRgbData() depthFirstSearch(rgbData, fillLocation, targetColor, replacementColor) return rgbData[testLocation[0]][testLocation[1]] @@ -56,7 +67,7 @@ function testDepthFirst (fillLocation, targetColor, replacementColor, testLocati * * @return example rgbData-matrix. */ -function generateTestRgbData () { +function generateTestRgbData() { const layout = [ [violet, violet, green, green, black, green, green], [violet, green, green, black, green, green, green], diff --git a/Recursive/test/KochSnowflake.test.js b/Recursive/test/KochSnowflake.test.js index 74f164e906..2362f820f3 100644 --- a/Recursive/test/KochSnowflake.test.js +++ b/Recursive/test/KochSnowflake.test.js @@ -2,19 +2,29 @@ import { iterate, Vector2 } from '../KochSnowflake' describe('KochSnowflake', () => { it('should produce the correctly-transformed vectors', () => { - expect(iterate([new Vector2(0, 0), new Vector2(1, 0)], 1)[0]) - .toEqual({ x: 0, y: 0 }) + expect(iterate([new Vector2(0, 0), new Vector2(1, 0)], 1)[0]).toEqual({ + x: 0, + y: 0 + }) - expect(iterate([new Vector2(0, 0), new Vector2(1, 0)], 1)[1]) - .toEqual({ x: 1 / 3, y: 0 }) + expect(iterate([new Vector2(0, 0), new Vector2(1, 0)], 1)[1]).toEqual({ + x: 1 / 3, + y: 0 + }) - expect(iterate([new Vector2(0, 0), new Vector2(1, 0)], 1)[2]) - .toEqual({ x: 1 / 2, y: Math.sin(Math.PI / 3) / 3 }) + expect(iterate([new Vector2(0, 0), new Vector2(1, 0)], 1)[2]).toEqual({ + x: 1 / 2, + y: Math.sin(Math.PI / 3) / 3 + }) - expect(iterate([new Vector2(0, 0), new Vector2(1, 0)], 1)[3]) - .toEqual({ x: 2 / 3, y: 0 }) + expect(iterate([new Vector2(0, 0), new Vector2(1, 0)], 1)[3]).toEqual({ + x: 2 / 3, + y: 0 + }) - expect(iterate([new Vector2(0, 0), new Vector2(1, 0)], 1)[4]) - .toEqual({ x: 1, y: 0 }) + expect(iterate([new Vector2(0, 0), new Vector2(1, 0)], 1)[4]).toEqual({ + x: 1, + y: 0 + }) }) }) diff --git a/Search/BinarySearch.js b/Search/BinarySearch.js index 89cb37f88d..c5477cb7b9 100644 --- a/Search/BinarySearch.js +++ b/Search/BinarySearch.js @@ -7,7 +7,7 @@ * value is found or the interval is empty. */ -function binarySearchRecursive (arr, x, low = 0, high = arr.length - 1) { +function binarySearchRecursive(arr, x, low = 0, high = arr.length - 1) { const mid = Math.floor(low + (high - low) / 2) if (high >= low) { @@ -28,7 +28,7 @@ function binarySearchRecursive (arr, x, low = 0, high = arr.length - 1) { return -1 } } -function binarySearchIterative (arr, x, low = 0, high = arr.length - 1) { +function binarySearchIterative(arr, x, low = 0, high = arr.length - 1) { while (high >= low) { const mid = Math.floor(low + (high - low) / 2) diff --git a/Search/ExponentialSearch.js b/Search/ExponentialSearch.js index 7b023a606e..d00a981645 100644 --- a/Search/ExponentialSearch.js +++ b/Search/ExponentialSearch.js @@ -9,7 +9,7 @@ * */ -function binarySearch (arr, value, floor, ceiling) { +function binarySearch(arr, value, floor, ceiling) { // Middle index const mid = Math.floor((floor + ceiling) / 2) @@ -31,7 +31,7 @@ function binarySearch (arr, value, floor, ceiling) { } } -function exponentialSearch (arr, length, value) { +function exponentialSearch(arr, length, value) { // If value is the first element of the array return this position if (arr[0] === value) { return 0 diff --git a/Search/FibonacciSearch.js b/Search/FibonacciSearch.js index e1c3060d88..36459ec8de 100644 --- a/Search/FibonacciSearch.js +++ b/Search/FibonacciSearch.js @@ -57,7 +57,7 @@ export const fibonacciSearch = (arr, x, n) => { fib1 = fib1 - fib2 fib2 = fibK - fib1 } else { - // return index for found element + // return index for found element return i } } diff --git a/Search/InterpolationSearch.js b/Search/InterpolationSearch.js index 6ca3eea963..1064268d30 100644 --- a/Search/InterpolationSearch.js +++ b/Search/InterpolationSearch.js @@ -9,7 +9,7 @@ * */ -export function interpolationSearch (arr, key) { +export function interpolationSearch(arr, key) { const length = arr.length - 1 let low = 0 let high = length diff --git a/Search/JumpSearch.js b/Search/JumpSearch.js index 696e318a01..a7b7b443e7 100644 --- a/Search/JumpSearch.js +++ b/Search/JumpSearch.js @@ -1,8 +1,8 @@ /* The Jump Search algorithm allows to combine a linear search with a speed optimization. - * This means that instead of going 1 by 1, we will increase the step of √n and increase that - * step of √n which make the step getting bigger and bigger. - * The asymptotic analysis of Jump Search is o(√n). Like the binary search, it needs to be sorted. - * The advantage against binary search is that Jump Search traversed back only once. + * This means that instead of going 1 by 1, we will increase the step of √n and increase that + * step of √n which make the step getting bigger and bigger. + * The asymptotic analysis of Jump Search is o(√n). Like the binary search, it needs to be sorted. + * The advantage against binary search is that Jump Search traversed back only once. */ const jumpSearch = (arr, value) => { diff --git a/Search/LinearSearch.js b/Search/LinearSearch.js index 64a0e269bf..637ebc1589 100644 --- a/Search/LinearSearch.js +++ b/Search/LinearSearch.js @@ -4,7 +4,7 @@ * for the target value until a match is found or until all the elements * have been searched. */ -function SearchArray (searchNum, ar, output = v => console.log(v)) { +function SearchArray(searchNum, ar, output = (v) => console.log(v)) { const position = Search(ar, searchNum) if (position !== -1) { output('The element was found at ' + (position + 1)) @@ -14,9 +14,11 @@ function SearchArray (searchNum, ar, output = v => console.log(v)) { } // Search “theArray” for the specified “key” value -function Search (theArray, key) { +function Search(theArray, key) { for (let n = 0; n < theArray.length; n++) { - if (theArray[n] === key) { return n } + if (theArray[n] === key) { + return n + } } return -1 } diff --git a/Search/QuickSelectSearch.js b/Search/QuickSelectSearch.js index 8ae5305015..c332af6721 100644 --- a/Search/QuickSelectSearch.js +++ b/Search/QuickSelectSearch.js @@ -11,7 +11,7 @@ * * [Reference](http://en.wikipedia.org/wiki/Quickselect) */ -export function quickSelectSearch (array, k) { +export function quickSelectSearch(array, k) { if (!array || array.length <= k) { throw new Error('Invalid arguments') } diff --git a/Search/SlidingWindow.js b/Search/SlidingWindow.js index 73431f0c68..3a758413b9 100644 --- a/Search/SlidingWindow.js +++ b/Search/SlidingWindow.js @@ -1,26 +1,26 @@ /** -* Sliding Window: -* This pattern involve creating a window which can either be -* an array or numbers from one position to another. -* -* Depending on a certain condition, the window either increases -* or closes (and a new window is created). -* -* Very useful for keeping track of a subset of data in an -* array/string etc. -* -* Time Complexity: Best - O(n); -* -* Examples: -* maxSubarraySum([1,2,5,2,8,1,5],2) // returns 10 -* maxSubarraySum([1,2,5,2,8,1,5],15) // returns null -* maxSubarraySum([5,2,6,9],3) // returns 17 + * Sliding Window: + * This pattern involve creating a window which can either be + * an array or numbers from one position to another. + * + * Depending on a certain condition, the window either increases + * or closes (and a new window is created). + * + * Very useful for keeping track of a subset of data in an + * array/string etc. + * + * Time Complexity: Best - O(n); + * + * Examples: + * maxSubarraySum([1,2,5,2,8,1,5],2) // returns 10 + * maxSubarraySum([1,2,5,2,8,1,5],15) // returns null + * maxSubarraySum([5,2,6,9],3) // returns 17 * @param {[Int]} arr - An array of integers on which we will perform the test. * @param {Int} num - An integer that displays the size of the window you want to check. * @returns {Int / Null} - Returns a total of N consecutive numbers or null */ -function slidingWindow (arr, num) { +function slidingWindow(arr, num) { // Edge Case: // If the length of the array shorter than the window size (num) return null. if (arr.length < num) return null diff --git a/Search/StringSearch.js b/Search/StringSearch.js index 634f3979bb..cc3ad737a7 100644 --- a/Search/StringSearch.js +++ b/Search/StringSearch.js @@ -2,7 +2,7 @@ * String Search */ -function makeTable (str) { +function makeTable(str) { // create a table of size equal to the length of `str` // table[i] will store the prefix of the longest prefix of the substring str[0..i] const table = new Array(str.length) @@ -35,7 +35,7 @@ function makeTable (str) { } // Find all the words that matches in a given string `str` -export function stringSearch (str, word) { +export function stringSearch(str, word) { // find the prefix table in O(n) const prefixes = makeTable(word) const matches = [] diff --git a/Search/TernarySearch.js b/Search/TernarySearch.js index c2a68107f3..ea0d049341 100644 --- a/Search/TernarySearch.js +++ b/Search/TernarySearch.js @@ -11,7 +11,7 @@ * Reference: https://www.geeksforgeeks.org/ternary-search/ */ -function ternarySearchRecursive (arr, key, low = 0, high = arr.length - 1) { +function ternarySearchRecursive(arr, key, low = 0, high = arr.length - 1) { if (high >= low) { // find the mid1 and mid2 const mid1 = Math.floor(low + (high - low) / 3) @@ -47,7 +47,7 @@ function ternarySearchRecursive (arr, key, low = 0, high = arr.length - 1) { } } -function ternarySearchIterative (arr, key, low = 0, high = arr.length - 1) { +function ternarySearchIterative(arr, key, low = 0, high = arr.length - 1) { while (high >= low) { // find the mid1 and mid2 const mid1 = Math.floor(low + (high - low) / 3) diff --git a/Search/UnionFind.js b/Search/UnionFind.js index 0a8f2bca50..5b234da9a1 100644 --- a/Search/UnionFind.js +++ b/Search/UnionFind.js @@ -14,7 +14,7 @@ * * you can learn more on disjoint-set / union–find data structure at https://en.wikipedia.org/wiki/Disjoint-set_data_structure */ -function UnionFind (n, key) { +function UnionFind(n, key) { if (!(this instanceof UnionFind)) return new UnionFind(n) if (key && typeof key !== 'function') { throw new Error('key has to be a function or else left undefined') @@ -22,7 +22,11 @@ function UnionFind (n, key) { let cnt, length // init Union Find with number of distinct groups. Each group will be referred to as index of the array of size 'size' starting at 0. // Provide an optional key function that maps these indices. I.e. for the groups starting with 1 provide function(a){return a-1;}. The default value is function(a){return a;}. - key = key || function (a) { return a } + key = + key || + function (a) { + return a + } cnt = length = n const id = new Array(n) const sz = new Array(n) @@ -63,16 +67,21 @@ function UnionFind (n, key) { const j = this.find(q) if (i === j) return if (sz[i] < sz[j]) { - id[i] = j; sz[j] += sz[i] + id[i] = j + sz[j] += sz[i] } else { - id[j] = i; sz[i] += sz[j] + id[j] = i + sz[i] += sz[j] } cnt-- } - function ensureIndexWithinBounds (args) { + function ensureIndexWithinBounds(args) { for (let i = arguments.length - 1; i >= 0; i--) { const p = arguments[i] - if (p >= length) throw new Error('Index out of bounds. The maximum index can be length-1') + if (p >= length) + throw new Error( + 'Index out of bounds. The maximum index can be length-1' + ) } } } diff --git a/Search/test/ExponentialSearch.test.js b/Search/test/ExponentialSearch.test.js index cca5d82dab..d8706230d0 100644 --- a/Search/test/ExponentialSearch.test.js +++ b/Search/test/ExponentialSearch.test.js @@ -1,15 +1,15 @@ -import { exponentialSearch } from '../ExponentialSearch' - -test('The Exponential Search of the Array [2, 3, 4, 10, 40, 65, 78, 100] is 6 where the value = 78', () => { - const arr = [2, 3, 4, 10, 40, 65, 78, 100] - const value = 78 - const result = exponentialSearch(arr, arr.length, value) - expect(result).toEqual(6) -}) - -test('The Exponential Search of the Array [2, 3, 4, 10, 40, 65, 78, 100] is -1 where the value = 178', () => { - const arr = [2, 3, 4, 10, 40, 65, 78, 100] - const value = 178 - const result = exponentialSearch(arr, arr.length, value) - expect(result).toEqual(-1) -}) +import { exponentialSearch } from '../ExponentialSearch' + +test('The Exponential Search of the Array [2, 3, 4, 10, 40, 65, 78, 100] is 6 where the value = 78', () => { + const arr = [2, 3, 4, 10, 40, 65, 78, 100] + const value = 78 + const result = exponentialSearch(arr, arr.length, value) + expect(result).toEqual(6) +}) + +test('The Exponential Search of the Array [2, 3, 4, 10, 40, 65, 78, 100] is -1 where the value = 178', () => { + const arr = [2, 3, 4, 10, 40, 65, 78, 100] + const value = 178 + const result = exponentialSearch(arr, arr.length, value) + expect(result).toEqual(-1) +}) diff --git a/Search/test/FibonacciSearch.test.js b/Search/test/FibonacciSearch.test.js index 17cbc1f28c..477dc8fe73 100644 --- a/Search/test/FibonacciSearch.test.js +++ b/Search/test/FibonacciSearch.test.js @@ -1,22 +1,22 @@ -import { fibonacciSearch } from '../FibonacciSearch' - -test('fibonacciSearch([10, 22, 35, 40, 45, 50, 80, 82, 85, 90, 100], 90, arr.length) => 9', () => { - const arr = [10, 22, 35, 40, 45, 50, 80, 82, 85, 90, 100] - const target = 90 - const res = fibonacciSearch(arr, target, arr.length) - expect(res).toEqual(9) -}) - -test('fibonacciSearch([1, 11, 55, 56, 78, 82, 104], 104, arr.length) => 6', () => { - const arr = [1, 11, 55, 56, 78, 82, 104] - const target = 104 - const res = fibonacciSearch(arr, target, arr.length) - expect(res).toEqual(6) -}) - -test('fibonacciSearch([40, 45, 50, 80, 82, 85, 90, 100]. 190, arr.length) => -1', () => { - const arr = [40, 45, 50, 80, 82, 85, 90, 100] - const target = 190 - const res = fibonacciSearch(arr, target, arr.length) - expect(res).toEqual(-1) -}) +import { fibonacciSearch } from '../FibonacciSearch' + +test('fibonacciSearch([10, 22, 35, 40, 45, 50, 80, 82, 85, 90, 100], 90, arr.length) => 9', () => { + const arr = [10, 22, 35, 40, 45, 50, 80, 82, 85, 90, 100] + const target = 90 + const res = fibonacciSearch(arr, target, arr.length) + expect(res).toEqual(9) +}) + +test('fibonacciSearch([1, 11, 55, 56, 78, 82, 104], 104, arr.length) => 6', () => { + const arr = [1, 11, 55, 56, 78, 82, 104] + const target = 104 + const res = fibonacciSearch(arr, target, arr.length) + expect(res).toEqual(6) +}) + +test('fibonacciSearch([40, 45, 50, 80, 82, 85, 90, 100]. 190, arr.length) => -1', () => { + const arr = [40, 45, 50, 80, 82, 85, 90, 100] + const target = 190 + const res = fibonacciSearch(arr, target, arr.length) + expect(res).toEqual(-1) +}) diff --git a/Search/test/InterpolationSearch.test.js b/Search/test/InterpolationSearch.test.js index 744a74855b..674c059db2 100644 --- a/Search/test/InterpolationSearch.test.js +++ b/Search/test/InterpolationSearch.test.js @@ -1,15 +1,15 @@ -import { interpolationSearch } from '../InterpolationSearch' - -test('interpolationSearch([2, 6, 8, 14, 122, 169], 144) => -1', () => { - const array = [2, 6, 8, 14, 122, 169] - const key = 144 - const res = interpolationSearch(array, key) - expect(res).toEqual(-1) -}) - -test('interpolationSearch([2, 6, 8, 14, 122, 169], 122) => 4', () => { - const array = [2, 6, 8, 14, 122, 169] - const key = 122 - const res = interpolationSearch(array, key) - expect(res).toEqual(4) -}) +import { interpolationSearch } from '../InterpolationSearch' + +test('interpolationSearch([2, 6, 8, 14, 122, 169], 144) => -1', () => { + const array = [2, 6, 8, 14, 122, 169] + const key = 144 + const res = interpolationSearch(array, key) + expect(res).toEqual(-1) +}) + +test('interpolationSearch([2, 6, 8, 14, 122, 169], 122) => 4', () => { + const array = [2, 6, 8, 14, 122, 169] + const key = 122 + const res = interpolationSearch(array, key) + expect(res).toEqual(4) +}) diff --git a/Search/test/TernarySearch.test.js b/Search/test/TernarySearch.test.js index 5ce269fae5..375c5c5fbd 100644 --- a/Search/test/TernarySearch.test.js +++ b/Search/test/TernarySearch.test.js @@ -1,4 +1,7 @@ -import { ternarySearchRecursive, ternarySearchIterative } from '../TernarySearch' +import { + ternarySearchRecursive, + ternarySearchIterative +} from '../TernarySearch' test('should return the index of a number in an array of numbers:', () => { const indexNumber = ternarySearchRecursive([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 3) @@ -16,21 +19,33 @@ test('should return the index of a number in an array of numbers:', () => { }) test('should return the index of a number in an array of numbers:', () => { - const indexNumber = ternarySearchIterative([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 12) + const indexNumber = ternarySearchIterative( + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], + 12 + ) expect(indexNumber).toBe(-1) }) test('should return the index of a string in an array of strings:', () => { - const indexNumber = ternarySearchRecursive(['Ali', 'Cathrynli', 'Josuke', 'Thomas'], 'Cathrynli') + const indexNumber = ternarySearchRecursive( + ['Ali', 'Cathrynli', 'Josuke', 'Thomas'], + 'Cathrynli' + ) expect(indexNumber).toBe(1) }) test('should return the index of a string in an array of strings:', () => { - const indexNumber = ternarySearchRecursive(['Ali', 'Cathrynli', 'Josuke', 'Thomas'], 'Josuke') + const indexNumber = ternarySearchRecursive( + ['Ali', 'Cathrynli', 'Josuke', 'Thomas'], + 'Josuke' + ) expect(indexNumber).toBe(2) }) test('should return the index of a string in an array of strings:', () => { - const indexNumber = ternarySearchRecursive(['Ali', 'Cathrynli', 'Josuke', 'Thomas'], 'Angela') + const indexNumber = ternarySearchRecursive( + ['Ali', 'Cathrynli', 'Josuke', 'Thomas'], + 'Angela' + ) expect(indexNumber).toBe(-1) }) diff --git a/Search/test/jumpSearch.test.js b/Search/test/jumpSearch.test.js index 12cff5aee5..189aa2fd51 100644 --- a/Search/test/jumpSearch.test.js +++ b/Search/test/jumpSearch.test.js @@ -1,19 +1,19 @@ -import { jumpSearch } from '../JumpSearch' - -test('jumpSearch([0, 0, 4, 7, 10, 23, 34, 40, 55, 68, 77, 90], 77) => 10', () => { - const arr = [0, 0, 4, 7, 10, 23, 34, 40, 55, 68, 77, 90] - const res = jumpSearch(arr, 77) - expect(res).toEqual(10) -}) - -test('jumpSearch([11, 12, 15, 65, 78, 90], 4) => -1', () => { - const arr = [11, 12, 15, 65, 78, 90] - const res = jumpSearch(arr, 4) - expect(res).toEqual(-1) -}) - -test('jumpSearch([11, 12, 15, 65, 78, 90], 11) => 0', () => { - const arr = [11, 12, 15, 65, 78, 90] - const res = jumpSearch(arr, 11) - expect(res).toEqual(0) -}) +import { jumpSearch } from '../JumpSearch' + +test('jumpSearch([0, 0, 4, 7, 10, 23, 34, 40, 55, 68, 77, 90], 77) => 10', () => { + const arr = [0, 0, 4, 7, 10, 23, 34, 40, 55, 68, 77, 90] + const res = jumpSearch(arr, 77) + expect(res).toEqual(10) +}) + +test('jumpSearch([11, 12, 15, 65, 78, 90], 4) => -1', () => { + const arr = [11, 12, 15, 65, 78, 90] + const res = jumpSearch(arr, 4) + expect(res).toEqual(-1) +}) + +test('jumpSearch([11, 12, 15, 65, 78, 90], 11) => 0', () => { + const arr = [11, 12, 15, 65, 78, 90] + const res = jumpSearch(arr, 11) + expect(res).toEqual(0) +}) diff --git a/Sorts/BeadSort.js b/Sorts/BeadSort.js index b092633d49..6a6f69398d 100644 --- a/Sorts/BeadSort.js +++ b/Sorts/BeadSort.js @@ -8,7 +8,7 @@ * * Wikipedia: https://en.wikipedia.org/wiki/Bead_sort */ -export function beadSort (sequence) { +export function beadSort(sequence) { /* Let's ensure our sequence has only Positive Integers */ if (sequence.some((integer) => integer < 0)) { throw RangeError('Sequence must be a list of Positive integers Only!') @@ -18,7 +18,7 @@ export function beadSort (sequence) { const max = Math.max(...sequence) // Set initial Grid - const grid = sequence.map(number => { + const grid = sequence.map((number) => { const maxArr = new Array(max) for (let i = 0; i < number; i++) { @@ -50,7 +50,7 @@ export function beadSort (sequence) { /* Finally, let's turn our Bead rows into their Respective Numbers */ return grid.map((beadArray) => { - const beadsArray = beadArray.filter(bead => bead === '*') + const beadsArray = beadArray.filter((bead) => bead === '*') return beadsArray.length }) } diff --git a/Sorts/BinaryInsertionSort.js b/Sorts/BinaryInsertionSort.js index 3326404e40..68912762dc 100644 --- a/Sorts/BinaryInsertionSort.js +++ b/Sorts/BinaryInsertionSort.js @@ -18,7 +18,7 @@ * @param {Number} end end index position of array * @return {Number} Position of the key element */ -function binarySearch (array, key, start, end) { +function binarySearch(array, key, start, end) { if (start === end) { if (array[start] > key) { return start @@ -48,7 +48,7 @@ function binarySearch (array, key, start, end) { * @param {Array} list List to be sorted. * @return {Array} The sorted list. */ -export function binaryInsertionSort (array) { +export function binaryInsertionSort(array) { const totalLength = array.length for (let i = 1; i < totalLength; i += 1) { const key = array[i] diff --git a/Sorts/BogoSort.js b/Sorts/BogoSort.js index b024371421..eeb4f7feeb 100644 --- a/Sorts/BogoSort.js +++ b/Sorts/BogoSort.js @@ -1,7 +1,7 @@ /** * Checks whether the given array is sorted in ascending order. */ -export function isSorted (array) { +export function isSorted(array) { const length = array.length for (let i = 0; i < length - 1; i++) { if (array[i] > array[i + 1]) { @@ -14,7 +14,7 @@ export function isSorted (array) { /** * Shuffles the given array randomly in place. */ -function shuffle (array) { +function shuffle(array) { for (let i = array.length - 1; i; i--) { const m = Math.floor(Math.random() * i) const n = array[i - 1] @@ -30,7 +30,7 @@ function shuffle (array) { * * For more information see: https://en.wikipedia.org/wiki/Bogosort */ -export function bogoSort (items) { +export function bogoSort(items) { while (!isSorted(items)) { shuffle(items) } diff --git a/Sorts/BubbleSort.js b/Sorts/BubbleSort.js index 202d769a70..5571fac047 100644 --- a/Sorts/BubbleSort.js +++ b/Sorts/BubbleSort.js @@ -1,22 +1,22 @@ /* Bubble Sort is an algorithm to sort an array. It -* compares adjacent element and swaps their position -* The big O on bubble sort in worst and best case is O(N^2). -* Not efficient. -* Somehow if the array is sorted or nearly sorted then we can optimize bubble sort by adding a flag. -* -* In bubble sort, we keep iterating while something was swapped in -* the previous inner-loop iteration. By swapped I mean, in the -* inner loop iteration, we check each number if the number proceeding -* it is greater than itself, if so we swap them. -* -* Wikipedia: https://en.wikipedia.org/wiki/Bubble_sort -* Animated Visual: https://www.toptal.com/developers/sorting-algorithms/bubble-sort -*/ + * compares adjacent element and swaps their position + * The big O on bubble sort in worst and best case is O(N^2). + * Not efficient. + * Somehow if the array is sorted or nearly sorted then we can optimize bubble sort by adding a flag. + * + * In bubble sort, we keep iterating while something was swapped in + * the previous inner-loop iteration. By swapped I mean, in the + * inner loop iteration, we check each number if the number proceeding + * it is greater than itself, if so we swap them. + * + * Wikipedia: https://en.wikipedia.org/wiki/Bubble_sort + * Animated Visual: https://www.toptal.com/developers/sorting-algorithms/bubble-sort + */ /** * Using 2 for loops. */ -export function bubbleSort (items) { +export function bubbleSort(items) { const length = items.length let noSwaps @@ -24,11 +24,11 @@ export function bubbleSort (items) { // flag for optimization noSwaps = true // Number of passes - for (let j = 0; j < (i - 1); j++) { + for (let j = 0; j < i - 1; j++) { // Compare the adjacent positions if (items[j] > items[j + 1]) { // Swap the numbers - [items[j], items[j + 1]] = [items[j + 1], items[j]] + ;[items[j], items[j + 1]] = [items[j + 1], items[j]] noSwaps = false } } @@ -43,14 +43,14 @@ export function bubbleSort (items) { /** * Using a while loop and a for loop. */ -export function alternativeBubbleSort (arr) { +export function alternativeBubbleSort(arr) { let swapped = true while (swapped) { swapped = false for (let i = 0; i < arr.length - 1; i++) { if (arr[i] > arr[i + 1]) { - [arr[i], arr[i + 1]] = [arr[i + 1], arr[i]] + ;[arr[i], arr[i + 1]] = [arr[i + 1], arr[i]] swapped = true } } diff --git a/Sorts/BucketSort.js b/Sorts/BucketSort.js index 14413db2a7..a6cc2200fa 100644 --- a/Sorts/BucketSort.js +++ b/Sorts/BucketSort.js @@ -17,7 +17,7 @@ * @param {number} size The size of the buckets used. If not provided, size will be 5. * @return {number[]} An array of numbers sorted in increasing order. */ -export function bucketSort (list, size) { +export function bucketSort(list, size) { if (undefined === size) { size = 5 } diff --git a/Sorts/CocktailShakerSort.js b/Sorts/CocktailShakerSort.js index 88e3a7791c..033c7c461a 100644 --- a/Sorts/CocktailShakerSort.js +++ b/Sorts/CocktailShakerSort.js @@ -8,21 +8,21 @@ * Wikipedia (Cocktail Shaker Sort): https://en.wikipedia.org/wiki/Cocktail_shaker_sort * Wikipedia (Bubble Sort): https://en.wikipedia.org/wiki/Bubble_sort */ -export function cocktailShakerSort (items) { +export function cocktailShakerSort(items) { for (let i = items.length - 1; i > 0; i--) { let j // Backwards for (j = items.length - 1; j > i; j--) { if (items[j] < items[j - 1]) { - [items[j], items[j - 1]] = [items[j - 1], items[j]] + ;[items[j], items[j - 1]] = [items[j - 1], items[j]] } } // Forwards for (j = 0; j < i; j++) { if (items[j] > items[j + 1]) { - [items[j], items[j + 1]] = [items[j + 1], items[j]] + ;[items[j], items[j + 1]] = [items[j + 1], items[j]] } } } diff --git a/Sorts/CombSort.js b/Sorts/CombSort.js index d22d5b54e0..56614a2120 100644 --- a/Sorts/CombSort.js +++ b/Sorts/CombSort.js @@ -22,7 +22,7 @@ * @param {number[]} list The array of numbers to sort. * @return {number[]} The array of numbers sorted in increasing order. */ -function combSort (list) { +function combSort(list) { if (list.length === 0) { return list } @@ -40,7 +40,7 @@ function combSort (list) { while (gap + i < list.length) { if (list[i] > list[i + gap]) { - [list[i], list[i + gap]] = [list[i + gap], list[i]] + ;[list[i], list[i + gap]] = [list[i + gap], list[i]] isSwapped = true } i += 1 diff --git a/Sorts/CycleSort.js b/Sorts/CycleSort.js index 1120b47efc..11ec013482 100644 --- a/Sorts/CycleSort.js +++ b/Sorts/CycleSort.js @@ -14,7 +14,7 @@ * @param {number[]} list An array of numbers to be sorted. * @return {number[]} An array of numbers sorted in increasing order. */ -function cycleSort (list) { +function cycleSort(list) { for (let cycleStart = 0; cycleStart < list.length; cycleStart++) { let value = list[cycleStart] let position = cycleStart diff --git a/Sorts/DutchNationalFlagSort.js b/Sorts/DutchNationalFlagSort.js index d816d718c3..c90cabf371 100644 --- a/Sorts/DutchNationalFlagSort.js +++ b/Sorts/DutchNationalFlagSort.js @@ -7,7 +7,7 @@ * @return {Integer[]} - Array of integers sorted in non-decreasing order. * @see [Dutch National Flag Sort](https://en.wikipedia.org/wiki/Dutch_national_flag_problem) */ -export function dutchNationalFlagSort (nums) { +export function dutchNationalFlagSort(nums) { let low = 0 let mid = 0 let high = nums.length - 1 @@ -15,7 +15,7 @@ export function dutchNationalFlagSort (nums) { while (mid <= high) { switch (nums[mid]) { case 0: - [nums[low], nums[mid]] = [nums[mid], nums[low]] + ;[nums[low], nums[mid]] = [nums[mid], nums[low]] low++ mid++ break @@ -23,7 +23,7 @@ export function dutchNationalFlagSort (nums) { mid++ break case 2: - [nums[mid], nums[high]] = [nums[high], nums[mid]] + ;[nums[mid], nums[high]] = [nums[high], nums[mid]] high-- break } diff --git a/Sorts/FindSecondLargestElement.js b/Sorts/FindSecondLargestElement.js index ed7e63db1a..504b7e1192 100644 --- a/Sorts/FindSecondLargestElement.js +++ b/Sorts/FindSecondLargestElement.js @@ -1,13 +1,13 @@ /* -* Find Second Largest is a real technical interview question. -* Chances are you will be asked to find the second largest value -* inside of an array of numbers. You must also be able to filter -* out duplicate values. It's important to know how to do this with -* clean code that is also easy to explain. -* -* Resources: -* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set -*/ + * Find Second Largest is a real technical interview question. + * Chances are you will be asked to find the second largest value + * inside of an array of numbers. You must also be able to filter + * out duplicate values. It's important to know how to do this with + * clean code that is also easy to explain. + * + * Resources: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set + */ const secondLargestElement = (array) => { const largestElement = Math.max(...array) diff --git a/Sorts/FlashSort.js b/Sorts/FlashSort.js index 292fc2cc79..ca7bb587fb 100644 --- a/Sorts/FlashSort.js +++ b/Sorts/FlashSort.js @@ -6,8 +6,9 @@ * Wikipedia: https://en.wikipedia.org/wiki/Flashsort */ -export function flashSort (arr) { - let max = 0; let min = arr[0] +export function flashSort(arr) { + let max = 0 + let min = arr[0] const n = arr.length const m = ~~(0.45 * n) const l = new Array(m) @@ -45,12 +46,14 @@ export function flashSort (arr) { arr[0] = hold // permutation - let move = 0; let t; let flash + let move = 0 + let t + let flash let j = 0 let k = m - 1 - while (move < (n - 1)) { - while (j > (l[k] - 1)) { + while (move < n - 1) { + while (j > l[k] - 1) { ++j k = ~~(c1 * (arr[j] - min)) } @@ -58,7 +61,7 @@ export function flashSort (arr) { flash = arr[j] while (j !== l[k]) { k = ~~(c1 * (flash - min)) - hold = arr[t = --l[k]] + hold = arr[(t = --l[k])] arr[t] = flash flash = hold ++move @@ -78,7 +81,7 @@ export function flashSort (arr) { } /** -* Implementation of Flash Sort -*/ + * Implementation of Flash Sort + */ // const array = [3, 0, 2, 5, -1, 4, 1, -2] // flashSort(array) diff --git a/Sorts/GnomeSort.js b/Sorts/GnomeSort.js index 281b96afa4..fab66787bc 100644 --- a/Sorts/GnomeSort.js +++ b/Sorts/GnomeSort.js @@ -3,7 +3,7 @@ * more information: https://en.wikipedia.org/wiki/Gnome_sort * */ -export function gnomeSort (items) { +export function gnomeSort(items) { if (items.length <= 1) { return } @@ -14,7 +14,7 @@ export function gnomeSort (items) { if (items[i - 1] <= items[i]) { i++ } else { - [items[i], items[i - 1]] = [items[i - 1], items[i]] + ;[items[i], items[i - 1]] = [items[i - 1], items[i]] i = Math.max(1, i - 1) } diff --git a/Sorts/HeapSort.js b/Sorts/HeapSort.js index a5d78c34d2..12c16154bc 100644 --- a/Sorts/HeapSort.js +++ b/Sorts/HeapSort.js @@ -33,7 +33,7 @@ Array.prototype.heapify = function (index, heapSize) { * utilizing the heap property. * For more information see: https://en.wikipedia.org/wiki/Heapsort */ -export function heapSort (items) { +export function heapSort(items) { const length = items.length for (let i = Math.floor(length / 2) - 1; i > -1; i--) { diff --git a/Sorts/HeapSortV2.js b/Sorts/HeapSortV2.js index d32859a630..c3b9cb0873 100644 --- a/Sorts/HeapSortV2.js +++ b/Sorts/HeapSortV2.js @@ -2,7 +2,7 @@ let arrayLength = 0 /* to create MAX array */ -function heapRoot (input, i) { +function heapRoot(input, i) { const left = 2 * i + 1 const right = 2 * i + 2 let max = i @@ -21,11 +21,11 @@ function heapRoot (input, i) { } } -function swap (input, indexA, indexB) { - [input[indexA], input[indexB]] = [input[indexB], input[indexA]] +function swap(input, indexA, indexB) { + ;[input[indexA], input[indexB]] = [input[indexB], input[indexA]] } -export function heapSort (input) { +export function heapSort(input) { arrayLength = input.length for (let i = Math.floor(arrayLength / 2); i >= 0; i -= 1) { diff --git a/Sorts/InsertionSort.js b/Sorts/InsertionSort.js index cf50df65fa..9a40bd2bf7 100644 --- a/Sorts/InsertionSort.js +++ b/Sorts/InsertionSort.js @@ -5,13 +5,13 @@ * the correct position and expand sorted part one element at a time. */ -export function insertionSort (unsortedList) { +export function insertionSort(unsortedList) { const len = unsortedList.length for (let i = 1; i < len; i++) { let j const tmp = unsortedList[i] // Copy of the current element. /* Check through the sorted part and compare with the number in tmp. If large, shift the number */ - for (j = i - 1; j >= 0 && (unsortedList[j] > tmp); j--) { + for (j = i - 1; j >= 0 && unsortedList[j] > tmp; j--) { // Shift the number unsortedList[j + 1] = unsortedList[j] } @@ -38,7 +38,7 @@ export function insertionSort (unsortedList) { - O(1) */ -export function insertionSortAlternativeImplementation (array) { +export function insertionSortAlternativeImplementation(array) { const length = array.length if (length < 2) return array diff --git a/Sorts/IntroSort.js b/Sorts/IntroSort.js index d5d79a328b..4874b44082 100644 --- a/Sorts/IntroSort.js +++ b/Sorts/IntroSort.js @@ -15,7 +15,7 @@ * @see [Introsort](https://en.wikipedia.org/wiki/Introsort) * @author [Lakhan Nad](https://github.com/Lakhan-Nad) */ -function introsort (array, compare) { +function introsort(array, compare) { /** * @function Default Comparison Function * This function is same as implemented by @@ -125,7 +125,7 @@ function introsort (array, compare) { * @param {Number} last one more than the last index of array segment * @param {Number} depth this measures how many recursive calls are done */ - function quickSort (start, last, depth) { + function quickSort(start, last, depth) { if (last - start <= THRESHOLD) { insertionSort(start, last) return @@ -145,7 +145,7 @@ function introsort (array, compare) { * @param {Number} pivot the index of pivot to be used * @returns {Number} the index of pivot after partition */ - function partition (start, last, pivot) { + function partition(start, last, pivot) { swap(start, pivot) pivot = start let lo = start @@ -174,7 +174,7 @@ function introsort (array, compare) { * @param {Number} start the first index of array segment to be sorted * @param {Number} last one more than last index of array to be sorted */ - function insertionSort (start, last) { + function insertionSort(start, last) { let i, j for (i = start + 1; i < last; i++) { j = i - 1 @@ -191,7 +191,7 @@ function introsort (array, compare) { * @param {Number} start the first index of array segment to be sorted * @param {Number} last one more than last index of array to be sorted */ - function heapSort (start, last) { + function heapSort(start, last) { let x = (last + start) >> 1 while (x - start >= 0) { heapify(x, start, last) @@ -210,7 +210,7 @@ function introsort (array, compare) { * @param {Number} start the start index of array segment that cur belongs to * @param {Number} last one more than last index of segment that cur belongs to */ - function heapify (cur, start, last) { + function heapify(cur, start, last) { const size = last - start let max, lt, rt cur = cur - start @@ -247,7 +247,7 @@ function introsort (array, compare) { * Returns 'RIGHT:)' if the sort routine worked as expected, * 'WRONG!!' otherwise */ -function demo1 () { +function demo1() { const data = [] const size = 1000000 let i = 0 @@ -279,7 +279,7 @@ function demo1 () { * using the default compare function and * comparing the results with Array.sort */ -function demo2 () { +function demo2() { const data = [] const data2 = [] const size = 1000000 diff --git a/Sorts/MergeSort.js b/Sorts/MergeSort.js index 4bac4ad9af..7cf693ce3a 100644 --- a/Sorts/MergeSort.js +++ b/Sorts/MergeSort.js @@ -15,7 +15,7 @@ * @param {Array} list2 Sublist to break down. * @return {Array} The merged list. */ -export function merge (list1, list2) { +export function merge(list1, list2) { const results = [] let i = 0 let j = 0 @@ -37,7 +37,7 @@ export function merge (list1, list2) { * @param {Array} list List to be sorted. * @return {Array} The sorted list. */ -export function mergeSort (list) { +export function mergeSort(list) { if (list.length < 2) return list const listHalf = Math.floor(list.length / 2) diff --git a/Sorts/OddEvenSort.js b/Sorts/OddEvenSort.js index c3d46a24be..f8eba7c474 100644 --- a/Sorts/OddEvenSort.js +++ b/Sorts/OddEvenSort.js @@ -7,13 +7,13 @@ */ // Helper function to swap array items -function swap (arr, i, j) { +function swap(arr, i, j) { const tmp = arr[i] arr[i] = arr[j] arr[j] = tmp } -export function oddEvenSort (arr) { +export function oddEvenSort(arr) { let sorted = false while (!sorted) { sorted = true diff --git a/Sorts/PancakeSort.js b/Sorts/PancakeSort.js index 239b220f9e..3c2be53714 100644 --- a/Sorts/PancakeSort.js +++ b/Sorts/PancakeSort.js @@ -26,7 +26,7 @@ * @param {number} endIndex The end of the subarray * @returns The flipped array */ -export function flipArray (array, startIndex, endIndex) { +export function flipArray(array, startIndex, endIndex) { while (startIndex < endIndex) { // swap front and back of the subarray const temp = array[startIndex] @@ -49,7 +49,7 @@ export function flipArray (array, startIndex, endIndex) { * @param {*} endIndex The end of the subarray * @returns The index of the maximum number */ -export function findMax (array, startIndex, endIndex) { +export function findMax(array, startIndex, endIndex) { let maxIndex = 0 for (let i = startIndex; i <= endIndex; i++) { if (array[i] > array[maxIndex]) maxIndex = i @@ -67,7 +67,7 @@ export function findMax (array, startIndex, endIndex) { * @param {number[]} array The array to sort * @returns The sorted array */ -export function pancakeSort (array) { +export function pancakeSort(array) { for (let subarraySize = array.length; subarraySize > 1; subarraySize--) { const maximumIndex = findMax(array, 0, subarraySize - 1) diff --git a/Sorts/PigeonHoleSort.js b/Sorts/PigeonHoleSort.js index 30c1bcb813..ca81c816a6 100644 --- a/Sorts/PigeonHoleSort.js +++ b/Sorts/PigeonHoleSort.js @@ -6,13 +6,17 @@ https://en.wikipedia.org/wiki/Pigeonhole_sort * (n) and the length of the range of possible key values (N) * are approximately the same. */ -export function pigeonHoleSort (arr) { +export function pigeonHoleSort(arr) { let min = arr[0] let max = arr[0] for (let i = 0; i < arr.length; i++) { - if (arr[i] > max) { max = arr[i] } - if (arr[i] < min) { min = arr[i] } + if (arr[i] > max) { + max = arr[i] + } + if (arr[i] < min) { + min = arr[i] + } } const range = max - min + 1 diff --git a/Sorts/QuickSort.js b/Sorts/QuickSort.js index f7291d6775..3885054e36 100644 --- a/Sorts/QuickSort.js +++ b/Sorts/QuickSort.js @@ -5,7 +5,7 @@ * @return {Integer[]} - Sorted array. * @see [QuickSort](https://en.wikipedia.org/wiki/Quicksort) */ -function quickSort (items) { +function quickSort(items) { const length = items.length if (length <= 1) { diff --git a/Sorts/QuickSortRecursive.js b/Sorts/QuickSortRecursive.js index fe0cfae848..e45dc34dac 100644 --- a/Sorts/QuickSortRecursive.js +++ b/Sorts/QuickSortRecursive.js @@ -48,11 +48,17 @@ const partition = (partitionList, low, high) => { for (let index = low; index <= high - 1; index++) { if (partitionList[index] < pivot) { // swap variables using array destructuring - [partitionList[index], partitionList[pIndex]] = [partitionList[pIndex], partitionList[index]] + ;[partitionList[index], partitionList[pIndex]] = [ + partitionList[pIndex], + partitionList[index] + ] pIndex += 1 } } - [partitionList[pIndex], partitionList[high]] = [partitionList[high], partitionList[pIndex]] + ;[partitionList[pIndex], partitionList[high]] = [ + partitionList[high], + partitionList[pIndex] + ] return pIndex } diff --git a/Sorts/RadixSort.js b/Sorts/RadixSort.js index a49f3c9228..36f50a12ee 100644 --- a/Sorts/RadixSort.js +++ b/Sorts/RadixSort.js @@ -1,10 +1,10 @@ /* -* Radix sorts an integer array without comparing the integers. -* It groups the integers by their digits which share the same -* significant position. -* For more information see: https://en.wikipedia.org/wiki/Radix_sort -*/ -export function radixSort (items, RADIX) { + * Radix sorts an integer array without comparing the integers. + * It groups the integers by their digits which share the same + * significant position. + * For more information see: https://en.wikipedia.org/wiki/Radix_sort + */ +export function radixSort(items, RADIX) { // default radix is then because we usually count to base 10 if (RADIX === undefined || RADIX < 1) { RADIX = 10 diff --git a/Sorts/SelectionSort.js b/Sorts/SelectionSort.js index cbb038fc3e..4e183be59a 100644 --- a/Sorts/SelectionSort.js +++ b/Sorts/SelectionSort.js @@ -20,15 +20,17 @@ export const selectionSort = (list) => { } // Number of passes let min = i // min holds the current minimum number position for each pass; i holds the Initial min number - for (let j = i + 1; j < length; j++) { // Note that j = i + 1 as we only need to go through unsorted array - if (items[j] < items[min]) { // Compare the numbers + for (let j = i + 1; j < length; j++) { + // Note that j = i + 1 as we only need to go through unsorted array + if (items[j] < items[min]) { + // Compare the numbers min = j // Change the current min number position if a smaller num is found } } if (min !== i) { // After each pass, if the current min num != initial min num, exchange the position. // Swap the numbers - [items[i], items[min]] = [items[min], items[i]] + ;[items[i], items[min]] = [items[min], items[i]] } } return items diff --git a/Sorts/ShellSort.js b/Sorts/ShellSort.js index b2286bb108..34d45ed106 100644 --- a/Sorts/ShellSort.js +++ b/Sorts/ShellSort.js @@ -3,7 +3,7 @@ * more information: https://en.wikipedia.org/wiki/Shellsort * */ -export function shellSort (items) { +export function shellSort(items) { let interval = 1 while (interval < items.length / 3) { diff --git a/Sorts/StoogeSort.js b/Sorts/StoogeSort.js index 5b1b6bdefc..ba13168bf0 100644 --- a/Sorts/StoogeSort.js +++ b/Sorts/StoogeSort.js @@ -4,7 +4,7 @@ * more information: https://en.wikipedia.org/wiki/Stooge_sort * */ -export function stoogeSort (items, leftEnd, rightEnd) { +export function stoogeSort(items, leftEnd, rightEnd) { if (items[rightEnd - 1] < items[leftEnd]) { const temp = items[leftEnd] items[leftEnd] = items[rightEnd - 1] diff --git a/Sorts/SwapSort.js b/Sorts/SwapSort.js index 65199d2ffa..1a2364e074 100644 --- a/Sorts/SwapSort.js +++ b/Sorts/SwapSort.js @@ -8,7 +8,7 @@ * @see [SwapSort](https://www.geeksforgeeks.org/minimum-number-swaps-required-sort-array/) */ -export function minSwapsToSort (items) { +export function minSwapsToSort(items) { const sortedArray = items.slice() sortedArray.sort() const indexMap = {} diff --git a/Sorts/TimSort.js b/Sorts/TimSort.js index b63d67a7ef..1a3cf10b8f 100644 --- a/Sorts/TimSort.js +++ b/Sorts/TimSort.js @@ -1,14 +1,14 @@ /** - * @function Timsort is a hybrid stable sorting algorithm, derived from merge sort and insertion sort, - * designed to perform well on many kinds of real-world data. - * It was implemented by Tim Peters in 2002 for use in the Python programming language. - * It is also used to sort arrays of non-primitive type in Java SE 7, - * on the Android platform, in GNU Octave, on V8, Swift and Rust. - * 1) It sorts small partitions using Insertion Sort. - * 2) Merges the partition using Merge Sort. - * @see [Timsort](https://en.wikipedia.org/wiki/Timsort) - * @param {Array} array - */ + * @function Timsort is a hybrid stable sorting algorithm, derived from merge sort and insertion sort, + * designed to perform well on many kinds of real-world data. + * It was implemented by Tim Peters in 2002 for use in the Python programming language. + * It is also used to sort arrays of non-primitive type in Java SE 7, + * on the Android platform, in GNU Octave, on V8, Swift and Rust. + * 1) It sorts small partitions using Insertion Sort. + * 2) Merges the partition using Merge Sort. + * @see [Timsort](https://en.wikipedia.org/wiki/Timsort) + * @param {Array} array + */ const Timsort = (array) => { // Default size of a partition @@ -67,7 +67,9 @@ const Merge = (array, left, mid, right) => { for (let i = 0; i < len2; i++) { rarr[i] = array[mid + 1 + i] } - let i = 0; let j = 0; let k = left + let i = 0 + let j = 0 + let k = left while (i < larr.length && j < rarr.length) { if (larr[i] < rarr[j]) { array[k++] = larr[i++] diff --git a/Sorts/TopologicalSort.js b/Sorts/TopologicalSort.js index 72487615ba..fe2bdb49fa 100644 --- a/Sorts/TopologicalSort.js +++ b/Sorts/TopologicalSort.js @@ -1,4 +1,4 @@ -export function TopologicalSorter () { +export function TopologicalSorter() { const graph = {} let isVisitedNode let finishTimeCount @@ -18,7 +18,10 @@ export function TopologicalSorter () { finishingTimeList = [] for (const node in graph) { - if (Object.prototype.hasOwnProperty.call(graph, node) && !isVisitedNode[node]) { + if ( + Object.prototype.hasOwnProperty.call(graph, node) && + !isVisitedNode[node] + ) { dfsTraverse(node) } } @@ -27,10 +30,12 @@ export function TopologicalSorter () { return item1.finishTime > item2.finishTime ? -1 : 1 }) - return finishingTimeList.map(function (value) { return value.node }) + return finishingTimeList.map(function (value) { + return value.node + }) } - function dfsTraverse (node) { + function dfsTraverse(node) { isVisitedNode[node] = true if (graph[node]) { for (let i = 0; i < graph[node].length; i++) { diff --git a/Sorts/test/AlphaNumericalSort.test.js b/Sorts/test/AlphaNumericalSort.test.js index 0e1c1c236e..3213dafb72 100644 --- a/Sorts/test/AlphaNumericalSort.test.js +++ b/Sorts/test/AlphaNumericalSort.test.js @@ -20,9 +20,17 @@ describe('alphaNumericalComparer', () => { }) test('correct sort with long numbers', () => { - const src = ['abc999999999999999999999999999999999cba', 'abc999999999999999999999999999999990cba', 'ab'] + const src = [ + 'abc999999999999999999999999999999999cba', + 'abc999999999999999999999999999999990cba', + 'ab' + ] src.sort(alphaNumericalSort) - expect(src).toEqual(['ab', 'abc999999999999999999999999999999990cba', 'abc999999999999999999999999999999999cba']) + expect(src).toEqual([ + 'ab', + 'abc999999999999999999999999999999990cba', + 'abc999999999999999999999999999999999cba' + ]) }) test('correct sort with z prefix', () => { diff --git a/Sorts/test/BogoSort.test.js b/Sorts/test/BogoSort.test.js index abd3a403c7..22a692336e 100644 --- a/Sorts/test/BogoSort.test.js +++ b/Sorts/test/BogoSort.test.js @@ -20,6 +20,8 @@ describe('isSorted', () => { describe('bogoSort', () => { it('should (eventually) sort the array', () => { - expect(bogoSort([5, 6, 7, 8, 1, 2, 12, 14])).toEqual([1, 2, 5, 6, 7, 8, 12, 14]) + expect(bogoSort([5, 6, 7, 8, 1, 2, 12, 14])).toEqual([ + 1, 2, 5, 6, 7, 8, 12, 14 + ]) }) }) diff --git a/Sorts/test/BubbleSort.test.js b/Sorts/test/BubbleSort.test.js index 271de27bfa..8b70738b74 100644 --- a/Sorts/test/BubbleSort.test.js +++ b/Sorts/test/BubbleSort.test.js @@ -5,7 +5,9 @@ describe('bubbleSort', () => { expect(bubbleSort([5, 4, 1, 2, 3])).toEqual([1, 2, 3, 4, 5]) expect(bubbleSort([])).toEqual([]) expect(bubbleSort([1, 2, 3])).toEqual([1, 2, 3]) - expect(bubbleSort([5, 6, 7, 8, 1, 2, 12, 14])).toEqual([1, 2, 5, 6, 7, 8, 12, 14]) + expect(bubbleSort([5, 6, 7, 8, 1, 2, 12, 14])).toEqual([ + 1, 2, 5, 6, 7, 8, 12, 14 + ]) expect(bubbleSort([5, 6, 7, 8, 9, 4])).toEqual([4, 5, 6, 7, 8, 9]) expect(bubbleSort([20, 30, 40])).toEqual([20, 30, 40]) expect(bubbleSort([2, 1, 3])).toEqual([1, 2, 3]) @@ -22,6 +24,8 @@ describe('alternativeBubbleSort', () => { expect(alternativeBubbleSort([5, 4, 1, 2, 3])).toEqual([1, 2, 3, 4, 5]) expect(alternativeBubbleSort([])).toEqual([]) expect(alternativeBubbleSort([1, 2, 3])).toEqual([1, 2, 3]) - expect(alternativeBubbleSort([5, 6, 7, 8, 1, 2, 12, 14])).toEqual([1, 2, 5, 6, 7, 8, 12, 14]) + expect(alternativeBubbleSort([5, 6, 7, 8, 1, 2, 12, 14])).toEqual([ + 1, 2, 5, 6, 7, 8, 12, 14 + ]) }) }) diff --git a/Sorts/test/BucketSort.test.js b/Sorts/test/BucketSort.test.js index d660279551..08c0233c54 100644 --- a/Sorts/test/BucketSort.test.js +++ b/Sorts/test/BucketSort.test.js @@ -25,7 +25,9 @@ describe('Tests for bucketSort function', () => { }) it('should correctly sort an input list of an even length', () => { - expect(bucketSort([40, 42, 56, 45, 12, 3])).toEqual([3, 12, 40, 42, 45, 56]) + expect(bucketSort([40, 42, 56, 45, 12, 3])).toEqual([ + 3, 12, 40, 42, 45, 56 + ]) }) }) @@ -39,7 +41,9 @@ describe('Tests for bucketSort function', () => { }) it('should correctly sort an input list that contains only a mix of positive and negative numbers', () => { - expect(bucketSort([-40, 42, 56, -45, 12, -3])).toEqual([-45, -40, -3, 12, 42, 56]) + expect(bucketSort([-40, 42, 56, -45, 12, -3])).toEqual([ + -45, -40, -3, 12, 42, 56 + ]) }) it('should correctly sort an input list that contains only whole numbers', () => { @@ -47,19 +51,27 @@ describe('Tests for bucketSort function', () => { }) it('should correctly sort an input list that contains only decimal numbers', () => { - expect(bucketSort([1.0, 1.42, 2.56, 33.45, 13.12, 2.3])).toEqual([1.0, 1.42, 2.3, 2.56, 13.12, 33.45]) + expect(bucketSort([1.0, 1.42, 2.56, 33.45, 13.12, 2.3])).toEqual([ + 1.0, 1.42, 2.3, 2.56, 13.12, 33.45 + ]) }) it('should correctly sort an input list that contains only a mix of whole and decimal', () => { - expect(bucketSort([32.40, 12.42, 56, 45, 12, 3])).toEqual([3, 12, 12.42, 32.40, 45, 56]) + expect(bucketSort([32.4, 12.42, 56, 45, 12, 3])).toEqual([ + 3, 12, 12.42, 32.4, 45, 56 + ]) }) it('should correctly sort an input list that contains only fractional numbers', () => { - expect(bucketSort([0.98, 0.4259, 0.56, -0.456, -0.12, 0.322])).toEqual([-0.456, -0.12, 0.322, 0.4259, 0.56, 0.98]) + expect(bucketSort([0.98, 0.4259, 0.56, -0.456, -0.12, 0.322])).toEqual([ + -0.456, -0.12, 0.322, 0.4259, 0.56, 0.98 + ]) }) it('should correctly sort an input list that contains only a mix of whole, decimal, and fractional', () => { - expect(bucketSort([-40, -0.222, 5.6, -4.5, 12, 0.333])).toEqual([-40, -4.5, -0.222, 0.333, 5.6, 12]) + expect(bucketSort([-40, -0.222, 5.6, -4.5, 12, 0.333])).toEqual([ + -40, -4.5, -0.222, 0.333, 5.6, 12 + ]) }) it('should correctly sort an input list that contains duplicates', () => { diff --git a/Sorts/test/CocktailShakerSort.test.js b/Sorts/test/CocktailShakerSort.test.js index 0170576798..2d512ae8ab 100644 --- a/Sorts/test/CocktailShakerSort.test.js +++ b/Sorts/test/CocktailShakerSort.test.js @@ -4,7 +4,9 @@ describe('CocktailShakerSort', () => { it('should sort arrays correctly', () => { expect(cocktailShakerSort([5, 4, 1, 2, 3])).toEqual([1, 2, 3, 4, 5]) expect(cocktailShakerSort([1, 2, 3])).toEqual([1, 2, 3]) - expect(cocktailShakerSort([5, 6, 7, 8, 1, 2, 12, 14])).toEqual([1, 2, 5, 6, 7, 8, 12, 14]) + expect(cocktailShakerSort([5, 6, 7, 8, 1, 2, 12, 14])).toEqual([ + 1, 2, 5, 6, 7, 8, 12, 14 + ]) }) it('should work for empty arrays, too', () => { diff --git a/Sorts/test/CombSort.test.js b/Sorts/test/CombSort.test.js index dec1319edf..f9271a597e 100644 --- a/Sorts/test/CombSort.test.js +++ b/Sorts/test/CombSort.test.js @@ -39,7 +39,9 @@ describe('combSort function', () => { }) it('should correctly sort an input list that contains only a mix of positive and negative numbers', () => { - expect(combSort([-40, 42, 56, -45, 12, -3])).toEqual([-45, -40, -3, 12, 42, 56]) + expect(combSort([-40, 42, 56, -45, 12, -3])).toEqual([ + -45, -40, -3, 12, 42, 56 + ]) }) it('should correctly sort an input list that contains only whole numbers', () => { @@ -47,19 +49,27 @@ describe('combSort function', () => { }) it('should correctly sort an input list that contains only decimal numbers', () => { - expect(combSort([1.0, 1.42, 2.56, 33.45, 13.12, 2.3])).toEqual([1.0, 1.42, 2.3, 2.56, 13.12, 33.45]) + expect(combSort([1.0, 1.42, 2.56, 33.45, 13.12, 2.3])).toEqual([ + 1.0, 1.42, 2.3, 2.56, 13.12, 33.45 + ]) }) it('should correctly sort an input list that contains only a mix of whole and decimal', () => { - expect(combSort([32.40, 12.42, 56, 45, 12, 3])).toEqual([3, 12, 12.42, 32.40, 45, 56]) + expect(combSort([32.4, 12.42, 56, 45, 12, 3])).toEqual([ + 3, 12, 12.42, 32.4, 45, 56 + ]) }) it('should correctly sort an input list that contains only fractional numbers', () => { - expect(combSort([0.98, 0.4259, 0.56, -0.456, -0.12, 0.322])).toEqual([-0.456, -0.12, 0.322, 0.4259, 0.56, 0.98]) + expect(combSort([0.98, 0.4259, 0.56, -0.456, -0.12, 0.322])).toEqual([ + -0.456, -0.12, 0.322, 0.4259, 0.56, 0.98 + ]) }) it('should correctly sort an input list that contains only a mix of whole, decimal, and fractional', () => { - expect(combSort([-40, -0.222, 5.6, -4.5, 12, 0.333])).toEqual([-40, -4.5, -0.222, 0.333, 5.6, 12]) + expect(combSort([-40, -0.222, 5.6, -4.5, 12, 0.333])).toEqual([ + -40, -4.5, -0.222, 0.333, 5.6, 12 + ]) }) it('should correctly sort an input list that contains duplicates', () => { diff --git a/Sorts/test/CountingSort.test.js b/Sorts/test/CountingSort.test.js index 16cea70ee7..7d5d185dff 100644 --- a/Sorts/test/CountingSort.test.js +++ b/Sorts/test/CountingSort.test.js @@ -1,25 +1,25 @@ -import { countingSort } from '../CountingSort' - -test('The countingSort of the array [3, 0, 2, 5, 4, 1] is [0, 1, 2, 3, 4, 5]', () => { - const array = [3, 0, 2, 5, 4, 1] - const res = countingSort(array, 0, 5) - expect(res).toEqual([0, 1, 2, 3, 4, 5]) -}) - -test('The countingSort of the array [6, 4, 2, 1, 3, 5] is [1, 2, 3, 4, 5, 6]', () => { - const array = [6, 4, 2, 1, 3, 5] - const res = countingSort(array, 1, 6) - expect(res).toEqual([1, 2, 3, 4, 5, 6]) -}) - -test('The countingSort of the array [11, 14, 12, 15, 16, 13] is [11, 12, 13, 14, 15, 16]', () => { - const array = [11, 14, 12, 15, 16, 13] - const res = countingSort(array, 11, 16) - expect(res).toEqual([11, 12, 13, 14, 15, 16]) -}) - -test('The countingSort of the array [13, 18, 2, 15, 43, 11] is [2, 11, 13, 15, 18, 43]', () => { - const array = [13, 18, 2, 15, 43, 11] - const res = countingSort(array, 2, 43) - expect(res).toEqual([2, 11, 13, 15, 18, 43]) -}) +import { countingSort } from '../CountingSort' + +test('The countingSort of the array [3, 0, 2, 5, 4, 1] is [0, 1, 2, 3, 4, 5]', () => { + const array = [3, 0, 2, 5, 4, 1] + const res = countingSort(array, 0, 5) + expect(res).toEqual([0, 1, 2, 3, 4, 5]) +}) + +test('The countingSort of the array [6, 4, 2, 1, 3, 5] is [1, 2, 3, 4, 5, 6]', () => { + const array = [6, 4, 2, 1, 3, 5] + const res = countingSort(array, 1, 6) + expect(res).toEqual([1, 2, 3, 4, 5, 6]) +}) + +test('The countingSort of the array [11, 14, 12, 15, 16, 13] is [11, 12, 13, 14, 15, 16]', () => { + const array = [11, 14, 12, 15, 16, 13] + const res = countingSort(array, 11, 16) + expect(res).toEqual([11, 12, 13, 14, 15, 16]) +}) + +test('The countingSort of the array [13, 18, 2, 15, 43, 11] is [2, 11, 13, 15, 18, 43]', () => { + const array = [13, 18, 2, 15, 43, 11] + const res = countingSort(array, 2, 43) + expect(res).toEqual([2, 11, 13, 15, 18, 43]) +}) diff --git a/Sorts/test/CycleSort.test.js b/Sorts/test/CycleSort.test.js index d622875d07..158e0b4797 100644 --- a/Sorts/test/CycleSort.test.js +++ b/Sorts/test/CycleSort.test.js @@ -25,7 +25,9 @@ describe('cycleSort function', () => { }) it('should correctly sort an input list of an even length', () => { - expect(cycleSort([40, 42, 56, 45, 12, 3])).toEqual([3, 12, 40, 42, 45, 56]) + expect(cycleSort([40, 42, 56, 45, 12, 3])).toEqual([ + 3, 12, 40, 42, 45, 56 + ]) }) }) @@ -39,7 +41,9 @@ describe('cycleSort function', () => { }) it('should correctly sort an input list that contains only a mix of positive and negative numbers', () => { - expect(cycleSort([-40, 42, 56, -45, 12, -3])).toEqual([-45, -40, -3, 12, 42, 56]) + expect(cycleSort([-40, 42, 56, -45, 12, -3])).toEqual([ + -45, -40, -3, 12, 42, 56 + ]) }) it('should correctly sort an input list that contains only whole numbers', () => { @@ -47,19 +51,27 @@ describe('cycleSort function', () => { }) it('should correctly sort an input list that contains only decimal numbers', () => { - expect(cycleSort([1.0, 1.42, 2.56, 33.45, 13.12, 2.3])).toEqual([1.0, 1.42, 2.3, 2.56, 13.12, 33.45]) + expect(cycleSort([1.0, 1.42, 2.56, 33.45, 13.12, 2.3])).toEqual([ + 1.0, 1.42, 2.3, 2.56, 13.12, 33.45 + ]) }) it('should correctly sort an input list that contains only a mix of whole and decimal', () => { - expect(cycleSort([32.40, 12.42, 56, 45, 12, 3])).toEqual([3, 12, 12.42, 32.40, 45, 56]) + expect(cycleSort([32.4, 12.42, 56, 45, 12, 3])).toEqual([ + 3, 12, 12.42, 32.4, 45, 56 + ]) }) it('should correctly sort an input list that contains only fractional numbers', () => { - expect(cycleSort([0.98, 0.4259, 0.56, -0.456, -0.12, 0.322])).toEqual([-0.456, -0.12, 0.322, 0.4259, 0.56, 0.98]) + expect(cycleSort([0.98, 0.4259, 0.56, -0.456, -0.12, 0.322])).toEqual([ + -0.456, -0.12, 0.322, 0.4259, 0.56, 0.98 + ]) }) it('should correctly sort an input list that contains only a mix of whole, decimal, and fractional', () => { - expect(cycleSort([-40, -0.222, 5.6, -4.5, 12, 0.333])).toEqual([-40, -4.5, -0.222, 0.333, 5.6, 12]) + expect(cycleSort([-40, -0.222, 5.6, -4.5, 12, 0.333])).toEqual([ + -40, -4.5, -0.222, 0.333, 5.6, 12 + ]) }) it('should correctly sort an input list that contains duplicates', () => { diff --git a/Sorts/test/DutchNationalFlagSort.test.js b/Sorts/test/DutchNationalFlagSort.test.js index ddb35c6171..33cde385f8 100644 --- a/Sorts/test/DutchNationalFlagSort.test.js +++ b/Sorts/test/DutchNationalFlagSort.test.js @@ -2,7 +2,9 @@ import { dutchNationalFlagSort } from '../DutchNationalFlagSort' describe('DutchNationalFlagSort', () => { it('should sort arrays correctly', () => { - expect(dutchNationalFlagSort([2, 0, 2, 1, 1, 0])).toEqual([0, 0, 1, 1, 2, 2]) + expect(dutchNationalFlagSort([2, 0, 2, 1, 1, 0])).toEqual([ + 0, 0, 1, 1, 2, 2 + ]) expect(dutchNationalFlagSort([2, 1, 0])).toEqual([0, 1, 2]) expect(dutchNationalFlagSort([1, 0, 0, 0, 1])).toEqual([0, 0, 0, 1, 1]) }) diff --git a/Sorts/test/FindSecondLargestElement.test.js b/Sorts/test/FindSecondLargestElement.test.js index 6e37275b61..98c8c301b9 100644 --- a/Sorts/test/FindSecondLargestElement.test.js +++ b/Sorts/test/FindSecondLargestElement.test.js @@ -1,13 +1,13 @@ -import { secondLargestElement } from '../FindSecondLargestElement' - -test('The second largest element of the array [1, 2, 3, 4, 5] is 4', () => { - const array = [1, 2, 3, 4, 5] - const res = secondLargestElement(array) - expect(res).toEqual(4) -}) - -test('The second largest element of the array [-1, -2, -3, -4, -5] is -2', () => { - const array = [-1, -2, -3, -4, -5] - const res = secondLargestElement(array) - expect(res).toEqual(-2) -}) +import { secondLargestElement } from '../FindSecondLargestElement' + +test('The second largest element of the array [1, 2, 3, 4, 5] is 4', () => { + const array = [1, 2, 3, 4, 5] + const res = secondLargestElement(array) + expect(res).toEqual(4) +}) + +test('The second largest element of the array [-1, -2, -3, -4, -5] is -2', () => { + const array = [-1, -2, -3, -4, -5] + const res = secondLargestElement(array) + expect(res).toEqual(-2) +}) diff --git a/Sorts/test/FlashSort.test.js b/Sorts/test/FlashSort.test.js index 7fd24ccceb..65074de1a6 100644 --- a/Sorts/test/FlashSort.test.js +++ b/Sorts/test/FlashSort.test.js @@ -1,25 +1,25 @@ -import { flashSort } from '../FlashSort' - -test('The flash sort of the array [3, 0, 2, 5, -1, 4, 1, -2] is [-2, -1, 0, 1, 2, 3, 4, 5]', () => { - const array = [3, 0, 2, 5, -1, 4, 1, -2] - const res = flashSort(array) - expect(res).toEqual([-2, -1, 0, 1, 2, 3, 4, 5]) -}) - -test('The flash sort of the array [-3, 0, 2, -5, -1, 4, 1, -2] is [-5, -3, -2, -1, 0, 1, 2, 4]', () => { - const array = [-3, 0, 2, -5, -1, 4, 1, -2] - const res = flashSort(array) - expect(res).toEqual([-5, -3, -2, -1, 0, 1, 2, 4]) -}) - -test('The flash sort of the array [13, 0, 12, 5, -1, 14, 1, -2] is [-2, -1, 0, 1, 5, 12, 13, 14]', () => { - const array = [13, 0, 12, 5, -1, 14, 1, -2] - const res = flashSort(array) - expect(res).toEqual([-2, -1, 0, 1, 5, 12, 13, 14]) -}) - -test('The flash sort of the array [-3, 0, -2, -5, -1, -4, -1, -2] is [-5, -4, -3, -2, -2, -1, -1, 0]', () => { - const array = [-3, 0, -2, -5, -1, -4, -1, -2] - const res = flashSort(array) - expect(res).toEqual([-5, -4, -3, -2, -2, -1, -1, 0]) -}) +import { flashSort } from '../FlashSort' + +test('The flash sort of the array [3, 0, 2, 5, -1, 4, 1, -2] is [-2, -1, 0, 1, 2, 3, 4, 5]', () => { + const array = [3, 0, 2, 5, -1, 4, 1, -2] + const res = flashSort(array) + expect(res).toEqual([-2, -1, 0, 1, 2, 3, 4, 5]) +}) + +test('The flash sort of the array [-3, 0, 2, -5, -1, 4, 1, -2] is [-5, -3, -2, -1, 0, 1, 2, 4]', () => { + const array = [-3, 0, 2, -5, -1, 4, 1, -2] + const res = flashSort(array) + expect(res).toEqual([-5, -3, -2, -1, 0, 1, 2, 4]) +}) + +test('The flash sort of the array [13, 0, 12, 5, -1, 14, 1, -2] is [-2, -1, 0, 1, 5, 12, 13, 14]', () => { + const array = [13, 0, 12, 5, -1, 14, 1, -2] + const res = flashSort(array) + expect(res).toEqual([-2, -1, 0, 1, 5, 12, 13, 14]) +}) + +test('The flash sort of the array [-3, 0, -2, -5, -1, -4, -1, -2] is [-5, -4, -3, -2, -2, -1, -1, 0]', () => { + const array = [-3, 0, -2, -5, -1, -4, -1, -2] + const res = flashSort(array) + expect(res).toEqual([-5, -4, -3, -2, -2, -1, -1, 0]) +}) diff --git a/Sorts/test/GnomeSort.test.js b/Sorts/test/GnomeSort.test.js index a769ebcc54..7799ba6023 100644 --- a/Sorts/test/GnomeSort.test.js +++ b/Sorts/test/GnomeSort.test.js @@ -1,19 +1,19 @@ -import { gnomeSort } from '../GnomeSort' - -test('The gnomeSort of the array [5, 4, 3, 2, 1] is [1, 2, 3, 4, 5]', () => { - const arr = [5, 4, 3, 2, 1] - const res = gnomeSort(arr) - expect(res).toEqual([1, 2, 3, 4, 5]) -}) - -test('The gnomeSort of the array [-5, 4, -3, 2, -1] is [-5, -3, -1, 2, 4]', () => { - const arr = [-5, 4, -3, 2, -1] - const res = gnomeSort(arr) - expect(res).toEqual([-5, -3, -1, 2, 4]) -}) - -test('The gnomeSort of the array [15, 4, -13, 2, -11] is [-13, -11, 2, 4, 15]', () => { - const arr = [15, 4, -13, 2, -11] - const res = gnomeSort(arr) - expect(res).toEqual([-13, -11, 2, 4, 15]) -}) +import { gnomeSort } from '../GnomeSort' + +test('The gnomeSort of the array [5, 4, 3, 2, 1] is [1, 2, 3, 4, 5]', () => { + const arr = [5, 4, 3, 2, 1] + const res = gnomeSort(arr) + expect(res).toEqual([1, 2, 3, 4, 5]) +}) + +test('The gnomeSort of the array [-5, 4, -3, 2, -1] is [-5, -3, -1, 2, 4]', () => { + const arr = [-5, 4, -3, 2, -1] + const res = gnomeSort(arr) + expect(res).toEqual([-5, -3, -1, 2, 4]) +}) + +test('The gnomeSort of the array [15, 4, -13, 2, -11] is [-13, -11, 2, 4, 15]', () => { + const arr = [15, 4, -13, 2, -11] + const res = gnomeSort(arr) + expect(res).toEqual([-13, -11, 2, 4, 15]) +}) diff --git a/Sorts/test/HeapSort.test.js b/Sorts/test/HeapSort.test.js index 45c66e099d..5ee2381e89 100644 --- a/Sorts/test/HeapSort.test.js +++ b/Sorts/test/HeapSort.test.js @@ -1,25 +1,25 @@ -import { heapSort } from '../HeapSort' - -test('The HeapSort of the array [5, 4, 3, 2, 1] is [1, 2, 3, 4, 5]', () => { - const array = [5, 4, 3, 2, 1] - const res = heapSort(array) - expect(res).toEqual([1, 2, 3, 4, 5]) -}) - -test('The HeapSort of the array [-5, -4, -3, -2, -1] is [-5, -4, -3, -2, -1]', () => { - const array = [-5, -4, -3, -2, -1] - const res = heapSort(array) - expect(res).toEqual([-5, -4, -3, -2, -1]) -}) - -test('The HeapSort of the array [50, 43, 31, 52, 91] is [31, 43, 50, 52, 91]', () => { - const array = [50, 43, 31, 52, 91] - const res = heapSort(array) - expect(res).toEqual([31, 43, 50, 52, 91]) -}) - -test('The HeapSort of the array [] is []', () => { - const array = [] - const res = heapSort(array) - expect(res).toEqual([]) -}) +import { heapSort } from '../HeapSort' + +test('The HeapSort of the array [5, 4, 3, 2, 1] is [1, 2, 3, 4, 5]', () => { + const array = [5, 4, 3, 2, 1] + const res = heapSort(array) + expect(res).toEqual([1, 2, 3, 4, 5]) +}) + +test('The HeapSort of the array [-5, -4, -3, -2, -1] is [-5, -4, -3, -2, -1]', () => { + const array = [-5, -4, -3, -2, -1] + const res = heapSort(array) + expect(res).toEqual([-5, -4, -3, -2, -1]) +}) + +test('The HeapSort of the array [50, 43, 31, 52, 91] is [31, 43, 50, 52, 91]', () => { + const array = [50, 43, 31, 52, 91] + const res = heapSort(array) + expect(res).toEqual([31, 43, 50, 52, 91]) +}) + +test('The HeapSort of the array [] is []', () => { + const array = [] + const res = heapSort(array) + expect(res).toEqual([]) +}) diff --git a/Sorts/test/HeapSortV2.test.js b/Sorts/test/HeapSortV2.test.js index 760ba0df8a..a74ee4f463 100644 --- a/Sorts/test/HeapSortV2.test.js +++ b/Sorts/test/HeapSortV2.test.js @@ -1,19 +1,19 @@ -import { heapSort } from '../HeapSortV2' - -test('The heapSort of the array [4, 3, 2, 1] is [1, 2, 3, 4]', () => { - const arr = [4, 3, 2, 1] - const res = heapSort(arr) - expect(res).toEqual([1, 2, 3, 4]) -}) - -test('The heapSort of the array [] is []', () => { - const arr = [] - const res = heapSort(arr) - expect(res).toEqual([]) -}) - -test('The heapSort of the array [41, 31, 32, 31] is [31, 31, 32, 41]', () => { - const arr = [41, 31, 32, 31] - const res = heapSort(arr) - expect(res).toEqual([31, 31, 32, 41]) -}) +import { heapSort } from '../HeapSortV2' + +test('The heapSort of the array [4, 3, 2, 1] is [1, 2, 3, 4]', () => { + const arr = [4, 3, 2, 1] + const res = heapSort(arr) + expect(res).toEqual([1, 2, 3, 4]) +}) + +test('The heapSort of the array [] is []', () => { + const arr = [] + const res = heapSort(arr) + expect(res).toEqual([]) +}) + +test('The heapSort of the array [41, 31, 32, 31] is [31, 31, 32, 41]', () => { + const arr = [41, 31, 32, 31] + const res = heapSort(arr) + expect(res).toEqual([31, 31, 32, 41]) +}) diff --git a/Sorts/test/InsertionSort.test.js b/Sorts/test/InsertionSort.test.js index 6a35e83561..481f152a1d 100644 --- a/Sorts/test/InsertionSort.test.js +++ b/Sorts/test/InsertionSort.test.js @@ -12,8 +12,14 @@ describe('insertionSortAlternativeImplementation', () => { it('expects to return array sorted in ascending order', () => { expect(insertionSortAlternativeImplementation([14, 11])).toEqual([11, 14]) - expect(insertionSortAlternativeImplementation([21, 22, 23])).toEqual([21, 22, 23]) - expect(insertionSortAlternativeImplementation([1, 3, 2, 3, 7, 2])).toEqual([1, 2, 2, 3, 3, 7]) - expect(insertionSortAlternativeImplementation([1, 6, 4, 5, 9, 2])).toEqual([1, 2, 4, 5, 6, 9]) + expect(insertionSortAlternativeImplementation([21, 22, 23])).toEqual([ + 21, 22, 23 + ]) + expect(insertionSortAlternativeImplementation([1, 3, 2, 3, 7, 2])).toEqual([ + 1, 2, 2, 3, 3, 7 + ]) + expect(insertionSortAlternativeImplementation([1, 6, 4, 5, 9, 2])).toEqual([ + 1, 2, 4, 5, 6, 9 + ]) }) }) diff --git a/Sorts/test/MergeSort.test.js b/Sorts/test/MergeSort.test.js index c66ef61ec0..c4e4f398d6 100644 --- a/Sorts/test/MergeSort.test.js +++ b/Sorts/test/MergeSort.test.js @@ -18,6 +18,8 @@ describe('MergeSort', () => { expect(mergeSort([5, 4])).toEqual([4, 5]) expect(mergeSort([8, 4, 10, 15, 9])).toEqual([4, 8, 9, 10, 15]) expect(mergeSort([1, 2, 3])).toEqual([1, 2, 3]) - expect(mergeSort([10, 5, 3, 8, 2, 6, 4, 7, 9, 1])).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) + expect(mergeSort([10, 5, 3, 8, 2, 6, 4, 7, 9, 1])).toEqual([ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 + ]) }) }) diff --git a/Sorts/test/OddEvenSort.test.js b/Sorts/test/OddEvenSort.test.js index 1885e4a779..6d75851e5e 100644 --- a/Sorts/test/OddEvenSort.test.js +++ b/Sorts/test/OddEvenSort.test.js @@ -1,25 +1,25 @@ -import { oddEvenSort } from '../OddEvenSort' - -test('The OddEvenSort of the array [5, 4, 3, 2, 1] is [1, 2, 3, 4, 5]', () => { - const arr = [5, 4, 3, 2, 1] - const res = oddEvenSort(arr) - expect(res).toEqual([1, 2, 3, 4, 5]) -}) - -test('The OddEvenSort of the array [] is []', () => { - const arr = [] - const res = oddEvenSort(arr) - expect(res).toEqual([]) -}) - -test('The OddEvenSort of the array [10, 14, 12, 20] is [10, 12, 14, 20]', () => { - const arr = [10, 14, 12, 20] - const res = oddEvenSort(arr) - expect(res).toEqual([10, 12, 14, 20]) -}) - -test('The OddEvenSort of the array [166, 169, 144] is [144, 166, 169]', () => { - const arr = [166, 169, 144] - const res = oddEvenSort(arr) - expect(res).toEqual([144, 166, 169]) -}) +import { oddEvenSort } from '../OddEvenSort' + +test('The OddEvenSort of the array [5, 4, 3, 2, 1] is [1, 2, 3, 4, 5]', () => { + const arr = [5, 4, 3, 2, 1] + const res = oddEvenSort(arr) + expect(res).toEqual([1, 2, 3, 4, 5]) +}) + +test('The OddEvenSort of the array [] is []', () => { + const arr = [] + const res = oddEvenSort(arr) + expect(res).toEqual([]) +}) + +test('The OddEvenSort of the array [10, 14, 12, 20] is [10, 12, 14, 20]', () => { + const arr = [10, 14, 12, 20] + const res = oddEvenSort(arr) + expect(res).toEqual([10, 12, 14, 20]) +}) + +test('The OddEvenSort of the array [166, 169, 144] is [144, 166, 169]', () => { + const arr = [166, 169, 144] + const res = oddEvenSort(arr) + expect(res).toEqual([144, 166, 169]) +}) diff --git a/Sorts/test/PigeonHoleSort.test.js b/Sorts/test/PigeonHoleSort.test.js index 6816051c3b..0c1313a2e4 100644 --- a/Sorts/test/PigeonHoleSort.test.js +++ b/Sorts/test/PigeonHoleSort.test.js @@ -1,19 +1,19 @@ -import { pigeonHoleSort } from '../PigeonHoleSort' - -test('The pigeonHoleSort of the array [1, 4, 3, 2] is [1, 2, 3, 4]', () => { - const arr = [1, 4, 3, 2] - const res = pigeonHoleSort(arr) - expect(res).toEqual([1, 2, 3, 4]) -}) - -test('The pigeonHoleSort of the array [5, 4, 1, 2] is [1, 2, 4, 5]', () => { - const arr = [5, 4, 1, 2] - const res = pigeonHoleSort(arr) - expect(res).toEqual([1, 2, 4, 5]) -}) - -test('The pigeonHoleSort of the array [18, 31, 29, 35, 11] is [11, 18, 29, 31, 35]', () => { - const arr = [18, 31, 29, 35, 11] - const res = pigeonHoleSort(arr) - expect(res).toEqual([11, 18, 29, 31, 35]) -}) +import { pigeonHoleSort } from '../PigeonHoleSort' + +test('The pigeonHoleSort of the array [1, 4, 3, 2] is [1, 2, 3, 4]', () => { + const arr = [1, 4, 3, 2] + const res = pigeonHoleSort(arr) + expect(res).toEqual([1, 2, 3, 4]) +}) + +test('The pigeonHoleSort of the array [5, 4, 1, 2] is [1, 2, 4, 5]', () => { + const arr = [5, 4, 1, 2] + const res = pigeonHoleSort(arr) + expect(res).toEqual([1, 2, 4, 5]) +}) + +test('The pigeonHoleSort of the array [18, 31, 29, 35, 11] is [11, 18, 29, 31, 35]', () => { + const arr = [18, 31, 29, 35, 11] + const res = pigeonHoleSort(arr) + expect(res).toEqual([11, 18, 29, 31, 35]) +}) diff --git a/Sorts/test/QuickSortRecursive.test.js b/Sorts/test/QuickSortRecursive.test.js index 39a44eb8b2..7516877a11 100644 --- a/Sorts/test/QuickSortRecursive.test.js +++ b/Sorts/test/QuickSortRecursive.test.js @@ -2,20 +2,30 @@ import { quickSort } from '../QuickSortRecursive' describe('QuickSortRecursive | Partition In Place Method', () => { it('Expectedly, throw some error if we pass a non-array input', () => { - expect(() => quickSort('xyz', 0, 2)).toThrow('Please input a valid list or array.') - expect(() => quickSort(null, 0, 4)).toThrow('Please input a valid list or array.') - expect(() => quickSort(55, 0, 2)).toThrow('Please input a valid list or array.') + expect(() => quickSort('xyz', 0, 2)).toThrow( + 'Please input a valid list or array.' + ) + expect(() => quickSort(null, 0, 4)).toThrow( + 'Please input a valid list or array.' + ) + expect(() => quickSort(55, 0, 2)).toThrow( + 'Please input a valid list or array.' + ) }) it('Expectedly, the quickSort method will sort the unsorted list in ascending order', () => { const unSortArray = [5, 9, 3, 4, 6, 2, 0, 1, 7, 8] const sortedExpectedArray = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - expect(quickSort(unSortArray, 0, unSortArray.length - 1)).toEqual(sortedExpectedArray) + expect(quickSort(unSortArray, 0, unSortArray.length - 1)).toEqual( + sortedExpectedArray + ) }) it('Expectedly, the quickSort method will arrange the list of character values in dictionary order.', () => { const unSortList = ['d', 'e', 'c', 'a', 'f', 'b'] const sortedExpectedList = ['a', 'b', 'c', 'd', 'e', 'f'] - expect(quickSort(unSortList, 0, unSortList.length - 1)).toEqual(sortedExpectedList) + expect(quickSort(unSortList, 0, unSortList.length - 1)).toEqual( + sortedExpectedList + ) }) }) diff --git a/Sorts/test/RadixSort.test.js b/Sorts/test/RadixSort.test.js index 5a02d13d6f..ccff5c95f6 100644 --- a/Sorts/test/RadixSort.test.js +++ b/Sorts/test/RadixSort.test.js @@ -1,19 +1,19 @@ -import { radixSort } from '../RadixSort' - -test('The RadixSort of the array [4, 3, 2, 1] is [1, 2, 3, 4]', () => { - const arr = [4, 3, 2, 1] - const res = radixSort(arr, 10) - expect(res).toEqual([1, 2, 3, 4]) -}) - -test('The RadixSort of the array [] is []', () => { - const arr = [] - const res = radixSort(arr, 10) - expect(res).toEqual([]) -}) - -test('The RadixSort of the array [14, 16, 10, 12] is [10, 12, 14, 16]', () => { - const arr = [14, 16, 10, 12] - const res = radixSort(arr, 10) - expect(res).toEqual([10, 12, 14, 16]) -}) +import { radixSort } from '../RadixSort' + +test('The RadixSort of the array [4, 3, 2, 1] is [1, 2, 3, 4]', () => { + const arr = [4, 3, 2, 1] + const res = radixSort(arr, 10) + expect(res).toEqual([1, 2, 3, 4]) +}) + +test('The RadixSort of the array [] is []', () => { + const arr = [] + const res = radixSort(arr, 10) + expect(res).toEqual([]) +}) + +test('The RadixSort of the array [14, 16, 10, 12] is [10, 12, 14, 16]', () => { + const arr = [14, 16, 10, 12] + const res = radixSort(arr, 10) + expect(res).toEqual([10, 12, 14, 16]) +}) diff --git a/Sorts/test/SecondLargestElement.test.js b/Sorts/test/SecondLargestElement.test.js index 95d62babc1..f736981ff5 100644 --- a/Sorts/test/SecondLargestElement.test.js +++ b/Sorts/test/SecondLargestElement.test.js @@ -1,25 +1,25 @@ -import { secondLargestElement } from '../FindSecondLargestElement' - -test('The second largest element of the array [100, 200, 300, 400] is 300', () => { - const array = [100, 200, 300, 400] - const res = secondLargestElement(array) - expect(res).toBe(300) -}) - -test('The second largest element of the array [1100, 2400, 1300, 4002] is 2400', () => { - const array = [1100, 2400, 1300, 4002] - const res = secondLargestElement(array) - expect(res).toBe(2400) -}) - -test('The second largest element of the array [10, 20, 39, 34] is 34', () => { - const array = [10, 20, 39, 34] - const res = secondLargestElement(array) - expect(res).toBe(34) -}) - -test('The second largest element of the array [1, 20, 3, 40] is 20', () => { - const array = [1, 20, 3, 40] - const res = secondLargestElement(array) - expect(res).toBe(20) -}) +import { secondLargestElement } from '../FindSecondLargestElement' + +test('The second largest element of the array [100, 200, 300, 400] is 300', () => { + const array = [100, 200, 300, 400] + const res = secondLargestElement(array) + expect(res).toBe(300) +}) + +test('The second largest element of the array [1100, 2400, 1300, 4002] is 2400', () => { + const array = [1100, 2400, 1300, 4002] + const res = secondLargestElement(array) + expect(res).toBe(2400) +}) + +test('The second largest element of the array [10, 20, 39, 34] is 34', () => { + const array = [10, 20, 39, 34] + const res = secondLargestElement(array) + expect(res).toBe(34) +}) + +test('The second largest element of the array [1, 20, 3, 40] is 20', () => { + const array = [1, 20, 3, 40] + const res = secondLargestElement(array) + expect(res).toBe(20) +}) diff --git a/Sorts/test/SelectionSort.test.js b/Sorts/test/SelectionSort.test.js index 79f8ce3037..6dd076f663 100644 --- a/Sorts/test/SelectionSort.test.js +++ b/Sorts/test/SelectionSort.test.js @@ -17,6 +17,8 @@ describe('selectionSort', () => { }) it('expects to throw if one of the elements in the array is not a number', () => { - expect(() => selectionSort([1, 'x', 2])).toThrow('One of the items in your array is not a number') + expect(() => selectionSort([1, 'x', 2])).toThrow( + 'One of the items in your array is not a number' + ) }) }) diff --git a/Sorts/test/ShellSort.test.js b/Sorts/test/ShellSort.test.js index 6872d523a5..fd73f74e2e 100644 --- a/Sorts/test/ShellSort.test.js +++ b/Sorts/test/ShellSort.test.js @@ -1,25 +1,25 @@ -import { shellSort } from '../ShellSort' - -test('The ShellSort of the array [5, 4, 3, 2, 1] is [1, 2, 3, 4, 5]', () => { - const arr = [5, 4, 3, 2, 1] - const res = shellSort(arr) - expect(res).toEqual([1, 2, 3, 4, 5]) -}) - -test('The ShellSort of the array [] is []', () => { - const arr = [] - const res = shellSort(arr) - expect(res).toEqual([]) -}) - -test('The ShellSort of the array [15, 24, 31, 42, 11] is [11, 15, 24, 31, 42]', () => { - const arr = [15, 24, 31, 42, 11] - const res = shellSort(arr) - expect(res).toEqual([11, 15, 24, 31, 42]) -}) - -test('The ShellSort of the array [121, 190, 169] is [121, 169, 190]', () => { - const arr = [121, 190, 169] - const res = shellSort(arr) - expect(res).toEqual([121, 169, 190]) -}) +import { shellSort } from '../ShellSort' + +test('The ShellSort of the array [5, 4, 3, 2, 1] is [1, 2, 3, 4, 5]', () => { + const arr = [5, 4, 3, 2, 1] + const res = shellSort(arr) + expect(res).toEqual([1, 2, 3, 4, 5]) +}) + +test('The ShellSort of the array [] is []', () => { + const arr = [] + const res = shellSort(arr) + expect(res).toEqual([]) +}) + +test('The ShellSort of the array [15, 24, 31, 42, 11] is [11, 15, 24, 31, 42]', () => { + const arr = [15, 24, 31, 42, 11] + const res = shellSort(arr) + expect(res).toEqual([11, 15, 24, 31, 42]) +}) + +test('The ShellSort of the array [121, 190, 169] is [121, 169, 190]', () => { + const arr = [121, 190, 169] + const res = shellSort(arr) + expect(res).toEqual([121, 169, 190]) +}) diff --git a/Sorts/test/SimplifiedWiggleSort.test.js b/Sorts/test/SimplifiedWiggleSort.test.js index 9727024010..ceba27732d 100644 --- a/Sorts/test/SimplifiedWiggleSort.test.js +++ b/Sorts/test/SimplifiedWiggleSort.test.js @@ -16,9 +16,12 @@ describe('simplified wiggle sort', () => { expect(simplifiedWiggleSort(src)).toEqual([1, 4, 1, 2, 1]) }) - test('simplified wiggle sort which leads to equal values next to ' + - 'each other', () => { - const src = [3, 3, 5, 1] - expect(simplifiedWiggleSort(src)).toEqual([1, 5, 3, 3]) - }) + test( + 'simplified wiggle sort which leads to equal values next to ' + + 'each other', + () => { + const src = [3, 3, 5, 1] + expect(simplifiedWiggleSort(src)).toEqual([1, 5, 3, 3]) + } + ) }) diff --git a/Sorts/test/TimSort.test.js b/Sorts/test/TimSort.test.js index e134755f5b..4bb5c023e4 100644 --- a/Sorts/test/TimSort.test.js +++ b/Sorts/test/TimSort.test.js @@ -1,25 +1,25 @@ -import { Timsort } from '../TimSort' - -test('The Timsort of the array [5, 4, 3, 2, 1] is [1, 2, 3, 4, 5]', () => { - const arr = [5, 4, 3, 2, 1] - const res = Timsort(arr) - expect(res).toEqual([1, 2, 3, 4, 5]) -}) - -test('The Timsort of the array [] is []', () => { - const arr = [] - const res = Timsort(arr) - expect(res).toEqual([]) -}) - -test('The Timsort of the array [-5, -4, -3, -2, -1] is [-5, -4, -3, -2, -1]', () => { - const arr = [-5, -4, -3, -2, -1] - const res = Timsort(arr) - expect(res).toEqual([-5, -4, -3, -2, -1]) -}) - -test('The Timsort of the array [9, 0, -5, -11, 3] is [-11, -5, 0, 3, 9]', () => { - const arr = [9, 0, -5, -11, 3] - const res = Timsort(arr) - expect(res).toEqual([-11, -5, 0, 3, 9]) -}) +import { Timsort } from '../TimSort' + +test('The Timsort of the array [5, 4, 3, 2, 1] is [1, 2, 3, 4, 5]', () => { + const arr = [5, 4, 3, 2, 1] + const res = Timsort(arr) + expect(res).toEqual([1, 2, 3, 4, 5]) +}) + +test('The Timsort of the array [] is []', () => { + const arr = [] + const res = Timsort(arr) + expect(res).toEqual([]) +}) + +test('The Timsort of the array [-5, -4, -3, -2, -1] is [-5, -4, -3, -2, -1]', () => { + const arr = [-5, -4, -3, -2, -1] + const res = Timsort(arr) + expect(res).toEqual([-5, -4, -3, -2, -1]) +}) + +test('The Timsort of the array [9, 0, -5, -11, 3] is [-11, -5, 0, 3, 9]', () => { + const arr = [9, 0, -5, -11, 3] + const res = Timsort(arr) + expect(res).toEqual([-11, -5, 0, 3, 9]) +}) diff --git a/String/AlphaNumericPalindrome.js b/String/AlphaNumericPalindrome.js index f3de94b642..98976f1d7d 100644 --- a/String/AlphaNumericPalindrome.js +++ b/String/AlphaNumericPalindrome.js @@ -20,11 +20,12 @@ const alphaNumericPalindrome = (str) => { } // removing all the special characters and turning everything to lowercase - const newStr = str.replace(/[^a-z0-9]+/ig, '').toLowerCase() + const newStr = str.replace(/[^a-z0-9]+/gi, '').toLowerCase() const midIndex = newStr.length >> 1 // x >> y = floor(x / 2^y) for (let i = 0; i < midIndex; i++) { - if (newStr.at(i) !== newStr.at(~i)) { // ~n = -(n + 1) + if (newStr.at(i) !== newStr.at(~i)) { + // ~n = -(n + 1) return false } } diff --git a/String/AlternativeStringArrange.js b/String/AlternativeStringArrange.js index b07b0a70d7..72b365b32a 100644 --- a/String/AlternativeStringArrange.js +++ b/String/AlternativeStringArrange.js @@ -22,7 +22,10 @@ const AlternativeStringArrange = (str1, str2) => { // get second string length. const secondStringLength = str2.length // absolute length for operation. - const absLength = firstStringLength > secondStringLength ? firstStringLength : secondStringLength + const absLength = + firstStringLength > secondStringLength + ? firstStringLength + : secondStringLength // Iterate the character count until the absolute count is reached. for (let charCount = 0; charCount < absLength; charCount++) { diff --git a/String/CheckExceeding.js b/String/CheckExceeding.js index 1d2eb55060..bc0d127832 100644 --- a/String/CheckExceeding.js +++ b/String/CheckExceeding.js @@ -11,9 +11,7 @@ const checkExceeding = (str) => { throw new TypeError('Argument is not a string') } - const upperChars = str - .toUpperCase() - .replace(/[^A-Z]/g, '') // remove all from str except A to Z alphabets + const upperChars = str.toUpperCase().replace(/[^A-Z]/g, '') // remove all from str except A to Z alphabets const adjacentDiffList = [] diff --git a/String/CheckPangram.js b/String/CheckPangram.js index bc96fd9316..8e9fbe1e96 100644 --- a/String/CheckPangram.js +++ b/String/CheckPangram.js @@ -24,7 +24,7 @@ const checkPangramRegex = (string) => { * Dot - . -> Matches any character except linebreaks. Equivalent to * Star - * -> Matches 0 or more of the preceding token. * Numeric reference - \{$n} -> Matches the results of a capture group. E.g. - \1 matches the results of the first capture group & \3 matches the third. - */ + */ return string.match(/([a-z])(?!.*\1)/gi).length === 26 } diff --git a/String/CheckRearrangePalindrome.js b/String/CheckRearrangePalindrome.js index f8ea2ccb23..c3feb59f16 100644 --- a/String/CheckRearrangePalindrome.js +++ b/String/CheckRearrangePalindrome.js @@ -1,10 +1,10 @@ /** - * What is a palindrome? https://en.wikipedia.org/wiki/Palindrome - * Receives a string and returns whether it can be rearranged to become a palindrome or not - * The string can only be a palindrome if the count of ALL characters is even or if the ONLY ONE character count is odd - * Input is a string - * - **/ + * What is a palindrome? https://en.wikipedia.org/wiki/Palindrome + * Receives a string and returns whether it can be rearranged to become a palindrome or not + * The string can only be a palindrome if the count of ALL characters is even or if the ONLY ONE character count is odd + * Input is a string + * + **/ export const palindromeRearranging = (str) => { // check that input is a string @@ -23,7 +23,9 @@ export const palindromeRearranging = (str) => { return counts }, {}) // If the length of the resulting array is 0 or 1, the string can be a palindrome. - return Object.values(charCounts).filter(count => count % 2 !== 0).length <= 1 + return ( + Object.values(charCounts).filter((count) => count % 2 !== 0).length <= 1 + ) } // testing diff --git a/String/CheckWordOccurrence.js b/String/CheckWordOccurrence.js index c024d2b597..8412674e68 100644 --- a/String/CheckWordOccurrence.js +++ b/String/CheckWordOccurrence.js @@ -18,13 +18,10 @@ const checkWordOccurrence = (str, isCaseSensitive = false) => { return modifiedStr .split(/\s+/) // remove all spaces and distribute all word in List - .reduce( - (occurrence, word) => { - occurrence[word] = occurrence[word] + 1 || 1 - return occurrence - }, - {} - ) + .reduce((occurrence, word) => { + occurrence[word] = occurrence[word] + 1 || 1 + return occurrence + }, {}) } export { checkWordOccurrence } diff --git a/String/CreatePermutations.js b/String/CreatePermutations.js index 6e5344f742..4d363d1e29 100644 --- a/String/CreatePermutations.js +++ b/String/CreatePermutations.js @@ -5,7 +5,7 @@ More at : https://en.wikipedia.org/wiki/Permutation */ const createPermutations = (str) => { -// convert string to array + // convert string to array const arr = str.split('') // get array length @@ -18,7 +18,9 @@ const createPermutations = (str) => { let next // if strLen is zero, return the same string - if (strLen === 0) { return [str] } + if (strLen === 0) { + return [str] + } // loop to the length to get all permutations for (let i = 0; i < strLen; i++) { rest = Object.create(arr) diff --git a/String/DiceCoefficient.js b/String/DiceCoefficient.js index f12bb0cae3..f6916d5d45 100644 --- a/String/DiceCoefficient.js +++ b/String/DiceCoefficient.js @@ -8,7 +8,7 @@ // Time complexity: O(m + n), m and n being the sizes of string A and string B // Find the bistrings of a string and return a hashmap (key => bistring, value => count) -function mapBigrams (string) { +function mapBigrams(string) { const bigrams = new Map() for (let i = 0; i < string.length - 1; i++) { const bigram = string.substring(i, i + 2) @@ -20,7 +20,7 @@ function mapBigrams (string) { // Calculate the number of common bigrams between a map of bigrams and a string -function countCommonBigrams (bigrams, string) { +function countCommonBigrams(bigrams, string) { let count = 0 for (let i = 0; i < string.length - 1; i++) { const bigram = string.substring(i, i + 2) @@ -30,7 +30,7 @@ function countCommonBigrams (bigrams, string) { } // Calculate Dice coeff of 2 strings -function diceCoefficient (stringA, stringB) { +function diceCoefficient(stringA, stringB) { if (stringA === stringB) return 1 else if (stringA.length < 2 || stringB.length < 2) return 0 diff --git a/String/FormatPhoneNumber.js b/String/FormatPhoneNumber.js index 0a6fe6fc5b..5b50672143 100644 --- a/String/FormatPhoneNumber.js +++ b/String/FormatPhoneNumber.js @@ -4,7 +4,7 @@ * @returns {string} - Format to (XXX) XXX-XXXX pattern */ const formatPhoneNumber = (phoneNumber) => { - if ((phoneNumber.length !== 10) || isNaN(phoneNumber)) { + if (phoneNumber.length !== 10 || isNaN(phoneNumber)) { // return "Invalid phone number." throw new TypeError('Invalid phone number!') } diff --git a/String/GenerateGUID.js b/String/GenerateGUID.js index f30207382b..1583920261 100644 --- a/String/GenerateGUID.js +++ b/String/GenerateGUID.js @@ -7,10 +7,12 @@ The function generate an RFC4122 (https://www.ietf.org/rfc/rfc4122.txt) version export const Guid = () => { const pattern = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' let currentDateMilliseconds = new Date().getTime() - return pattern.replace(/[xy]/g, currentChar => { + return pattern.replace(/[xy]/g, (currentChar) => { const randomChar = (currentDateMilliseconds + Math.random() * 16) % 16 | 0 currentDateMilliseconds = Math.floor(currentDateMilliseconds / 16) - return (currentChar === 'x' ? randomChar : (randomChar & 0x7 | 0x8)).toString(16) + return ( + currentChar === 'x' ? randomChar : (randomChar & 0x7) | 0x8 + ).toString(16) }) } diff --git a/String/IsPalindrome.js b/String/IsPalindrome.js index 60c1c313a4..1e64d22f7f 100644 --- a/String/IsPalindrome.js +++ b/String/IsPalindrome.js @@ -16,7 +16,7 @@ - O(1) */ -export function isPalindromeIterative (x) { +export function isPalindromeIterative(x) { if (typeof x !== 'string' && typeof x !== 'number') { throw new TypeError('Input must be a string or a number') } diff --git a/String/Lower.js b/String/Lower.js index 02b79ffc89..bfdf88c601 100644 --- a/String/Lower.js +++ b/String/Lower.js @@ -12,8 +12,8 @@ const lower = (str) => { throw new TypeError('Invalid Input Type') } - return str.replace( - /[A-Z]/g, (char) => String.fromCharCode(char.charCodeAt() + 32) + return str.replace(/[A-Z]/g, (char) => + String.fromCharCode(char.charCodeAt() + 32) ) } diff --git a/String/MaxCharacter.js b/String/MaxCharacter.js index 98bb57cecf..73f0aff7dd 100644 --- a/String/MaxCharacter.js +++ b/String/MaxCharacter.js @@ -5,7 +5,8 @@ * @param {RegExp} ignorePattern - ignore the char in str that is not required * @returns {string} - char */ -const maxCharacter = (str, ignorePattern) => { // initially it's count only alphabets +const maxCharacter = (str, ignorePattern) => { + // initially it's count only alphabets if (typeof str !== 'string') { throw new TypeError('Argument should be a string') } else if (!str) { diff --git a/String/MaxWord.js b/String/MaxWord.js index 78199e3e9f..633d751481 100644 --- a/String/MaxWord.js +++ b/String/MaxWord.js @@ -22,13 +22,21 @@ const maxWord = (sentence = '') => { } const occurrences = {} - words.forEach(word => { - occurrences[word.toLocaleLowerCase()] = occurrences[word.toLocaleLowerCase()] + 1 || 1 + words.forEach((word) => { + occurrences[word.toLocaleLowerCase()] = + occurrences[word.toLocaleLowerCase()] + 1 || 1 }) - const max = Object.keys(occurrences).reduce((n, word) => { - if (occurrences[word] > n.count) { return { word, count: occurrences[word] } } else { return n } - }, { word: '', count: 0 }) + const max = Object.keys(occurrences).reduce( + (n, word) => { + if (occurrences[word] > n.count) { + return { word, count: occurrences[word] } + } else { + return n + } + }, + { word: '', count: 0 } + ) return max.word } diff --git a/String/PermutateString.js b/String/PermutateString.js index 8ba4bc8a72..d68c0261b9 100644 --- a/String/PermutateString.js +++ b/String/PermutateString.js @@ -8,17 +8,23 @@ const permutate = (aString) => { let permutations = [[characters.shift()]] while (characters.length) { const currentCharacter = characters.shift() - permutations = calculateCurrentCharacterPermutation(permutations, currentCharacter) + permutations = calculateCurrentCharacterPermutation( + permutations, + currentCharacter + ) } return permutations - .map(character => character.join('')) - .filter((item, index, self) => (self.indexOf(item) === index)) + .map((character) => character.join('')) + .filter((item, index, self) => self.indexOf(item) === index) .sort() } -const calculateCurrentCharacterPermutation = (allPermutations, currentCharacter) => { +const calculateCurrentCharacterPermutation = ( + allPermutations, + currentCharacter +) => { const currentPermutations = [] - allPermutations.forEach(permutation => { + allPermutations.forEach((permutation) => { let index = 0 while (index <= permutation.length) { const tmp = [...permutation] diff --git a/String/ReverseString.js b/String/ReverseString.js index 17240e71d1..ae5b617895 100644 --- a/String/ReverseString.js +++ b/String/ReverseString.js @@ -1,7 +1,7 @@ /** * A short example showing how to reverse a string. */ -function ReverseStringIterative (string) { +function ReverseStringIterative(string) { if (typeof string !== 'string') { throw new TypeError('The given value is not a string') } @@ -17,14 +17,14 @@ function ReverseStringIterative (string) { /** * -* @author dev-madhurendra -* Reverses a number by converting it to a string. -* -* @param {string} str - The number to reverse. -* @returns {string} The reversed number. -* -* @example -* const reversed = reverseString("hello"); // Returns olleh + * @author dev-madhurendra + * Reverses a number by converting it to a string. + * + * @param {string} str - The number to reverse. + * @returns {string} The reversed number. + * + * @example + * const reversed = reverseString("hello"); // Returns olleh */ const ReverseStringIterativeInplace = (str) => [...str].reverse().join('') diff --git a/String/Upper.js b/String/Upper.js index 90fc3938cb..3008f3ea3a 100644 --- a/String/Upper.js +++ b/String/Upper.js @@ -11,8 +11,8 @@ const upper = (str) => { throw new TypeError('Argument should be string') } - return str.replace( - /[a-z]/g, (char) => String.fromCharCode(char.charCodeAt() - 32) + return str.replace(/[a-z]/g, (char) => + String.fromCharCode(char.charCodeAt() - 32) ) } diff --git a/String/ValidateCreditCard.js b/String/ValidateCreditCard.js index 9f9a35e518..6fa3799cf5 100644 --- a/String/ValidateCreditCard.js +++ b/String/ValidateCreditCard.js @@ -43,10 +43,14 @@ const validateCreditCard = (creditCardString) => { throw new TypeError(errorMessage + 'it has nonnumerical characters.') } const creditCardStringLength = creditCardString.length - if (!((creditCardStringLength >= 13) && (creditCardStringLength <= 16))) { + if (!(creditCardStringLength >= 13 && creditCardStringLength <= 16)) { throw new Error(errorMessage + 'of its length.') } - if (!validStartSubString.some(subString => creditCardString.startsWith(subString))) { + if ( + !validStartSubString.some((subString) => + creditCardString.startsWith(subString) + ) + ) { throw new Error(errorMessage + 'of its first two digits.') } if (!luhnValidation(creditCardString)) { diff --git a/String/ZFunction.js b/String/ZFunction.js index 0d1ff2b127..9d592a6ddc 100644 --- a/String/ZFunction.js +++ b/String/ZFunction.js @@ -8,7 +8,7 @@ * @return {Array} Returns an array whose i-th index is the value of Z Function for text at index i */ -function zFunction (text) { +function zFunction(text) { const length = text.length const zArray = Array(length).fill(0) // Initializing left and right variable to zero diff --git a/String/test/AlternativeStringArrange.test.js b/String/test/AlternativeStringArrange.test.js index fa8882f15b..9ae657c6e2 100644 --- a/String/test/AlternativeStringArrange.test.js +++ b/String/test/AlternativeStringArrange.test.js @@ -1,22 +1,22 @@ -import { AlternativeStringArrange } from '../AlternativeStringArrange' - -test('AlternativeStringArrange(Agrtm, loih) -> Algorithm', () => { - const str1 = 'Agrtm' - const str2 = 'loih' - const res = AlternativeStringArrange(str1, str2) - expect(res).toEqual('Algorithm') -}) - -test('AlternativeStringArrange(JvSrp, aacit) -> JavaScript', () => { - const str1 = 'JvSrp' - const str2 = 'aacit' - const res = AlternativeStringArrange(str1, str2) - expect(res).toEqual('JavaScript') -}) - -test('AlternativeStringArrange(abc, def) -> adbecf', () => { - const str1 = 'abc' - const str2 = 'def' - const res = AlternativeStringArrange(str1, str2) - expect(res).toEqual('adbecf') -}) +import { AlternativeStringArrange } from '../AlternativeStringArrange' + +test('AlternativeStringArrange(Agrtm, loih) -> Algorithm', () => { + const str1 = 'Agrtm' + const str2 = 'loih' + const res = AlternativeStringArrange(str1, str2) + expect(res).toEqual('Algorithm') +}) + +test('AlternativeStringArrange(JvSrp, aacit) -> JavaScript', () => { + const str1 = 'JvSrp' + const str2 = 'aacit' + const res = AlternativeStringArrange(str1, str2) + expect(res).toEqual('JavaScript') +}) + +test('AlternativeStringArrange(abc, def) -> adbecf', () => { + const str1 = 'abc' + const str2 = 'def' + const res = AlternativeStringArrange(str1, str2) + expect(res).toEqual('adbecf') +}) diff --git a/String/test/CheckAnagram.test.js b/String/test/CheckAnagram.test.js index 44adc196bc..f90bc922f6 100644 --- a/String/test/CheckAnagram.test.js +++ b/String/test/CheckAnagram.test.js @@ -12,9 +12,7 @@ describe('Testing checkAnagramRegex', () => { `( 'expects to throw the type Error given values $inputOne and $inputTwo', ({ inputOne, inputTwo }) => { - expect( - () => checkAnagramRegex(inputOne, inputTwo) - ).toThrowError() + expect(() => checkAnagramRegex(inputOne, inputTwo)).toThrowError() } ) @@ -102,9 +100,7 @@ describe('Testing checkAnagramMap', () => { `( 'expects to throw the type Error given values $inputOne and $inputTwo', ({ inputOne, inputTwo }) => { - expect( - () => checkAnagramMap(inputOne, inputTwo) - ).toThrowError() + expect(() => checkAnagramMap(inputOne, inputTwo)).toThrowError() } ) diff --git a/String/test/CheckExceeding.test.js b/String/test/CheckExceeding.test.js index f0ea4f0848..5318b7357b 100644 --- a/String/test/CheckExceeding.test.js +++ b/String/test/CheckExceeding.test.js @@ -2,7 +2,9 @@ import { checkExceeding } from '../CheckExceeding' describe('Testing CheckExceeding function', () => { it('Testing the invalid types', () => { - expect(() => checkExceeding(Math.random())).toThrow('Argument is not a string') + expect(() => checkExceeding(Math.random())).toThrow( + 'Argument is not a string' + ) expect(() => checkExceeding(null)).toThrow('Argument is not a string') expect(() => checkExceeding(false)).toThrow('Argument is not a string') expect(() => checkExceeding(false)).toThrow('Argument is not a string') diff --git a/String/test/CheckKebabCase.test.js b/String/test/CheckKebabCase.test.js index c275c7bdea..45bc5f2d52 100644 --- a/String/test/CheckKebabCase.test.js +++ b/String/test/CheckKebabCase.test.js @@ -1,13 +1,13 @@ -import { CheckKebabCase } from '../CheckKebabCase' - -test('CheckKebabCase(The-Algorithms) -> true', () => { - const word = 'The-Algorithms' - const res = CheckKebabCase(word) - expect(res).toBeTruthy() -}) - -test('CheckKebabCase(The Algorithms) -> false', () => { - const word = 'The Algorithms' - const res = CheckKebabCase(word) - expect(res).toBeFalsy() -}) +import { CheckKebabCase } from '../CheckKebabCase' + +test('CheckKebabCase(The-Algorithms) -> true', () => { + const word = 'The-Algorithms' + const res = CheckKebabCase(word) + expect(res).toBeTruthy() +}) + +test('CheckKebabCase(The Algorithms) -> false', () => { + const word = 'The Algorithms' + const res = CheckKebabCase(word) + expect(res).toBeFalsy() +}) diff --git a/String/test/CheckPangram.test.js b/String/test/CheckPangram.test.js index 3568307201..fa6e6ec69d 100644 --- a/String/test/CheckPangram.test.js +++ b/String/test/CheckPangram.test.js @@ -8,7 +8,9 @@ describe('Testing checkPangramRegex function', () => { }) it('"Waltz, bad nymph, for quick jigs vex." is a pangram', () => { - expect(checkPangramRegex('Waltz, bad nymph, for quick jigs vex.')).toBe(true) + expect(checkPangramRegex('Waltz, bad nymph, for quick jigs vex.')).toBe( + true + ) }) it('"Jived fox nymph grabs quick waltz." is a pangram', () => { @@ -34,9 +36,9 @@ describe('Testing checkPangramRegex function', () => { describe('Testing checkPangramSet function', () => { it('"The quick brown fox jumps over the lazy dog" is a pangram', () => { - expect( - checkPangramSet('The quick brown fox jumps over the lazy dog') - ).toBe(true) + expect(checkPangramSet('The quick brown fox jumps over the lazy dog')).toBe( + true + ) }) it('"Waltz, bad nymph, for quick jigs vex." is a pangram', () => { @@ -52,9 +54,9 @@ describe('Testing checkPangramSet function', () => { }) it('"The quick brown fox jumps over the la_y dog" is NOT a pangram', () => { - expect( - checkPangramSet('The quick brown fox jumps over the la_y dog') - ).toBe(false) + expect(checkPangramSet('The quick brown fox jumps over the la_y dog')).toBe( + false + ) }) it('Throws an error if given param is not a string', () => { diff --git a/String/test/CheckPascalCase.test.js b/String/test/CheckPascalCase.test.js index 640124c3bc..2587023f79 100644 --- a/String/test/CheckPascalCase.test.js +++ b/String/test/CheckPascalCase.test.js @@ -1,19 +1,19 @@ -import { CheckPascalCase } from '../CheckPascalCase' - -test('CheckPascalCase(TheAlgorithms) -> true', () => { - const word = 'TheAlgorithms' - const res = CheckPascalCase(word) - expect(res).toBeTruthy() -}) - -test('CheckPascalCase(theAlgorithms) -> false', () => { - const word = 'theAlgorithms' - const res = CheckPascalCase(word) - expect(res).toBeFalsy() -}) - -test('CheckPascalCase(The Algorithms) -> false', () => { - const word = 'The Algorithms' - const res = CheckPascalCase(word) - expect(res).toBeFalsy() -}) +import { CheckPascalCase } from '../CheckPascalCase' + +test('CheckPascalCase(TheAlgorithms) -> true', () => { + const word = 'TheAlgorithms' + const res = CheckPascalCase(word) + expect(res).toBeTruthy() +}) + +test('CheckPascalCase(theAlgorithms) -> false', () => { + const word = 'theAlgorithms' + const res = CheckPascalCase(word) + expect(res).toBeFalsy() +}) + +test('CheckPascalCase(The Algorithms) -> false', () => { + const word = 'The Algorithms' + const res = CheckPascalCase(word) + expect(res).toBeFalsy() +}) diff --git a/String/test/CheckRearrangePalindrome.test.js b/String/test/CheckRearrangePalindrome.test.js index df9f158ffc..09429b7257 100644 --- a/String/test/CheckRearrangePalindrome.test.js +++ b/String/test/CheckRearrangePalindrome.test.js @@ -1,25 +1,25 @@ -import { palindromeRearranging } from '../CheckRearrangePalindrome' - -test('palindromeRearranging(apple) -> false', () => { - const word = 'apple' - const res = palindromeRearranging(word) - expect(res).toBeFalsy() -}) - -test('palindromeRearranging(aapplle) -> true', () => { - const word = 'aapplle' - const res = palindromeRearranging(word) - expect(res).toBeTruthy() -}) - -test('palindromeRearranging(value) -> false', () => { - const word = 'value' - const res = palindromeRearranging(word) - expect(res).toBeFalsy() -}) - -test('palindromeRearranging(aaeccrr) -> true', () => { - const word = 'aaeccrr' - const res = palindromeRearranging(word) - expect(res).toBeTruthy() -}) +import { palindromeRearranging } from '../CheckRearrangePalindrome' + +test('palindromeRearranging(apple) -> false', () => { + const word = 'apple' + const res = palindromeRearranging(word) + expect(res).toBeFalsy() +}) + +test('palindromeRearranging(aapplle) -> true', () => { + const word = 'aapplle' + const res = palindromeRearranging(word) + expect(res).toBeTruthy() +}) + +test('palindromeRearranging(value) -> false', () => { + const word = 'value' + const res = palindromeRearranging(word) + expect(res).toBeFalsy() +}) + +test('palindromeRearranging(aaeccrr) -> true', () => { + const word = 'aaeccrr' + const res = palindromeRearranging(word) + expect(res).toBeTruthy() +}) diff --git a/String/test/CheckWordOcurrence.test.js b/String/test/CheckWordOcurrence.test.js index ab699662eb..910dd39c3a 100644 --- a/String/test/CheckWordOcurrence.test.js +++ b/String/test/CheckWordOcurrence.test.js @@ -15,14 +15,33 @@ describe('Testing checkWordOccurrence', () => { it('check occurrence with case sensitive', () => { const stringToTest = 'The quick brown fox jumps over the lazy dog' - const expectResult = { The: 1, quick: 1, brown: 1, fox: 1, jumps: 1, over: 1, the: 1, lazy: 1, dog: 1 } + const expectResult = { + The: 1, + quick: 1, + brown: 1, + fox: 1, + jumps: 1, + over: 1, + the: 1, + lazy: 1, + dog: 1 + } expect(checkWordOccurrence(stringToTest)).toEqual(expectResult) }) it('check occurrence with case insensitive', () => { const stringToTest = 'The quick brown fox jumps over the lazy dog' - const expectResult = { the: 2, quick: 1, brown: 1, fox: 1, jumps: 1, over: 1, lazy: 1, dog: 1 } + const expectResult = { + the: 2, + quick: 1, + brown: 1, + fox: 1, + jumps: 1, + over: 1, + lazy: 1, + dog: 1 + } expect(checkWordOccurrence(stringToTest, true)).toEqual(expectResult) }) diff --git a/String/test/FormatPhoneNumber.test.js b/String/test/FormatPhoneNumber.test.js index 42ae24a8a9..920e63a543 100644 --- a/String/test/FormatPhoneNumber.test.js +++ b/String/test/FormatPhoneNumber.test.js @@ -3,7 +3,9 @@ import formatPhoneNumber from '../FormatPhoneNumber' describe('Testing the formatPhoneNumber functions', () => { it('expects to throw a type error', () => { expect(() => formatPhoneNumber('1234567')).toThrow('Invalid phone number!') - expect(() => formatPhoneNumber('123456text')).toThrow('Invalid phone number!') + expect(() => formatPhoneNumber('123456text')).toThrow( + 'Invalid phone number!' + ) expect(() => formatPhoneNumber(12345)).toThrow('Invalid phone number!') }) diff --git a/String/test/LengthofLongestSubstringWithoutRepetition.test.js b/String/test/LengthofLongestSubstringWithoutRepetition.test.js index 81e475ced4..e2cb565619 100644 --- a/String/test/LengthofLongestSubstringWithoutRepetition.test.js +++ b/String/test/LengthofLongestSubstringWithoutRepetition.test.js @@ -12,7 +12,7 @@ describe('LengthOfLongestSubstring', () => { expect(lengthOfLongestSubstring('bbbbb')).toBe(1) expect(lengthOfLongestSubstring('pwwkew')).toBe(3) expect(lengthOfLongestSubstring(' ')).toBe(1) - expect(lengthOfLongestSubstring('abcdefghijklmnaaaaa')).toBe(13) + expect(lengthOfLongestSubstring('abcdefghijklmnaaaaa')).toBe(14) }) it('should give zero for empty strings', () => { @@ -20,7 +20,7 @@ describe('LengthOfLongestSubstring', () => { }) it('should be case-sensitive', () => { - expect(lengthOfLongestSubstring('AaBbCc')).toBe(3) + expect(lengthOfLongestSubstring('AaBbCc')).toBe(6) expect(lengthOfLongestSubstring('AbCdEf')).toBe(6) }) }) diff --git a/String/test/MaxCharacter.test.js b/String/test/MaxCharacter.test.js index 3de3029e15..d73af578ac 100644 --- a/String/test/MaxCharacter.test.js +++ b/String/test/MaxCharacter.test.js @@ -7,7 +7,7 @@ describe('Testing the maxCharacter function', () => { }) it('Check the max character in string', () => { - const theString = 'I can\'t do that' + const theString = "I can't do that" const maxCharInAllCount = maxCharacter(theString) const maxChar = maxCharacter(theString, /\s/) diff --git a/String/test/PermutateString.test.js b/String/test/PermutateString.test.js index 9d86ebc03e..4b09fece8a 100644 --- a/String/test/PermutateString.test.js +++ b/String/test/PermutateString.test.js @@ -2,7 +2,9 @@ import { permutate } from '../PermutateString' describe('Permutate a string', () => { it('expects to throw an Error with an empty string', () => { - expect(() => { permutate() }).toThrow('The arg must be a valid, non empty string') + expect(() => { + permutate() + }).toThrow('The arg must be a valid, non empty string') }) it('expects to permute "no" into [no, on]', () => { expect(['no', 'on']).toEqual(permutate('no')) @@ -11,7 +13,19 @@ describe('Permutate a string', () => { expect(['esy', 'eys', 'sey', 'sye', 'yes', 'yse']).toEqual(permutate('yes')) }) it('expects to permute "good" into [dgoo dogo doog gdoo godo good odgo odog ogdo ogod oodg oogd ]', () => { - expect(['dgoo', 'dogo', 'doog', 'gdoo', 'godo', 'good', 'odgo', 'odog', 'ogdo', 'ogod', 'oodg', 'oogd']) - .toEqual(permutate('good')) + expect([ + 'dgoo', + 'dogo', + 'doog', + 'gdoo', + 'godo', + 'good', + 'odgo', + 'odog', + 'ogdo', + 'ogod', + 'oodg', + 'oogd' + ]).toEqual(permutate('good')) }) }) diff --git a/String/test/ReverseString.test.js b/String/test/ReverseString.test.js index 0b4478f2cb..45adeda4c1 100644 --- a/String/test/ReverseString.test.js +++ b/String/test/ReverseString.test.js @@ -1,11 +1,16 @@ -import { ReverseStringIterative, ReverseStringIterativeInplace } from '../ReverseString' +import { + ReverseStringIterative, + ReverseStringIterativeInplace +} from '../ReverseString' describe('ReverseStringIterative', () => { it('expects to reverse a simple string', () => { expect(ReverseStringIterative('reverse')).toEqual('esrever') expect(ReverseStringIterative('some')).toEqual('emos') expect(ReverseStringIterative('string')).toEqual('gnirts') - expect(ReverseStringIterative('The Algorithms Javascript')).toEqual('tpircsavaJ smhtiroglA ehT') + expect(ReverseStringIterative('The Algorithms Javascript')).toEqual( + 'tpircsavaJ smhtiroglA ehT' + ) }) it('expects to reverse a string with spaces in between', () => { @@ -25,7 +30,9 @@ describe('ReverseStringIterative', () => { `( 'expects to throw a type error given a value that is $input', ({ input }) => { - expect(() => ReverseStringIterative(input)).toThrow('The given value is not a string') + expect(() => ReverseStringIterative(input)).toThrow( + 'The given value is not a string' + ) } ) diff --git a/String/test/ReverseWords.test.js b/String/test/ReverseWords.test.js index 5808570665..78abb8a879 100644 --- a/String/test/ReverseWords.test.js +++ b/String/test/ReverseWords.test.js @@ -19,6 +19,8 @@ describe('Testing the reverseWords function', () => { it('expects to reverse words to return a joined word', () => { expect(reverseWords('I Love JS')).toBe('JS Love I') expect(reverseWords('Hello World')).toBe('World Hello') - expect(reverseWords('The Algorithms Javascript')).toBe('Javascript Algorithms The') + expect(reverseWords('The Algorithms Javascript')).toBe( + 'Javascript Algorithms The' + ) }) }) diff --git a/String/test/ValidateCreditCard.test.js b/String/test/ValidateCreditCard.test.js index 12f0993cea..bd80df5f9b 100644 --- a/String/test/ValidateCreditCard.test.js +++ b/String/test/ValidateCreditCard.test.js @@ -14,26 +14,48 @@ describe('Validate credit card number', () => { }) it('should throw an error on non-numeric character in given credit card number', () => { const nonNumericCCNumbers = ['123ABCDEF', 'ABCDKDKD', 'ADS232'] - nonNumericCCNumbers.forEach(nonNumericCC => expect(() => validateCreditCard(nonNumericCC)).toThrow( - `${nonNumericCC} is an invalid credit card number because ` + 'it has nonnumerical characters.' - )) + nonNumericCCNumbers.forEach((nonNumericCC) => + expect(() => validateCreditCard(nonNumericCC)).toThrow( + `${nonNumericCC} is an invalid credit card number because ` + + 'it has nonnumerical characters.' + ) + ) }) it('should throw an error on credit card with invalid length', () => { const ccWithInvalidLength = ['41111', '4111111111111111111111'] - ccWithInvalidLength.forEach(invalidCC => expect(() => validateCreditCard(invalidCC)).toThrow( - `${invalidCC} is an invalid credit card number because ` + 'of its length.' - )) + ccWithInvalidLength.forEach((invalidCC) => + expect(() => validateCreditCard(invalidCC)).toThrow( + `${invalidCC} is an invalid credit card number because ` + + 'of its length.' + ) + ) }) it('should throw an error on credit card with invalid start substring', () => { - const ccWithInvalidStartSubstring = ['12345678912345', '23456789123456', '789123456789123', '891234567891234', '912345678912345', '31345678912345', '32345678912345', '33345678912345', '38345678912345'] - ccWithInvalidStartSubstring.forEach(invalidCC => expect(() => validateCreditCard(invalidCC)).toThrow( - `${invalidCC} is an invalid credit card number because ` + 'of its first two digits.' - )) + const ccWithInvalidStartSubstring = [ + '12345678912345', + '23456789123456', + '789123456789123', + '891234567891234', + '912345678912345', + '31345678912345', + '32345678912345', + '33345678912345', + '38345678912345' + ] + ccWithInvalidStartSubstring.forEach((invalidCC) => + expect(() => validateCreditCard(invalidCC)).toThrow( + `${invalidCC} is an invalid credit card number because ` + + 'of its first two digits.' + ) + ) }) it('should throw an error on credit card with luhn check fail', () => { const invalidCCs = ['411111111111111', '371211111111111', '49999999999999'] - invalidCCs.forEach(invalidCC => expect(() => validateCreditCard(invalidCC)).toThrow( - `${invalidCC} is an invalid credit card number because ` + 'it fails the Luhn check.' - )) + invalidCCs.forEach((invalidCC) => + expect(() => validateCreditCard(invalidCC)).toThrow( + `${invalidCC} is an invalid credit card number because ` + + 'it fails the Luhn check.' + ) + ) }) }) diff --git a/String/test/ValidateEmail.test.js b/String/test/ValidateEmail.test.js index a521f53448..1f3aa70ddc 100644 --- a/String/test/ValidateEmail.test.js +++ b/String/test/ValidateEmail.test.js @@ -18,7 +18,11 @@ describe('Validation of an Email Address', () => { }) it('expects to throw a type error', () => { - expect(() => { validateEmail('') }).toThrow('Email Address String Null or Empty.') - expect(() => { validateEmail(null) }).toThrow('Email Address String Null or Empty.') + expect(() => { + validateEmail('') + }).toThrow('Email Address String Null or Empty.') + expect(() => { + validateEmail(null) + }).toThrow('Email Address String Null or Empty.') }) }) diff --git a/Timing-Functions/GetMonthDays.js b/Timing-Functions/GetMonthDays.js index fcf5604d3f..ce188c9603 100644 --- a/Timing-Functions/GetMonthDays.js +++ b/Timing-Functions/GetMonthDays.js @@ -10,19 +10,25 @@ const getMonthDays = (monthNumber, year) => { const the31DaysMonths = [1, 3, 5, 7, 8, 10, 12] const the30DaysMonths = [4, 6, 9, 11] - if (!the31DaysMonths.includes(monthNumber) && !the30DaysMonths.includes(monthNumber) && - (monthNumber !== 2) + if ( + !the31DaysMonths.includes(monthNumber) && + !the30DaysMonths.includes(monthNumber) && + monthNumber !== 2 ) { throw new TypeError('Invalid Month Number.') } - if (the31DaysMonths.includes(monthNumber)) { return 31 } + if (the31DaysMonths.includes(monthNumber)) { + return 31 + } - if (the30DaysMonths.includes(monthNumber)) { return 30 } + if (the30DaysMonths.includes(monthNumber)) { + return 30 + } // Check for Leap year if (year % 4 === 0) { - if ((year % 100 !== 0) || (year % 100 === 0 && year % 400 === 0)) { + if (year % 100 !== 0 || (year % 100 === 0 && year % 400 === 0)) { return 29 } } diff --git a/Timing-Functions/IntervalTimer.js b/Timing-Functions/IntervalTimer.js index 2eeed116e9..4eb34041a0 100644 --- a/Timing-Functions/IntervalTimer.js +++ b/Timing-Functions/IntervalTimer.js @@ -12,8 +12,7 @@ class IntervalTimer { * @param callBack The callback function to be executed. * @return {IntervalTimer} If exists, the existing object. */ - constructor (interval = 10, - callBack = () => {}) { + constructor(interval = 10, callBack = () => {}) { this.prevInterval = 0 if (this.instance == null) { this.interval = interval @@ -27,7 +26,7 @@ class IntervalTimer { /** * @description Starts the timer. */ - startTimer () { + startTimer() { this.timer = setInterval(this.callBack, this.interval) } @@ -35,7 +34,7 @@ class IntervalTimer { * @description Resets the timer. * @return {number} Elapsed time in milliseconds. */ - resetTimer () { + resetTimer() { clearInterval(this.timer) this.callBack = () => {} return this.getElapsedTime() @@ -44,7 +43,7 @@ class IntervalTimer { /** * @return {number} Elapsed time in milliseconds since reset. */ - getElapsedTime (offset = 0) { + getElapsedTime(offset = 0) { this.timeElapsed = this.timer - this.prevInterval this.prevInterval = this.timer return this.timeElapsed - offset @@ -53,7 +52,7 @@ class IntervalTimer { /** * @return {number} Elapsed time since start. */ - getRunTime () { + getRunTime() { return this.timer } } @@ -63,7 +62,7 @@ class IntervalTimer { * Saturday, 01 August 2020 8:33 AM * @description Example usage */ -const ExampleIntervalTimer = function (output = v => console.log(v)) { +const ExampleIntervalTimer = function (output = (v) => console.log(v)) { /** * Create am object with default settings. * @type {IntervalTimer} Used to get timing information. diff --git a/Timing-Functions/test/GetMonthDays.test.js b/Timing-Functions/test/GetMonthDays.test.js index ca92857027..b7527c0ac6 100644 --- a/Timing-Functions/test/GetMonthDays.test.js +++ b/Timing-Functions/test/GetMonthDays.test.js @@ -14,6 +14,8 @@ describe('Get the Days of a Month', () => { }) it('expects to throw a type error', () => { - expect(() => { getMonthDays(13, 2020) }).toThrow('Invalid Month Number.') + expect(() => { + getMonthDays(13, 2020) + }).toThrow('Invalid Month Number.') }) }) diff --git a/Trees/BreadthFirstTreeTraversal.js b/Trees/BreadthFirstTreeTraversal.js index a61b3ca177..a2524c18fd 100644 --- a/Trees/BreadthFirstTreeTraversal.js +++ b/Trees/BreadthFirstTreeTraversal.js @@ -4,7 +4,7 @@ */ class Node { - constructor (data) { + constructor(data) { this.data = data this.left = null this.right = null @@ -12,11 +12,11 @@ class Node { } class BinaryTree { - constructor () { + constructor() { this.root = null } - breadthFirstIterative () { + breadthFirstIterative() { const traversal = [] if (this.root) { traversal.push(this.root) @@ -34,7 +34,7 @@ class BinaryTree { return traversal } - breadthFirstRecursive () { + breadthFirstRecursive() { const traversal = [] const h = this.getHeight(this.root) for (let i = 0; i !== h; i++) { @@ -44,7 +44,7 @@ class BinaryTree { } // Computing the height of the tree - getHeight (node) { + getHeight(node) { if (node === null) { return 0 } @@ -53,7 +53,7 @@ class BinaryTree { return lheight > rheight ? lheight + 1 : rheight + 1 } - traverseLevel (node, levelRemaining, traversal) { + traverseLevel(node, levelRemaining, traversal) { if (node === null) { return } diff --git a/Trees/DepthFirstSearch.js b/Trees/DepthFirstSearch.js index 4c0c43db41..7c67afc95e 100644 --- a/Trees/DepthFirstSearch.js +++ b/Trees/DepthFirstSearch.js @@ -2,10 +2,10 @@ * Author: Surendra Kumar * DFS Algorithm implementation in JavaScript * DFS Algorithm for traversing or searching graph data structures. -*/ + */ // traverses a give tree from specified root's value -function traverseDFS (tree, rootValue) { +function traverseDFS(tree, rootValue) { const stack = [] const res = [] stack.push(searchDFS(tree, rootValue)) @@ -24,7 +24,7 @@ function traverseDFS (tree, rootValue) { return res.reverse() } -function searchDFS (tree, value) { +function searchDFS(tree, value) { const stack = [] stack.push(tree[0]) while (stack.length !== 0) { diff --git a/Trees/FenwickTree.js b/Trees/FenwickTree.js index f3c65f56d0..d84b4f0f66 100644 --- a/Trees/FenwickTree.js +++ b/Trees/FenwickTree.js @@ -2,10 +2,10 @@ * Author: Mohit Kumar * Fenwick Tree Implementation in JavaScript * Fenwick Tree Implementation for finding prefix sum. -*/ + */ class FenwickTree { - constructor (feneickArray, array, n) { + constructor(feneickArray, array, n) { for (let i = 1; i <= n; i++) { feneickArray[i] = 0 } @@ -14,20 +14,20 @@ class FenwickTree { } } - update (feneickArray, n, index, value) { + update(feneickArray, n, index, value) { index = index + 1 while (index <= n) { feneickArray[index] += value - index += index & (-index) + index += index & -index } } - getPrefixSum (feneickArray, index) { + getPrefixSum(feneickArray, index) { let currSum = 0 index = index + 1 while (index > 0) { currSum += feneickArray[index] - index -= index & (-index) + index -= index & -index } return currSum diff --git a/babel.config.cjs b/babel.config.cjs deleted file mode 100644 index c5d271064b..0000000000 --- a/babel.config.cjs +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = { - presets: [ - [ - '@babel/preset-env', - { - targets: { - esmodules: true - } - } - ] - ] -} diff --git a/package-lock.json b/package-lock.json index 2c86fde142..7a282547ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,14445 +8,2266 @@ "name": "javascript", "version": "1.0.0", "license": "GPL-3.0", - "dependencies": { - "@babel/core": "^7.19.3", - "@babel/plugin-transform-runtime": "^7.19.1", - "@babel/preset-env": "^7.19.4" - }, "devDependencies": { - "@babel/eslint-parser": "^7.19.1", - "@types/jest": "^29.1.2", - "babel-jest": "^29.2.0", - "globby": "^13.1.2", - "husky": "^8.0.1", - "jest": "^29.2.0", - "standard": "^17.0.0" + "globby": "^13.2.2", + "husky": "^8.0.3", + "prettier": "^3.0.3", + "vitest": "^0.34.6" }, "engines": { - "node": ">=16.6.0" + "node": ">=20.6.0" } }, - "node_modules/@ampproject/remapping": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", - "integrity": "sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==", - "dependencies": { - "@jridgewell/gen-mapping": "^0.1.0", - "@jridgewell/trace-mapping": "^0.3.9" - }, + "node_modules/@esbuild/android-arm": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", + "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">=6.0.0" + "node": ">=12" } }, - "node_modules/@babel/code-frame": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", - "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", - "dependencies": { - "@babel/highlight": "^7.18.6" - }, + "node_modules/@esbuild/android-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", + "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">=6.9.0" + "node": ">=12" } }, - "node_modules/@babel/compat-data": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.19.4.tgz", - "integrity": "sha512-CHIGpJcUQ5lU9KrPHTjBMhVwQG6CQjxfg36fGXl3qk/Gik1WwWachaXFuo0uCWJT/mStOKtcbFJCaVLihC1CMw==", + "node_modules/@esbuild/android-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", + "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">=6.9.0" + "node": ">=12" } }, - "node_modules/@babel/core": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.19.3.tgz", - "integrity": "sha512-WneDJxdsjEvyKtXKsaBGbDeiyOjR5vYq4HcShxnIbG0qixpoHjI3MqeZM9NDvsojNCEBItQE4juOo/bU6e72gQ==", - "dependencies": { - "@ampproject/remapping": "^2.1.0", - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.19.3", - "@babel/helper-compilation-targets": "^7.19.3", - "@babel/helper-module-transforms": "^7.19.0", - "@babel/helpers": "^7.19.0", - "@babel/parser": "^7.19.3", - "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.3", - "@babel/types": "^7.19.3", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.1", - "semver": "^6.3.0" - }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", + "integrity": "sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" + "node": ">=12" } }, - "node_modules/@babel/eslint-parser": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.19.1.tgz", - "integrity": "sha512-AqNf2QWt1rtu2/1rLswy6CDP7H9Oh3mMhk177Y67Rg8d7RD9WfOLLv8CGn6tisFvS2htm86yIe1yLF6I1UDaGQ==", + "node_modules/@esbuild/darwin-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", + "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "@nicolo-ribaudo/eslint-scope-5-internals": "5.1.1-v1", - "eslint-visitor-keys": "^2.1.0", - "semver": "^6.3.0" - }, + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": "^10.13.0 || ^12.13.0 || >=14.0.0" - }, - "peerDependencies": { - "@babel/core": ">=7.11.0", - "eslint": "^7.5.0 || ^8.0.0" + "node": ">=12" } }, - "node_modules/@babel/generator": { - "version": "7.19.5", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.19.5.tgz", - "integrity": "sha512-DxbNz9Lz4aMZ99qPpO1raTbcrI1ZeYh+9NR9qhfkQIbFtVEqotHojEBxHzmxhVONkGt6VyrqVQcgpefMy9pqcg==", - "dependencies": { - "@babel/types": "^7.19.4", - "@jridgewell/gen-mapping": "^0.3.2", - "jsesc": "^2.5.1" - }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", + "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], "engines": { - "node": ">=6.9.0" + "node": ">=12" } }, - "node_modules/@babel/generator/node_modules/@jridgewell/gen-mapping": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz", - "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==", - "dependencies": { - "@jridgewell/set-array": "^1.0.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" - }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", + "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], "engines": { - "node": ">=6.0.0" + "node": ">=12" } }, - "node_modules/@babel/helper-annotate-as-pure": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.18.6.tgz", - "integrity": "sha512-duORpUiYrEpzKIop6iNbjnwKLAKnJ47csTyRACyEmWj0QdUrm5aqNJGHSSEQSUAvNW0ojX0dOmK9dZduvkfeXA==", - "dependencies": { - "@babel/types": "^7.18.6" - }, + "node_modules/@esbuild/linux-arm": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", + "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=6.9.0" + "node": ">=12" } }, - "node_modules/@babel/helper-builder-binary-assignment-operator-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.18.9.tgz", - "integrity": "sha512-yFQ0YCHoIqarl8BCRwBL8ulYUaZpz3bNsA7oFepAzee+8/+ImtADXNOmO5vJvsPff3qi+hvpkY/NYBTrBQgdNw==", - "dependencies": { - "@babel/helper-explode-assignable-expression": "^7.18.6", - "@babel/types": "^7.18.9" - }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", + "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=6.9.0" + "node": ">=12" } }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.3.tgz", - "integrity": "sha512-65ESqLGyGmLvgR0mst5AdW1FkNlj9rQsCKduzEoEPhBCDFGXvz2jW6bXFG6i0/MrV2s7hhXjjb2yAzcPuQlLwg==", - "dependencies": { - "@babel/compat-data": "^7.19.3", - "@babel/helper-validator-option": "^7.18.6", - "browserslist": "^4.21.3", - "semver": "^6.3.0" - }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", + "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" + "node": ">=12" } }, - "node_modules/@babel/helper-create-class-features-plugin": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.19.0.tgz", - "integrity": "sha512-NRz8DwF4jT3UfrmUoZjd0Uph9HQnP30t7Ash+weACcyNkiYTywpIjDBgReJMKgr+n86sn2nPVVmJ28Dm053Kqw==", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.19.0", - "@babel/helper-member-expression-to-functions": "^7.18.9", - "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/helper-replace-supers": "^7.18.9", - "@babel/helper-split-export-declaration": "^7.18.6" - }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", + "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" + "node": ">=12" } }, - "node_modules/@babel/helper-create-regexp-features-plugin": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.19.0.tgz", - "integrity": "sha512-htnV+mHX32DF81amCDrwIDr8nrp1PTm+3wfBN9/v8QJOLEioOCOG7qNyq0nHeFiWbT3Eb7gsPwEmV64UCQ1jzw==", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "regexpu-core": "^5.1.0" - }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", + "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-define-polyfill-provider": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.3.tgz", - "integrity": "sha512-z5aQKU4IzbqCC1XH0nAqfsFLMVSo22SBKUc0BxGrLkolTdPTructy0ToNnlO2zA4j9Q/7pjMZf0DSY+DSTYzww==", - "dependencies": { - "@babel/helper-compilation-targets": "^7.17.7", - "@babel/helper-plugin-utils": "^7.16.7", - "debug": "^4.1.1", - "lodash.debounce": "^4.0.8", - "resolve": "^1.14.2", - "semver": "^6.1.2" - }, - "peerDependencies": { - "@babel/core": "^7.4.0-0" + "node": ">=12" } }, - "node_modules/@babel/helper-environment-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", - "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", + "node_modules/@esbuild/linux-ppc64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", + "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=6.9.0" + "node": ">=12" } }, - "node_modules/@babel/helper-explode-assignable-expression": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.18.6.tgz", - "integrity": "sha512-eyAYAsQmB80jNfg4baAtLeWAQHfHFiR483rzFK+BhETlGZaQC9bsfrugfXDCbRHLQbIA7U5NxhhOxN7p/dWIcg==", - "dependencies": { - "@babel/types": "^7.18.6" - }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", + "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=6.9.0" + "node": ">=12" } }, - "node_modules/@babel/helper-function-name": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz", - "integrity": "sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w==", - "dependencies": { - "@babel/template": "^7.18.10", - "@babel/types": "^7.19.0" - }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", + "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=6.9.0" + "node": ">=12" } }, - "node_modules/@babel/helper-hoist-variables": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", - "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", - "dependencies": { - "@babel/types": "^7.18.6" - }, + "node_modules/@esbuild/linux-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", + "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=6.9.0" + "node": ">=12" } }, - "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.18.9.tgz", - "integrity": "sha512-RxifAh2ZoVU67PyKIO4AMi1wTenGfMR/O/ae0CCRqwgBAt5v7xjdtRw7UoSbsreKrQn5t7r89eruK/9JjYHuDg==", - "dependencies": { - "@babel/types": "^7.18.9" - }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", + "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], "engines": { - "node": ">=6.9.0" + "node": ">=12" } }, - "node_modules/@babel/helper-module-imports": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz", - "integrity": "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==", - "dependencies": { - "@babel/types": "^7.18.6" - }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", + "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], "engines": { - "node": ">=6.9.0" + "node": ">=12" } }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.19.0.tgz", - "integrity": "sha512-3HBZ377Fe14RbLIA+ac3sY4PTgpxHVkFrESaWhoI5PuyXPBBX8+C34qblV9G89ZtycGJCmCI/Ut+VUDK4bltNQ==", - "dependencies": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-simple-access": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/helper-validator-identifier": "^7.18.6", - "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.0", - "@babel/types": "^7.19.0" - }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", + "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], "engines": { - "node": ">=6.9.0" + "node": ">=12" } }, - "node_modules/@babel/helper-optimise-call-expression": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.18.6.tgz", - "integrity": "sha512-HP59oD9/fEHQkdcbgFCnbmgH5vIQTJbxh2yf+CdM89/glUNnuzr87Q8GIjGEnOktTROemO0Pe0iPAYbqZuOUiA==", - "dependencies": { - "@babel/types": "^7.18.6" - }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", + "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=6.9.0" + "node": ">=12" } }, - "node_modules/@babel/helper-plugin-utils": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.19.0.tgz", - "integrity": "sha512-40Ryx7I8mT+0gaNxm8JGTZFUITNqdLAgdg0hXzeVZxVD6nFsdhQvip6v8dqkRHzsz1VFpFAaOCHNn0vKBL7Czw==", + "node_modules/@esbuild/win32-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", + "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=6.9.0" + "node": ">=12" } }, - "node_modules/@babel/helper-remap-async-to-generator": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.18.9.tgz", - "integrity": "sha512-dI7q50YKd8BAv3VEfgg7PS7yD3Rtbi2J1XMXaalXO0W0164hYLnh8zpjRS0mte9MfVp/tltvr/cfdXPvJr1opA==", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-wrap-function": "^7.18.9", - "@babel/types": "^7.18.9" - }, + "node_modules/@esbuild/win32-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", + "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" + "node": ">=12" } }, - "node_modules/@babel/helper-replace-supers": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.19.1.tgz", - "integrity": "sha512-T7ahH7wV0Hfs46SFh5Jz3s0B6+o8g3c+7TMxu7xKfmHikg7EAZ3I2Qk9LFhjxXq8sL7UkP5JflezNwoZa8WvWw==", + "node_modules/@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "dev": true, "dependencies": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-member-expression-to-functions": "^7.18.9", - "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/traverse": "^7.19.1", - "@babel/types": "^7.19.0" + "@sinclair/typebox": "^0.27.8" }, "engines": { - "node": ">=6.9.0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@babel/helper-simple-access": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.19.4.tgz", - "integrity": "sha512-f9Xq6WqBFqaDfbCzn2w85hwklswz5qsKlh7f08w4Y9yhJHpnNC0QemtSkK5YyOY8kPGvyiwdzZksGUhnGdaUIg==", + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, "dependencies": { - "@babel/types": "^7.19.4" + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" }, "engines": { - "node": ">=6.9.0" + "node": ">= 8" } }, - "node_modules/@babel/helper-skip-transparent-expression-wrappers": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.18.9.tgz", - "integrity": "sha512-imytd2gHi3cJPsybLRbmFrF7u5BIEuI2cNheyKi3/iOBC63kNn3q8Crn2xVuESli0aM4KYsyEqKyS7lFL8YVtw==", - "dependencies": { - "@babel/types": "^7.18.9" - }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, "engines": { - "node": ">=6.9.0" + "node": ">= 8" } }, - "node_modules/@babel/helper-split-export-declaration": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", - "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, "dependencies": { - "@babel/types": "^7.18.6" + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" }, "engines": { - "node": ">=6.9.0" + "node": ">= 8" } }, - "node_modules/@babel/helper-string-parser": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", - "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", - "engines": { - "node": ">=6.9.0" - } + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", - "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", - "engines": { - "node": ">=6.9.0" - } + "node_modules/@types/chai": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.6.tgz", + "integrity": "sha512-VOVRLM1mBxIRxydiViqPcKn6MIxZytrbMpd6RJLIWKxUNr3zux8no0Oc7kJx0WAPIitgZ0gkrDS+btlqQpubpw==", + "dev": true }, - "node_modules/@babel/helper-validator-option": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz", - "integrity": "sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==", - "engines": { - "node": ">=6.9.0" + "node_modules/@types/chai-subset": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz", + "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==", + "dev": true, + "dependencies": { + "@types/chai": "*" } }, - "node_modules/@babel/helper-wrap-function": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.19.0.tgz", - "integrity": "sha512-txX8aN8CZyYGTwcLhlk87KRqncAzhh5TpQamZUa0/u3an36NtDpUP6bQgBCBcLeBs09R/OwQu3OjK0k/HwfNDg==", + "node_modules/@types/node": { + "version": "18.11.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.0.tgz", + "integrity": "sha512-IOXCvVRToe7e0ny7HpT/X9Rb2RYtElG1a+VshjwT00HxrM2dWBApHQoqsI6WiY7Q03vdf2bCrIGzVrkF/5t10w==", + "dev": true + }, + "node_modules/@vitest/expect": { + "version": "0.34.6", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.34.6.tgz", + "integrity": "sha512-QUzKpUQRc1qC7qdGo7rMK3AkETI7w18gTCUrsNnyjjJKYiuUB9+TQK3QnR1unhCnWRC0AbKv2omLGQDF/mIjOw==", + "dev": true, "dependencies": { - "@babel/helper-function-name": "^7.19.0", - "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.0", - "@babel/types": "^7.19.0" + "@vitest/spy": "0.34.6", + "@vitest/utils": "0.34.6", + "chai": "^4.3.10" }, - "engines": { - "node": ">=6.9.0" + "funding": { + "url": "https://opencollective.com/vitest" } }, - "node_modules/@babel/helpers": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.19.4.tgz", - "integrity": "sha512-G+z3aOx2nfDHwX/kyVii5fJq+bgscg89/dJNWpYeKeBv3v9xX8EIabmx1k6u9LS04H7nROFVRVK+e3k0VHp+sw==", + "node_modules/@vitest/runner": { + "version": "0.34.6", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-0.34.6.tgz", + "integrity": "sha512-1CUQgtJSLF47NnhN+F9X2ycxUP0kLHQ/JWvNHbeBfwW8CzEGgeskzNnHDyv1ieKTltuR6sdIHV+nmR6kPxQqzQ==", + "dev": true, "dependencies": { - "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.4", - "@babel/types": "^7.19.4" + "@vitest/utils": "0.34.6", + "p-limit": "^4.0.0", + "pathe": "^1.1.1" }, - "engines": { - "node": ">=6.9.0" + "funding": { + "url": "https://opencollective.com/vitest" } }, - "node_modules/@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "node_modules/@vitest/runner/node_modules/p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" + "yocto-queue": "^1.0.0" }, "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/parser": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.4.tgz", - "integrity": "sha512-qpVT7gtuOLjWeDTKLkJ6sryqLliBaFpAtGeqw5cs5giLldvh+Ch0plqnUMKoVAUS6ZEueQQiZV+p5pxtPitEsA==", - "bin": { - "parser": "bin/babel-parser.js" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, - "engines": { - "node": ">=6.0.0" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.18.6.tgz", - "integrity": "sha512-Dgxsyg54Fx1d4Nge8UnvTrED63vrwOdPmyvPzlNN/boaliRP54pm3pGzZD1SJUwrBA+Cs/xdG8kXX6Mn/RfISQ==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" - }, + "node_modules/@vitest/runner/node_modules/yocto-queue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", + "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", + "dev": true, "engines": { - "node": ">=6.9.0" + "node": ">=12.20" }, - "peerDependencies": { - "@babel/core": "^7.0.0" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.18.9.tgz", - "integrity": "sha512-AHrP9jadvH7qlOj6PINbgSuphjQUAK7AOT7DPjBo9EHoLhQTnnK5u45e1Hd4DbSQEO9nqPWtQ89r+XEOWFScKg==", + "node_modules/@vitest/snapshot": { + "version": "0.34.6", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-0.34.6.tgz", + "integrity": "sha512-B3OZqYn6k4VaN011D+ve+AA4whM4QkcwcrwaKwAbyyvS/NB1hCWjFIBQxAQQSQir9/RtyAAGuq+4RJmbn2dH4w==", + "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-skip-transparent-expression-wrappers": "^7.18.9", - "@babel/plugin-proposal-optional-chaining": "^7.18.9" + "magic-string": "^0.30.1", + "pathe": "^1.1.1", + "pretty-format": "^29.5.0" }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.13.0" + "funding": { + "url": "https://opencollective.com/vitest" } }, - "node_modules/@babel/plugin-proposal-async-generator-functions": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.19.1.tgz", - "integrity": "sha512-0yu8vNATgLy4ivqMNBIwb1HebCelqN7YX8SL3FDXORv/RqT0zEEWUCH4GH44JsSrvCu6GqnAdR5EBFAPeNBB4Q==", + "node_modules/@vitest/spy": { + "version": "0.34.6", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-0.34.6.tgz", + "integrity": "sha512-xaCvneSaeBw/cz8ySmF7ZwGvL0lBjfvqc1LpQ/vcdHEvpLn3Ff1vAvjw+CoGn0802l++5L/pxb7whwcWAw+DUQ==", + "dev": true, "dependencies": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-remap-async-to-generator": "^7.18.9", - "@babel/plugin-syntax-async-generators": "^7.8.4" - }, - "engines": { - "node": ">=6.9.0" + "tinyspy": "^2.1.1" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "funding": { + "url": "https://opencollective.com/vitest" } }, - "node_modules/@babel/plugin-proposal-class-properties": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz", - "integrity": "sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ==", + "node_modules/@vitest/utils": { + "version": "0.34.6", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-0.34.6.tgz", + "integrity": "sha512-IG5aDD8S6zlvloDsnzHw0Ut5xczlF+kv2BOTo+iXfPr54Yhi5qbVOgGB1hZaVq4iJ4C/MZ2J0y15IlsV/ZcI0A==", + "dev": true, "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" + "diff-sequences": "^29.4.3", + "loupe": "^2.3.6", + "pretty-format": "^29.5.0" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "funding": { + "url": "https://opencollective.com/vitest" } }, - "node_modules/@babel/plugin-proposal-class-static-block": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.18.6.tgz", - "integrity": "sha512-+I3oIiNxrCpup3Gi8n5IGMwj0gOCAjcJUSQEcotNnCCPMEnixawOQ+KeJPlgfjzx+FKQ1QSyZOWe7wmoJp7vhw==", - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-class-static-block": "^7.14.5" + "node_modules/acorn": { + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "dev": true, + "bin": { + "acorn": "bin/acorn" }, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.12.0" + "node": ">=0.4.0" } }, - "node_modules/@babel/plugin-proposal-dynamic-import": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.18.6.tgz", - "integrity": "sha512-1auuwmK+Rz13SJj36R+jqFPMJWyKEDd7lLSdOj4oJK0UTgGueSAtkrCvz9ewmgyU/P941Rv2fQwZJN8s6QruXw==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-dynamic-import": "^7.8.3" - }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": ">=0.4.0" } }, - "node_modules/@babel/plugin-proposal-export-namespace-from": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.18.9.tgz", - "integrity": "sha512-k1NtHyOMvlDDFeb9G5PhUXuGj8m/wiwojgQVEhJ/fsVsMCpLyOP4h0uGEjYJKrRI+EVPlb5Jk+Gt9P97lOGwtA==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3" - }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": "*" } }, - "node_modules/@babel/plugin-proposal-json-strings": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.18.6.tgz", - "integrity": "sha512-lr1peyn9kOdbYc0xr0OdHTZ5FMqS6Di+H0Fz2I/JwMzGmzJETNeOFq2pBySw6X/KFL5EWDjlJuMsUGRFb8fQgQ==", + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-json-strings": "^7.8.3" + "fill-range": "^7.0.1" }, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": ">=8" } }, - "node_modules/@babel/plugin-proposal-logical-assignment-operators": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.18.9.tgz", - "integrity": "sha512-128YbMpjCrP35IOExw2Fq+x55LMP42DzhOhX2aNNIdI9avSWl2PI0yuBWarr3RYpZBSPtabfadkH2yeRiMD61Q==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" - }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": ">=8" } }, - "node_modules/@babel/plugin-proposal-nullish-coalescing-operator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.18.6.tgz", - "integrity": "sha512-wQxQzxYeJqHcfppzBDnm1yAY0jSRkUXR2z8RePZYrKwMKgMlE8+Z6LUno+bd6LvbGh8Gltvy74+9pIYkr+XkKA==", + "node_modules/chai": { + "version": "4.3.10", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.10.tgz", + "integrity": "sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==", + "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" + "assertion-error": "^1.1.0", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", + "pathval": "^1.1.1", + "type-detect": "^4.0.8" }, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": ">=4" } }, - "node_modules/@babel/plugin-proposal-numeric-separator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.18.6.tgz", - "integrity": "sha512-ozlZFogPqoLm8WBr5Z8UckIoE4YQ5KESVcNudyXOR8uqIkliTEgJ3RoketfG6pmzLdeZF0H/wjE9/cCEitBl7Q==", + "node_modules/check-error": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", + "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-numeric-separator": "^7.10.4" + "get-func-name": "^2.0.2" }, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": "*" } }, - "node_modules/@babel/plugin-proposal-object-rest-spread": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.19.4.tgz", - "integrity": "sha512-wHmj6LDxVDnL+3WhXteUBaoM1aVILZODAUjg11kHqG4cOlfgMQGxw6aCgvrXrmaJR3Bn14oZhImyCPZzRpC93Q==", + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, "dependencies": { - "@babel/compat-data": "^7.19.4", - "@babel/helper-compilation-targets": "^7.19.3", - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.18.8" + "ms": "2.1.2" }, "engines": { - "node": ">=6.9.0" + "node": ">=6.0" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "node_modules/@babel/plugin-proposal-optional-catch-binding": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.18.6.tgz", - "integrity": "sha512-Q40HEhs9DJQyaZfUjjn6vE8Cv4GmMHCYuMGIWUnlxH6400VGxOuwWsPt4FxXxJkC/5eOzgn0z21M9gMT4MOhbw==", + "node_modules/deep-eql": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" + "type-detect": "^4.0.0" }, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": ">=6" } }, - "node_modules/@babel/plugin-proposal-optional-chaining": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.18.9.tgz", - "integrity": "sha512-v5nwt4IqBXihxGsW2QmCWMDS3B3bzGIk/EQVZz2ei7f3NJl8NzAJVvUmpDW5q1CRNY+Beb/k58UAH1Km1N411w==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-skip-transparent-expression-wrappers": "^7.18.9", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" - }, + "node_modules/diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "dev": true, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@babel/plugin-proposal-private-methods": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.18.6.tgz", - "integrity": "sha512-nutsvktDItsNn4rpGItSNV2sz1XwS+nfU0Rg8aCx3W3NOKVzdMjJRu0O5OkgDp3ZGICSTbgRpxZoWsxoKRvbeA==", + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" + "path-type": "^4.0.0" }, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": ">=8" } }, - "node_modules/@babel/plugin-proposal-private-property-in-object": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.18.6.tgz", - "integrity": "sha512-9Rysx7FOctvT5ouj5JODjAFAkgGoudQuLPamZb0v1TGLpapdNaftzifU8NTWQm0IRjqoYypdrSmyWgkocDQ8Dw==", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5" + "node_modules/esbuild": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", + "integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" }, "engines": { - "node": ">=6.9.0" + "node": ">=12" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "optionalDependencies": { + "@esbuild/android-arm": "0.18.20", + "@esbuild/android-arm64": "0.18.20", + "@esbuild/android-x64": "0.18.20", + "@esbuild/darwin-arm64": "0.18.20", + "@esbuild/darwin-x64": "0.18.20", + "@esbuild/freebsd-arm64": "0.18.20", + "@esbuild/freebsd-x64": "0.18.20", + "@esbuild/linux-arm": "0.18.20", + "@esbuild/linux-arm64": "0.18.20", + "@esbuild/linux-ia32": "0.18.20", + "@esbuild/linux-loong64": "0.18.20", + "@esbuild/linux-mips64el": "0.18.20", + "@esbuild/linux-ppc64": "0.18.20", + "@esbuild/linux-riscv64": "0.18.20", + "@esbuild/linux-s390x": "0.18.20", + "@esbuild/linux-x64": "0.18.20", + "@esbuild/netbsd-x64": "0.18.20", + "@esbuild/openbsd-x64": "0.18.20", + "@esbuild/sunos-x64": "0.18.20", + "@esbuild/win32-arm64": "0.18.20", + "@esbuild/win32-ia32": "0.18.20", + "@esbuild/win32-x64": "0.18.20" } }, - "node_modules/@babel/plugin-proposal-unicode-property-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.18.6.tgz", - "integrity": "sha512-2BShG/d5yoZyXZfVePH91urL5wTG6ASZU9M4o03lKK8u8UW1y08OMttBSOADTcJrnPMpvDXRG3G8fyLh4ovs8w==", + "node_modules/fast-glob": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", + "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", + "dev": true, "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" }, "engines": { - "node": ">=4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-async-generators": { - "version": "7.8.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", - "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": ">=8.6.0" } }, - "node_modules/@babel/plugin-syntax-bigint": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", - "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "node_modules/fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "reusify": "^1.0.4" } }, - "node_modules/@babel/plugin-syntax-class-properties": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", - "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.12.13" + "to-regex-range": "^5.0.1" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "engines": { + "node": ">=8" } }, - "node_modules/@babel/plugin-syntax-class-static-block": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", - "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/@babel/plugin-syntax-dynamic-import": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", - "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node_modules/get-func-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", + "dev": true, + "engines": { + "node": "*" } }, - "node_modules/@babel/plugin-syntax-export-namespace-from": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz", - "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==", + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.8.3" + "is-glob": "^4.0.1" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "engines": { + "node": ">= 6" } }, - "node_modules/@babel/plugin-syntax-import-assertions": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.18.6.tgz", - "integrity": "sha512-/DU3RXad9+bZwrgWJQKbr39gYbJpLJHezqEzRzi/BHRlJ9zsQb4CK2CA/5apllXNomwA1qHwzvHl+AdEmC5krQ==", + "node_modules/globby": { + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", + "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", + "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "dir-glob": "^3.0.1", + "fast-glob": "^3.3.0", + "ignore": "^5.2.4", + "merge2": "^1.4.1", + "slash": "^4.0.0" }, "engines": { - "node": ">=6.9.0" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@babel/plugin-syntax-import-meta": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", - "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "node_modules/globby/node_modules/slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-json-strings": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", - "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "engines": { + "node": ">=12" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz", - "integrity": "sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==", + "node_modules/husky": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "bin": { + "husky": "lib/bin.js" }, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-logical-assignment-operators": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", - "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" + "node": ">=14" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "funding": { + "url": "https://github.com/sponsors/typicode" } }, - "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", - "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node_modules/ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true, + "engines": { + "node": ">= 4" } }, - "node_modules/@babel/plugin-syntax-numeric-separator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", - "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true, + "engines": { + "node": ">=0.10.0" } }, - "node_modules/@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", - "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "is-extglob": "^2.1.1" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "engines": { + "node": ">=0.10.0" } }, - "node_modules/@babel/plugin-syntax-optional-catch-binding": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", - "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" } }, - "node_modules/@babel/plugin-syntax-optional-chaining": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", - "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } + "node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "dev": true }, - "node_modules/@babel/plugin-syntax-private-property-in-object": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", - "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, + "node_modules/local-pkg": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.3.tgz", + "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==", + "dev": true, "engines": { - "node": ">=6.9.0" + "node": ">=14" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "funding": { + "url": "https://github.com/sponsors/antfu" } }, - "node_modules/@babel/plugin-syntax-top-level-await": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", - "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "node_modules/loupe": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", + "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", + "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "get-func-name": "^2.0.0" } }, - "node_modules/@babel/plugin-syntax-typescript": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.18.6.tgz", - "integrity": "sha512-mAWAuq4rvOepWCBid55JuRNvpTNf2UGVgoz4JV0fXEKolsVZDzsa4NqCef758WZJj/GDu0gVGItjKFiClTAmZA==", + "node_modules/magic-string": { + "version": "0.30.4", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.4.tgz", + "integrity": "sha512-Q/TKtsC5BPm0kGqgBIF9oXAs/xEf2vRKiIB4wCRQTJOQIByZ1d+NnUOotvJOvNpi5RNIgVOMC3pOuaP1ZTDlVg==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@jridgewell/sourcemap-codec": "^1.4.15" }, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": ">=12" } }, - "node_modules/@babel/plugin-transform-arrow-functions": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.18.6.tgz", - "integrity": "sha512-9S9X9RUefzrsHZmKMbDXxweEH+YlE8JJEuat9FdvW9Qh1cw7W64jELCtWNkPBPX5En45uy28KGvA/AySqUh8CQ==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" } }, - "node_modules/@babel/plugin-transform-async-to-generator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.18.6.tgz", - "integrity": "sha512-ARE5wZLKnTgPW7/1ftQmSi1CmkqqHo2DNmtztFhvgtOWSDfq0Cq9/9L+KnZNYSNrydBekhW3rwShduf59RoXag==", + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, "dependencies": { - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/helper-remap-async-to-generator": "^7.18.6" + "braces": "^3.0.2", + "picomatch": "^2.3.1" }, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": ">=8.6" } }, - "node_modules/@babel/plugin-transform-block-scoped-functions": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.18.6.tgz", - "integrity": "sha512-ExUcOqpPWnliRcPqves5HJcJOvHvIIWfuS4sroBUenPuMdmW+SMHDakmtS7qOo13sVppmUijqeTv7qqGsvURpQ==", + "node_modules/mlly": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.4.2.tgz", + "integrity": "sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==", + "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "acorn": "^8.10.0", + "pathe": "^1.1.1", + "pkg-types": "^1.0.3", + "ufo": "^1.3.0" } }, - "node_modules/@babel/plugin-transform-block-scoping": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.19.4.tgz", - "integrity": "sha512-934S2VLLlt2hRJwPf4MczaOr4hYF0z+VKPwqTNxyKX7NthTiPfhuKFWQZHXRM0vh/wo/VyXB3s4bZUNA08l+tQ==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.19.0" + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/nanoid": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" }, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/@babel/plugin-transform-classes": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.19.0.tgz", - "integrity": "sha512-YfeEE9kCjqTS9IitkgfJuxjcEtLUHMqa8yUJ6zdz8vR7hKuo6mOy2C05P0F1tdMmDCeuyidKnlrw/iTppHcr2A==", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-compilation-targets": "^7.19.0", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.19.0", - "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-replace-supers": "^7.18.9", - "@babel/helper-split-export-declaration": "^7.18.6", - "globals": "^11.1.0" - }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": ">=8" } }, - "node_modules/@babel/plugin-transform-computed-properties": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.18.9.tgz", - "integrity": "sha512-+i0ZU1bCDymKakLxn5srGHrsAPRELC2WIbzwjLhHW9SIE1cPYkLCL0NlnXMZaM1vhfgA2+M7hySk42VBvrkBRw==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" - }, + "node_modules/pathe": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.1.tgz", + "integrity": "sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==", + "dev": true + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": "*" } }, - "node_modules/@babel/plugin-transform-destructuring": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.19.4.tgz", - "integrity": "sha512-t0j0Hgidqf0aM86dF8U+vXYReUgJnlv4bZLsyoPnwZNrGY+7/38o8YjaELrvHeVfTZao15kjR0PVv0nju2iduA==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.19.0" - }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, "engines": { - "node": ">=6.9.0" + "node": ">=8.6" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/@babel/plugin-transform-dotall-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.18.6.tgz", - "integrity": "sha512-6S3jpun1eEbAxq7TdjLotAsl4WpQI9DxfkycRcKrjhQYzU87qpXdknpBg/e+TdcMehqGnLFi7tnFUBR02Vq6wg==", + "node_modules/pkg-types": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.3.tgz", + "integrity": "sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==", + "dev": true, "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "jsonc-parser": "^3.2.0", + "mlly": "^1.2.0", + "pathe": "^1.1.0" } }, - "node_modules/@babel/plugin-transform-duplicate-keys": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.18.9.tgz", - "integrity": "sha512-d2bmXCtZXYc59/0SanQKbiWINadaJXqtvIQIzd4+hNwkWBgyCd5F/2t1kXoUdvPMrxzPvhK6EMQRROxsue+mfw==", + "node_modules/postcss": { + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" }, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": "^10 || ^12 || >=14" } }, - "node_modules/@babel/plugin-transform-exponentiation-operator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.18.6.tgz", - "integrity": "sha512-wzEtc0+2c88FVR34aQmiz56dxEkxr2g8DQb/KfaFa1JYXOFVsbhvAonFN6PwVWj++fKmku8NP80plJ5Et4wqHw==", - "dependencies": { - "@babel/helper-builder-binary-assignment-operator-visitor": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" + "node_modules/prettier": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", + "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=6.9.0" + "node": ">=14" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" } }, - "node_modules/@babel/plugin-transform-for-of": { - "version": "7.18.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.18.8.tgz", - "integrity": "sha512-yEfTRnjuskWYo0k1mHUqrVWaZwrdq8AYbfrpqULOJOaucGSp4mNMVps+YtA8byoevxS/urwU75vyhQIxcCgiBQ==", + "node_modules/pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" }, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@babel/plugin-transform-function-name": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.18.9.tgz", - "integrity": "sha512-WvIBoRPaJQ5yVHzcnJFor7oS5Ls0PYixlTYE63lCj2RtdQEl15M68FXQlxnG6wdraJIXRdR7KI+hQ7q/9QjrCQ==", - "dependencies": { - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-function-name": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9" - }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, "engines": { - "node": ">=6.9.0" + "node": ">=10" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/@babel/plugin-transform-literals": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.18.9.tgz", - "integrity": "sha512-IFQDSRoTPnrAIrI5zoZv73IFeZu2dhu6irxQjY9rNjTT53VmKg9fenjvoiOWOkJ6mm4jKVPtdMzBY98Fp4Z4cg==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" - }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "dev": true + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "iojs": ">=1.0.0", + "node": ">=0.10.0" } }, - "node_modules/@babel/plugin-transform-member-expression-literals": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.18.6.tgz", - "integrity": "sha512-qSF1ihLGO3q+/g48k85tUjD033C29TNTVB2paCwZPVmOsjn9pClvYYrM2VeJpBY2bcNkuny0YUyTNRyRxJ54KA==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "node_modules/rollup": { + "version": "3.29.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", + "integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" }, "engines": { - "node": ">=6.9.0" + "node": ">=14.18.0", + "npm": ">=8.0.0" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "optionalDependencies": { + "fsevents": "~2.3.2" } }, - "node_modules/@babel/plugin-transform-modules-amd": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.18.6.tgz", - "integrity": "sha512-Pra5aXsmTsOnjM3IajS8rTaLCy++nGM4v3YR4esk5PCsyg9z8NA5oQLwxzMUtDBd8F+UmVza3VxoAaWCbzH1rg==", + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], "dependencies": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "queue-microtask": "^1.2.2" } }, - "node_modules/@babel/plugin-transform-modules-commonjs": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.18.6.tgz", - "integrity": "sha512-Qfv2ZOWikpvmedXQJDSbxNqy7Xr/j2Y8/KfijM0iJyKkBTmWuvCA1yeH1yDM7NJhBW/2aXxeucLj6i80/LAJ/Q==", - "dependencies": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/helper-simple-access": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" - }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": ">=0.10.0" } }, - "node_modules/@babel/plugin-transform-modules-systemjs": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.19.0.tgz", - "integrity": "sha512-x9aiR0WXAWmOWsqcsnrzGR+ieaTMVyGyffPVA7F8cXAGt/UxefYv6uSHZLkAFChN5M5Iy1+wjE+xJuPt22H39A==", + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true + }, + "node_modules/std-env": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.4.3.tgz", + "integrity": "sha512-f9aPhy8fYBuMN+sNfakZV18U39PbalgjXG3lLB9WkaYTxijru61wb57V9wxxNthXM5Sd88ETBWi29qLAsHO52Q==", + "dev": true + }, + "node_modules/strip-literal": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.3.0.tgz", + "integrity": "sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==", + "dev": true, "dependencies": { - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-module-transforms": "^7.19.0", - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-validator-identifier": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" - }, - "engines": { - "node": ">=6.9.0" + "acorn": "^8.10.0" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "funding": { + "url": "https://github.com/sponsors/antfu" } }, - "node_modules/@babel/plugin-transform-modules-umd": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.18.6.tgz", - "integrity": "sha512-dcegErExVeXcRqNtkRU/z8WlBLnvD4MRnHgNs3MytRO1Mn1sHRyhbcpYbVMGclAqOjdW+9cfkdZno9dFdfKLfQ==", - "dependencies": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - }, + "node_modules/tinybench": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.5.1.tgz", + "integrity": "sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg==", + "dev": true + }, + "node_modules/tinypool": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.7.0.tgz", + "integrity": "sha512-zSYNUlYSMhJ6Zdou4cJwo/p7w5nmAH17GRfU/ui3ctvjXFErXXkruT4MWW6poDeXgCaIBlGLrfU6TbTXxyGMww==", + "dev": true, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": ">=14.0.0" } }, - "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.19.1.tgz", - "integrity": "sha512-oWk9l9WItWBQYS4FgXD4Uyy5kq898lvkXpXQxoJEY1RnvPk4R/Dvu2ebXU9q8lP+rlMwUQTFf2Ok6d78ODa0kw==", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.19.0", - "@babel/helper-plugin-utils": "^7.19.0" - }, + "node_modules/tinyspy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.1.1.tgz", + "integrity": "sha512-XPJL2uSzcOyBMky6OFrusqWlzfFrXtE0hPuMgW8A2HmaqrPo4ZQHRN/V0QXN3FSjKxpsbRrFc5LI7KOwBsT1/w==", + "dev": true, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" + "node": ">=14.0.0" } }, - "node_modules/@babel/plugin-transform-new-target": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.18.6.tgz", - "integrity": "sha512-DjwFA/9Iu3Z+vrAn+8pBUGcjhxKguSMlsFqeCKbhb9BAV756v0krzVK04CRDi/4aqmk8BsHb4a/gFcaA5joXRw==", + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "is-number": "^7.0.0" }, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": ">=8.0" } }, - "node_modules/@babel/plugin-transform-object-super": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.18.6.tgz", - "integrity": "sha512-uvGz6zk+pZoS1aTZrOvrbj6Pp/kK2mp45t2B+bTDre2UgsZZ8EZLSJtUg7m/no0zOJUWgFONpB7Zv9W2tSaFlA==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/helper-replace-supers": "^7.18.6" - }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": ">=4" } }, - "node_modules/@babel/plugin-transform-parameters": { - "version": "7.18.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.18.8.tgz", - "integrity": "sha512-ivfbE3X2Ss+Fj8nnXvKJS6sjRG4gzwPMsP+taZC+ZzEGjAYlvENixmt1sZ5Ca6tWls+BlKSGKPJ6OOXvXCbkFg==", + "node_modules/ufo": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.3.1.tgz", + "integrity": "sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==", + "dev": true + }, + "node_modules/vite": { + "version": "4.4.9", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", + "integrity": "sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==", + "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "esbuild": "^0.18.10", + "postcss": "^8.4.27", + "rollup": "^3.27.1" + }, + "bin": { + "vite": "bin/vite.js" }, "engines": { - "node": ">=6.9.0" + "node": "^14.18.0 || >=16.0.0" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-property-literals": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.18.6.tgz", - "integrity": "sha512-cYcs6qlgafTud3PAzrrRNbQtfpQ8+y/+M5tKmksS9+M1ckbH6kzY8MrexEM9mcA6JDsukE19iIRvAyYl463sMg==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" }, - "engines": { - "node": ">=6.9.0" + "optionalDependencies": { + "fsevents": "~2.3.2" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-regenerator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.18.6.tgz", - "integrity": "sha512-poqRI2+qiSdeldcz4wTSTXBRryoq3Gc70ye7m7UD5Ww0nE29IXqMl6r7Nd15WBgRd74vloEMlShtH6CKxVzfmQ==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "regenerator-transform": "^0.15.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-reserved-words": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.18.6.tgz", - "integrity": "sha512-oX/4MyMoypzHjFrT1CdivfKZ+XvIPMFXwwxHp/r0Ddy2Vuomt4HDFGmft1TAY2yiTKiNSsh3kjBAzcM8kSdsjA==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-runtime": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.19.1.tgz", - "integrity": "sha512-2nJjTUFIzBMP/f/miLxEK9vxwW/KUXsdvN4sR//TmuDhe6yU2h57WmIOE12Gng3MDP/xpjUV/ToZRdcf8Yj4fA==", - "dependencies": { - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-plugin-utils": "^7.19.0", - "babel-plugin-polyfill-corejs2": "^0.3.3", - "babel-plugin-polyfill-corejs3": "^0.6.0", - "babel-plugin-polyfill-regenerator": "^0.4.1", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-shorthand-properties": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.18.6.tgz", - "integrity": "sha512-eCLXXJqv8okzg86ywZJbRn19YJHU4XUa55oz2wbHhaQVn/MM+XhukiT7SYqp/7o00dg52Rj51Ny+Ecw4oyoygw==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-spread": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.19.0.tgz", - "integrity": "sha512-RsuMk7j6n+r752EtzyScnWkQyuJdli6LdO5Klv8Yx0OfPVTcQkIUfS8clx5e9yHXzlnhOZF3CbQ8C2uP5j074w==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-skip-transparent-expression-wrappers": "^7.18.9" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-sticky-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.18.6.tgz", - "integrity": "sha512-kfiDrDQ+PBsQDO85yj1icueWMfGfJFKN1KCkndygtu/C9+XUfydLC8Iv5UYJqRwy4zk8EcplRxEOeLyjq1gm6Q==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-template-literals": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.18.9.tgz", - "integrity": "sha512-S8cOWfT82gTezpYOiVaGHrCbhlHgKhQt8XH5ES46P2XWmX92yisoZywf5km75wv5sYcXDUCLMmMxOLCtthDgMA==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-typeof-symbol": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.18.9.tgz", - "integrity": "sha512-SRfwTtF11G2aemAZWivL7PD+C9z52v9EvMqH9BuYbabyPuKUvSWks3oCg6041pT925L4zVFqaVBeECwsmlguEw==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-unicode-escapes": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.18.10.tgz", - "integrity": "sha512-kKAdAI+YzPgGY/ftStBFXTI1LZFju38rYThnfMykS+IXy8BVx+res7s2fxf1l8I35DV2T97ezo6+SGrXz6B3iQ==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-unicode-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.18.6.tgz", - "integrity": "sha512-gE7A6Lt7YLnNOL3Pb9BNeZvi+d8l7tcRrG4+pwJjK9hD2xX4mEvjlQW60G9EEmfXVYRPv9VRQcyegIVHCql/AA==", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/preset-env": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.19.4.tgz", - "integrity": "sha512-5QVOTXUdqTCjQuh2GGtdd7YEhoRXBMVGROAtsBeLGIbIz3obCBIfRMT1I3ZKkMgNzwkyCkftDXSSkHxnfVf4qg==", - "dependencies": { - "@babel/compat-data": "^7.19.4", - "@babel/helper-compilation-targets": "^7.19.3", - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-validator-option": "^7.18.6", - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.18.6", - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.18.9", - "@babel/plugin-proposal-async-generator-functions": "^7.19.1", - "@babel/plugin-proposal-class-properties": "^7.18.6", - "@babel/plugin-proposal-class-static-block": "^7.18.6", - "@babel/plugin-proposal-dynamic-import": "^7.18.6", - "@babel/plugin-proposal-export-namespace-from": "^7.18.9", - "@babel/plugin-proposal-json-strings": "^7.18.6", - "@babel/plugin-proposal-logical-assignment-operators": "^7.18.9", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", - "@babel/plugin-proposal-numeric-separator": "^7.18.6", - "@babel/plugin-proposal-object-rest-spread": "^7.19.4", - "@babel/plugin-proposal-optional-catch-binding": "^7.18.6", - "@babel/plugin-proposal-optional-chaining": "^7.18.9", - "@babel/plugin-proposal-private-methods": "^7.18.6", - "@babel/plugin-proposal-private-property-in-object": "^7.18.6", - "@babel/plugin-proposal-unicode-property-regex": "^7.18.6", - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-class-properties": "^7.12.13", - "@babel/plugin-syntax-class-static-block": "^7.14.5", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-import-assertions": "^7.18.6", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5", - "@babel/plugin-syntax-top-level-await": "^7.14.5", - "@babel/plugin-transform-arrow-functions": "^7.18.6", - "@babel/plugin-transform-async-to-generator": "^7.18.6", - "@babel/plugin-transform-block-scoped-functions": "^7.18.6", - "@babel/plugin-transform-block-scoping": "^7.19.4", - "@babel/plugin-transform-classes": "^7.19.0", - "@babel/plugin-transform-computed-properties": "^7.18.9", - "@babel/plugin-transform-destructuring": "^7.19.4", - "@babel/plugin-transform-dotall-regex": "^7.18.6", - "@babel/plugin-transform-duplicate-keys": "^7.18.9", - "@babel/plugin-transform-exponentiation-operator": "^7.18.6", - "@babel/plugin-transform-for-of": "^7.18.8", - "@babel/plugin-transform-function-name": "^7.18.9", - "@babel/plugin-transform-literals": "^7.18.9", - "@babel/plugin-transform-member-expression-literals": "^7.18.6", - "@babel/plugin-transform-modules-amd": "^7.18.6", - "@babel/plugin-transform-modules-commonjs": "^7.18.6", - "@babel/plugin-transform-modules-systemjs": "^7.19.0", - "@babel/plugin-transform-modules-umd": "^7.18.6", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.19.1", - "@babel/plugin-transform-new-target": "^7.18.6", - "@babel/plugin-transform-object-super": "^7.18.6", - "@babel/plugin-transform-parameters": "^7.18.8", - "@babel/plugin-transform-property-literals": "^7.18.6", - "@babel/plugin-transform-regenerator": "^7.18.6", - "@babel/plugin-transform-reserved-words": "^7.18.6", - "@babel/plugin-transform-shorthand-properties": "^7.18.6", - "@babel/plugin-transform-spread": "^7.19.0", - "@babel/plugin-transform-sticky-regex": "^7.18.6", - "@babel/plugin-transform-template-literals": "^7.18.9", - "@babel/plugin-transform-typeof-symbol": "^7.18.9", - "@babel/plugin-transform-unicode-escapes": "^7.18.10", - "@babel/plugin-transform-unicode-regex": "^7.18.6", - "@babel/preset-modules": "^0.1.5", - "@babel/types": "^7.19.4", - "babel-plugin-polyfill-corejs2": "^0.3.3", - "babel-plugin-polyfill-corejs3": "^0.6.0", - "babel-plugin-polyfill-regenerator": "^0.4.1", - "core-js-compat": "^3.25.1", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/preset-modules": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.5.tgz", - "integrity": "sha512-A57th6YRG7oR3cq/yt/Y84MvGgE0eJG2F1JLhKuyG+jFxEgrd/HAMJatiFtmOiZurz+0DkrvbheCLaV5f2JfjA==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", - "@babel/plugin-transform-dotall-regex": "^7.4.4", - "@babel/types": "^7.4.4", - "esutils": "^2.0.2" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/runtime": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.19.4.tgz", - "integrity": "sha512-EXpLCrk55f+cYqmHsSR+yD/0gAIMxxA9QK9lnQWzhMCvt+YmoBN7Zx94s++Kv0+unHk39vxNO8t+CMA2WSS3wA==", - "dependencies": { - "regenerator-runtime": "^0.13.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/template": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.10.tgz", - "integrity": "sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA==", - "dependencies": { - "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.18.10", - "@babel/types": "^7.18.10" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.19.4.tgz", - "integrity": "sha512-w3K1i+V5u2aJUOXBFFC5pveFLmtq1s3qcdDNC2qRI6WPBQIDaKFqXxDEqDO/h1dQ3HjsZoZMyIy6jGLq0xtw+g==", - "dependencies": { - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.19.4", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.19.0", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.19.4", - "@babel/types": "^7.19.4", - "debug": "^4.1.0", - "globals": "^11.1.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/types": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.19.4.tgz", - "integrity": "sha512-M5LK7nAeS6+9j7hAq+b3fQs+pNfUtTGq+yFFfHnauFA8zQtLRfmuipmsKDKKLuyG+wC8ABW43A153YNawNTEtw==", - "dependencies": { - "@babel/helper-string-parser": "^7.19.4", - "@babel/helper-validator-identifier": "^7.19.1", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@bcoe/v8-coverage": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", - "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", - "dev": true - }, - "node_modules/@eslint/eslintrc": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz", - "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==", - "dev": true, - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.4.0", - "globals": "^13.15.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint/eslintrc/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "13.17.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", - "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", - "dev": true, - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@eslint/eslintrc/node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/@eslint/eslintrc/node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.10.7", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.7.tgz", - "integrity": "sha512-MDl6D6sBsaV452/QSdX+4CXIjZhIcI0PELsxUjk4U828yd58vk3bTIvk/6w5FY+4hIy9sLW0sfrV7K7Kc++j/w==", - "dev": true, - "dependencies": { - "@humanwhocodes/object-schema": "^1.2.1", - "debug": "^4.1.1", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=10.10.0" - } - }, - "node_modules/@humanwhocodes/module-importer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", - "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", - "dev": true, - "engines": { - "node": ">=12.22" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", - "dev": true - }, - "node_modules/@istanbuljs/load-nyc-config": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", - "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", - "dev": true, - "dependencies": { - "camelcase": "^5.3.1", - "find-up": "^4.1.0", - "get-package-type": "^0.1.0", - "js-yaml": "^3.13.1", - "resolve-from": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@istanbuljs/schema": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", - "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/console": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.2.0.tgz", - "integrity": "sha512-Xz1Wu+ZZxcB3RS8U3HdkFxlRJ7kLXI/by9X7d2/gvseIWPwYu/c1EsYy77cB5iyyHGOy3whS2HycjcuzIF4Jow==", - "dev": true, - "dependencies": { - "@jest/types": "^29.2.0", - "@types/node": "*", - "chalk": "^4.0.0", - "jest-message-util": "^29.2.0", - "jest-util": "^29.2.0", - "slash": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/console/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@jest/console/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@jest/console/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/console/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/@jest/console/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/console/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/core": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.2.0.tgz", - "integrity": "sha512-+gyJ3bX+kGEW/eqt/0kI7fLjqiFr3AN8O+rlEl1fYRf7D8h4Sj4tBGo9YOSirvWgvemoH2EPRya35bgvcPFzHQ==", - "dev": true, - "dependencies": { - "@jest/console": "^29.2.0", - "@jest/reporters": "^29.2.0", - "@jest/test-result": "^29.2.0", - "@jest/transform": "^29.2.0", - "@jest/types": "^29.2.0", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.9", - "jest-changed-files": "^29.2.0", - "jest-config": "^29.2.0", - "jest-haste-map": "^29.2.0", - "jest-message-util": "^29.2.0", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.2.0", - "jest-resolve-dependencies": "^29.2.0", - "jest-runner": "^29.2.0", - "jest-runtime": "^29.2.0", - "jest-snapshot": "^29.2.0", - "jest-util": "^29.2.0", - "jest-validate": "^29.2.0", - "jest-watcher": "^29.2.0", - "micromatch": "^4.0.4", - "pretty-format": "^29.2.0", - "slash": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + "@types/node": ">= 14", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" }, "peerDependenciesMeta": { - "node-notifier": { + "@types/node": { "optional": true - } - } - }, - "node_modules/@jest/core/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@jest/core/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@jest/core/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/core/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/@jest/core/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/core/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/environment": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.2.0.tgz", - "integrity": "sha512-foaVv1QVPB31Mno3LlL58PxEQQOLZd9zQfCpyQQCQIpUAtdFP1INBjkphxrCfKT13VxpA0z5jFGIkmZk0DAg2Q==", - "dev": true, - "dependencies": { - "@jest/fake-timers": "^29.2.0", - "@jest/types": "^29.2.0", - "@types/node": "*", - "jest-mock": "^29.2.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/expect": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.2.0.tgz", - "integrity": "sha512-+3lxcYL9e0xPJGOR33utxxejn+Mulz40kY0oy0FVsmIESW87NZDJ7B1ovaIqeX0xIgPX4laS5SGlqD2uSoBMcw==", - "dev": true, - "dependencies": { - "expect": "^29.2.0", - "jest-snapshot": "^29.2.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/expect-utils": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.2.0.tgz", - "integrity": "sha512-nz2IDF7nb1qmj9hx8Ja3MFab2q9Ml8QbOaaeJNyX5JQJHU8QUvEDiMctmhGEkk3Kzr8w8vAqz4hPk/ogJSrUhg==", - "dev": true, - "dependencies": { - "jest-get-type": "^29.2.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/fake-timers": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.2.0.tgz", - "integrity": "sha512-mX0V0uQsgeSLTt0yTqanAhhpeUKMGd2uq+PSLAfO40h72bvfNNQ7pIEl9vIwNMFxRih1ENveEjSBsLjxGGDPSw==", - "dev": true, - "dependencies": { - "@jest/types": "^29.2.0", - "@sinonjs/fake-timers": "^9.1.2", - "@types/node": "*", - "jest-message-util": "^29.2.0", - "jest-mock": "^29.2.0", - "jest-util": "^29.2.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/globals": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.2.0.tgz", - "integrity": "sha512-JQxtEVNWiai1p3PIzAJZSyEqQdAJGvNKvinZDPfu0mhiYEVx6E+PiBuDWj1sVUW8hzu+R3DVqaWC9K2xcLRIAA==", - "dev": true, - "dependencies": { - "@jest/environment": "^29.2.0", - "@jest/expect": "^29.2.0", - "@jest/types": "^29.2.0", - "jest-mock": "^29.2.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/reporters": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.2.0.tgz", - "integrity": "sha512-BXoAJatxTZ18U0cwD7C8qBo8V6vef8AXYRBZdhqE5DF9CmpqmhMfw9c7OUvYqMTnBBK9A0NgXGO4Lc9EJzdHvw==", - "dev": true, - "dependencies": { - "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^29.2.0", - "@jest/test-result": "^29.2.0", - "@jest/transform": "^29.2.0", - "@jest/types": "^29.2.0", - "@jridgewell/trace-mapping": "^0.3.15", - "@types/node": "*", - "chalk": "^4.0.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^5.1.0", - "istanbul-lib-report": "^3.0.0", - "istanbul-lib-source-maps": "^4.0.0", - "istanbul-reports": "^3.1.3", - "jest-message-util": "^29.2.0", - "jest-util": "^29.2.0", - "jest-worker": "^29.2.0", - "slash": "^3.0.0", - "string-length": "^4.0.1", - "strip-ansi": "^6.0.0", - "v8-to-istanbul": "^9.0.1" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - } - }, - "node_modules/@jest/reporters/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@jest/reporters/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@jest/reporters/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/reporters/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/@jest/reporters/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/reporters/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/schemas": { - "version": "29.0.0", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.0.0.tgz", - "integrity": "sha512-3Ab5HgYIIAnS0HjqJHQYZS+zXc4tUmTmBH3z83ajI6afXp8X3ZtdLX+nXx+I7LNkJD7uN9LAVhgnjDgZa2z0kA==", - "dev": true, - "dependencies": { - "@sinclair/typebox": "^0.24.1" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/source-map": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.2.0.tgz", - "integrity": "sha512-1NX9/7zzI0nqa6+kgpSdKPK+WU1p+SJk3TloWZf5MzPbxri9UEeXX5bWZAPCzbQcyuAzubcdUHA7hcNznmRqWQ==", - "dev": true, - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.15", - "callsites": "^3.0.0", - "graceful-fs": "^4.2.9" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/test-result": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.2.0.tgz", - "integrity": "sha512-l76EPJ6QqtzsCLS4aimJqWO53pxZ82o3aE+Brcmo1HJ/phb9+MR7gPhyDdN6VSGaLJCRVJBZgWEhAEz+qON0Fw==", - "dev": true, - "dependencies": { - "@jest/console": "^29.2.0", - "@jest/types": "^29.2.0", - "@types/istanbul-lib-coverage": "^2.0.0", - "collect-v8-coverage": "^1.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/test-sequencer": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.2.0.tgz", - "integrity": "sha512-NCnjZcGnVdva6IDqF7TCuFsXs2F1tohiNF9sasSJNzD7VfN5ic9XgcS/oPDalGiPLxCmGKj4kewqqrKAqBACcQ==", - "dev": true, - "dependencies": { - "@jest/test-result": "^29.2.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.2.0", - "slash": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/transform": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.2.0.tgz", - "integrity": "sha512-NXMujGHy+B4DAj4dGnVPD0SIXlR2Z/N8Gp9h3mF66kcIRult1WWqY3/CEIrJcKviNWaFPYhZjCG2L3fteWzcUw==", - "dev": true, - "dependencies": { - "@babel/core": "^7.11.6", - "@jest/types": "^29.2.0", - "@jridgewell/trace-mapping": "^0.3.15", - "babel-plugin-istanbul": "^6.1.1", - "chalk": "^4.0.0", - "convert-source-map": "^1.4.0", - "fast-json-stable-stringify": "^2.1.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.2.0", - "jest-regex-util": "^29.2.0", - "jest-util": "^29.2.0", - "micromatch": "^4.0.4", - "pirates": "^4.0.4", - "slash": "^3.0.0", - "write-file-atomic": "^4.0.1" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/transform/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@jest/transform/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@jest/transform/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/transform/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/@jest/transform/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/transform/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/types": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.2.0.tgz", - "integrity": "sha512-mfgpQz4Z2xGo37m6KD8xEpKelaVzvYVRijmLPePn9pxgaPEtX+SqIyPNzzoeCPXKYbB4L/wYSgXDL8o3Gop78Q==", - "dev": true, - "dependencies": { - "@jest/schemas": "^29.0.0", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/types/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@jest/types/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@jest/types/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/types/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/@jest/types/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/types/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", - "integrity": "sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==", - "dependencies": { - "@jridgewell/set-array": "^1.0.0", - "@jridgewell/sourcemap-codec": "^1.4.10" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.17", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", - "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", - "dependencies": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" - } - }, - "node_modules/@nicolo-ribaudo/eslint-scope-5-internals": { - "version": "5.1.1-v1", - "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz", - "integrity": "sha512-54/JRvkLIzzDWshCWfuhadfrfZVPiElY8Fcgmg1HroEly/EDSszzhBAsarCux+D/kOslTRquNzuyGSmUSTTHGg==", - "dev": true, - "dependencies": { - "eslint-scope": "5.1.1" - } - }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@sinclair/typebox": { - "version": "0.24.46", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.24.46.tgz", - "integrity": "sha512-ng4ut1z2MCBhK/NwDVwIQp3pAUOCs/KNaW3cBxdFB2xTDrOuo1xuNmpr/9HHFhxqIvHrs1NTH3KJg6q+JSy1Kw==", - "dev": true - }, - "node_modules/@sinonjs/commons": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz", - "integrity": "sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ==", - "dev": true, - "dependencies": { - "type-detect": "4.0.8" - } - }, - "node_modules/@sinonjs/fake-timers": { - "version": "9.1.2", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-9.1.2.tgz", - "integrity": "sha512-BPS4ynJW/o92PUR4wgriz2Ud5gpST5vz6GQfMixEDK0Z8ZCUv2M7SkBLykH56T++Xs+8ln9zTGbOvNGIe02/jw==", - "dev": true, - "dependencies": { - "@sinonjs/commons": "^1.7.0" - } - }, - "node_modules/@types/babel__core": { - "version": "7.1.19", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.19.tgz", - "integrity": "sha512-WEOTgRsbYkvA/KCsDwVEGkd7WAr1e3g31VHQ8zy5gul/V1qKullU/BU5I68X5v7V3GnB9eotmom4v5a5gjxorw==", - "dev": true, - "dependencies": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "node_modules/@types/babel__generator": { - "version": "7.6.4", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.4.tgz", - "integrity": "sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==", - "dev": true, - "dependencies": { - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__template": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.1.tgz", - "integrity": "sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==", - "dev": true, - "dependencies": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__traverse": { - "version": "7.18.2", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.18.2.tgz", - "integrity": "sha512-FcFaxOr2V5KZCviw1TnutEMVUVsGt4D2hP1TAfXZAMKuHYW3xQhe3jTxNPWutgCJ3/X1c5yX8ZoGVEItxKbwBg==", - "dev": true, - "dependencies": { - "@babel/types": "^7.3.0" - } - }, - "node_modules/@types/graceful-fs": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz", - "integrity": "sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", - "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", - "dev": true - }, - "node_modules/@types/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", - "dev": true, - "dependencies": { - "@types/istanbul-lib-coverage": "*" - } - }, - "node_modules/@types/istanbul-reports": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", - "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", - "dev": true, - "dependencies": { - "@types/istanbul-lib-report": "*" - } - }, - "node_modules/@types/jest": { - "version": "29.1.2", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.1.2.tgz", - "integrity": "sha512-y+nlX0h87U0R+wsGn6EBuoRWYyv3KFtwRNP3QWp9+k2tJ2/bqcGS3UxD7jgT+tiwJWWq3UsyV4Y+T6rsMT4XMg==", - "dev": true, - "dependencies": { - "expect": "^29.0.0", - "pretty-format": "^29.0.0" - } - }, - "node_modules/@types/json5": { - "version": "0.0.29", - "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", - "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", - "dev": true - }, - "node_modules/@types/node": { - "version": "18.11.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.0.tgz", - "integrity": "sha512-IOXCvVRToe7e0ny7HpT/X9Rb2RYtElG1a+VshjwT00HxrM2dWBApHQoqsI6WiY7Q03vdf2bCrIGzVrkF/5t10w==", - "dev": true - }, - "node_modules/@types/prettier": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.1.tgz", - "integrity": "sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow==", - "dev": true - }, - "node_modules/@types/stack-utils": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", - "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", - "dev": true - }, - "node_modules/@types/yargs": { - "version": "17.0.13", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.13.tgz", - "integrity": "sha512-9sWaruZk2JGxIQU+IhI1fhPYRcQ0UuTNuKuCW9bR5fp7qi2Llf7WDzNa17Cy7TKnh3cdxDOiyTu6gaLS0eDatg==", - "dev": true, - "dependencies": { - "@types/yargs-parser": "*" - } - }, - "node_modules/@types/yargs-parser": { - "version": "21.0.0", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", - "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", - "dev": true - }, - "node_modules/acorn": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", - "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, - "dependencies": { - "type-fest": "^0.21.3" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", - "dev": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/array-includes": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.5.tgz", - "integrity": "sha512-iSDYZMMyTPkiFasVqfuAQnWAYcvO/SeBSCGKePoEthjp4LEMTe4uLc7b025o4jAZpHhihh8xPo99TNWUWWkGDQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.19.5", - "get-intrinsic": "^1.1.1", - "is-string": "^1.0.7" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/array.prototype.flat": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.0.tgz", - "integrity": "sha512-12IUEkHsAhA4DY5s0FPgNXIdc8VRSqD9Zp78a5au9abH/SOBrsp082JOWFNTjkMozh8mqcdiKuaLGhPeYztxSw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.2", - "es-shim-unscopables": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/array.prototype.flatmap": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.0.tgz", - "integrity": "sha512-PZC9/8TKAIxcWKdyeb77EzULHPrIX/tIZebLJUQOMR1OwYosT8yggdfWScfTBCDj5utONvOuPQQumYsU2ULbkg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.2", - "es-shim-unscopables": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/babel-jest": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.2.0.tgz", - "integrity": "sha512-c8FkrW1chgcbyBqOo7jFGpQYfVnb43JqjQGV+C2r94k2rZJOukYOZ6+csAqKE4ms+PHc+yevnONxs27jQIxylw==", - "dev": true, - "dependencies": { - "@jest/transform": "^29.2.0", - "@types/babel__core": "^7.1.14", - "babel-plugin-istanbul": "^6.1.1", - "babel-preset-jest": "^29.2.0", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "slash": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.8.0" - } - }, - "node_modules/babel-jest/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/babel-jest/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/babel-jest/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/babel-jest/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/babel-jest/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/babel-jest/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/babel-plugin-dynamic-import-node": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", - "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==", - "dependencies": { - "object.assign": "^4.1.0" - } - }, - "node_modules/babel-plugin-istanbul": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", - "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@istanbuljs/load-nyc-config": "^1.0.0", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-instrument": "^5.0.4", - "test-exclude": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/babel-plugin-jest-hoist": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.2.0.tgz", - "integrity": "sha512-TnspP2WNiR3GLfCsUNHqeXw0RoQ2f9U5hQ5L3XFpwuO8htQmSrhh8qsB6vi5Yi8+kuynN1yjDjQsPfkebmB6ZA==", - "dev": true, - "dependencies": { - "@babel/template": "^7.3.3", - "@babel/types": "^7.3.3", - "@types/babel__core": "^7.1.14", - "@types/babel__traverse": "^7.0.6" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/babel-plugin-polyfill-corejs2": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.3.tgz", - "integrity": "sha512-8hOdmFYFSZhqg2C/JgLUQ+t52o5nirNwaWM2B9LWteozwIvM14VSwdsCAUET10qT+kmySAlseadmfeeSWFCy+Q==", - "dependencies": { - "@babel/compat-data": "^7.17.7", - "@babel/helper-define-polyfill-provider": "^0.3.3", - "semver": "^6.1.1" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/babel-plugin-polyfill-corejs3": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.6.0.tgz", - "integrity": "sha512-+eHqR6OPcBhJOGgsIar7xoAB1GcSwVUA3XjAd7HJNzOXT4wv6/H7KIdA/Nc60cvUlDbKApmqNvD1B1bzOt4nyA==", - "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.3.3", - "core-js-compat": "^3.25.1" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/babel-plugin-polyfill-regenerator": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.4.1.tgz", - "integrity": "sha512-NtQGmyQDXjQqQ+IzRkBVwEOz9lQ4zxAQZgoAYEtU9dJjnl1Oc98qnN7jcp+bE7O7aYzVpavXE3/VKXNzUbh7aw==", - "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.3.3" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/babel-preset-current-node-syntax": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", - "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", - "dev": true, - "dependencies": { - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-bigint": "^7.8.3", - "@babel/plugin-syntax-class-properties": "^7.8.3", - "@babel/plugin-syntax-import-meta": "^7.8.3", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.8.3", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-top-level-await": "^7.8.3" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/babel-preset-jest": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.2.0.tgz", - "integrity": "sha512-z9JmMJppMxNv8N7fNRHvhMg9cvIkMxQBXgFkane3yKVEvEOP+kB50lk8DFRvF9PGqbyXxlmebKWhuDORO8RgdA==", - "dev": true, - "dependencies": { - "babel-plugin-jest-hoist": "^29.2.0", - "babel-preset-current-node-syntax": "^1.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/browserslist": { - "version": "4.21.4", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.4.tgz", - "integrity": "sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - } - ], - "dependencies": { - "caniuse-lite": "^1.0.30001400", - "electron-to-chromium": "^1.4.251", - "node-releases": "^2.0.6", - "update-browserslist-db": "^1.0.9" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, - "node_modules/bser": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", - "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", - "dev": true, - "dependencies": { - "node-int64": "^0.4.0" - } - }, - "node_modules/buffer-from": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true - }, - "node_modules/builtins": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", - "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", - "dev": true, - "dependencies": { - "semver": "^7.0.0" - } - }, - "node_modules/builtins/node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001419", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001419.tgz", - "integrity": "sha512-aFO1r+g6R7TW+PNQxKzjITwLOyDhVRLjW0LcwS/HCZGUUKTGNp9+IwLC4xyDSZBygVL/mxaFR3HIV6wEKQuSzw==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - } - ] - }, - "node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/char-regex": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", - "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/ci-info": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.5.0.tgz", - "integrity": "sha512-yH4RezKOGlOhxkmhbeNuC4eYZKAUsEaGtBuBzDDP1eFUKiccDWzBABxBfOx31IDwDIXMTxWuwAxUGModvkbuVw==", - "dev": true - }, - "node_modules/cjs-module-lexer": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz", - "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", - "dev": true - }, - "node_modules/cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", - "dev": true, - "engines": { - "iojs": ">= 1.0.0", - "node": ">= 0.12.0" - } - }, - "node_modules/collect-v8-coverage": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz", - "integrity": "sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==", - "dev": true - }, - "node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "node_modules/convert-source-map": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", - "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", - "dependencies": { - "safe-buffer": "~5.1.1" - } - }, - "node_modules/core-js-compat": { - "version": "3.25.5", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.25.5.tgz", - "integrity": "sha512-ovcyhs2DEBUIE0MGEKHP4olCUW/XYte3Vroyxuh38rD1wAO4dHohsovUC4eAOuzFxE6b+RXvBU3UZ9o0YhUTkA==", - "dependencies": { - "browserslist": "^4.21.4" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/core-js" - } - }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/dedent": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", - "integrity": "sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==", - "dev": true - }, - "node_modules/deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true - }, - "node_modules/deepmerge": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", - "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/define-properties": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", - "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", - "dependencies": { - "has-property-descriptors": "^1.0.0", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/detect-newline": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", - "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/diff-sequences": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.2.0.tgz", - "integrity": "sha512-413SY5JpYeSBZxmenGEmCVQ8mCgtFJF0w9PROdaS6z987XC2Pd2GOKqOITLtMftmyFZqgtCOb/QA7/Z3ZXfzIw==", - "dev": true, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/electron-to-chromium": { - "version": "1.4.283", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.283.tgz", - "integrity": "sha512-g6RQ9zCOV+U5QVHW9OpFR7rdk/V7xfopNXnyAamdpFgCHgZ1sjI8VuR1+zG2YG/TZk+tQ8mpNkug4P8FU0fuOA==" - }, - "node_modules/emittery": { - "version": "0.10.2", - "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.10.2.tgz", - "integrity": "sha512-aITqOwnLanpHLNXZJENbOgjUBeHocD+xsSJmNrjovKBW5HbSpW3d1pEls7GFQPUWXiwG9+0P4GtHfEqC/4M0Iw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sindresorhus/emittery?sponsor=1" - } - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, - "dependencies": { - "is-arrayish": "^0.2.1" - } - }, - "node_modules/es-abstract": { - "version": "1.20.4", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.4.tgz", - "integrity": "sha512-0UtvRN79eMe2L+UNEF1BwRe364sj/DXhQ/k5FmivgoSdpM90b8Jc0mDzKMGo7QS0BVbOP/bTwBKNnDc9rNzaPA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "function.prototype.name": "^1.1.5", - "get-intrinsic": "^1.1.3", - "get-symbol-description": "^1.0.0", - "has": "^1.0.3", - "has-property-descriptors": "^1.0.0", - "has-symbols": "^1.0.3", - "internal-slot": "^1.0.3", - "is-callable": "^1.2.7", - "is-negative-zero": "^2.0.2", - "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.2", - "is-string": "^1.0.7", - "is-weakref": "^1.0.2", - "object-inspect": "^1.12.2", - "object-keys": "^1.1.1", - "object.assign": "^4.1.4", - "regexp.prototype.flags": "^1.4.3", - "safe-regex-test": "^1.0.0", - "string.prototype.trimend": "^1.0.5", - "string.prototype.trimstart": "^1.0.5", - "unbox-primitive": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/es-shim-unscopables": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", - "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==", - "dev": true, - "dependencies": { - "has": "^1.0.3" - } - }, - "node_modules/es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, - "dependencies": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/eslint": { - "version": "8.25.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.25.0.tgz", - "integrity": "sha512-DVlJOZ4Pn50zcKW5bYH7GQK/9MsoQG2d5eDH0ebEkE8PbgzTTmtt/VTH9GGJ4BfeZCpBLqFfvsjX35UacUL83A==", - "dev": true, - "dependencies": { - "@eslint/eslintrc": "^1.3.3", - "@humanwhocodes/config-array": "^0.10.5", - "@humanwhocodes/module-importer": "^1.0.1", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "doctrine": "^3.0.0", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.3.0", - "espree": "^9.4.0", - "esquery": "^1.4.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "find-up": "^5.0.0", - "glob-parent": "^6.0.1", - "globals": "^13.15.0", - "globby": "^11.1.0", - "grapheme-splitter": "^1.0.4", - "ignore": "^5.2.0", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "js-sdsl": "^4.1.4", - "js-yaml": "^4.1.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "regexpp": "^3.2.0", - "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", - "text-table": "^0.2.0" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-config-standard": { - "version": "17.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-17.0.0.tgz", - "integrity": "sha512-/2ks1GKyqSOkH7JFvXJicu0iMpoojkwB+f5Du/1SC0PtBL+s8v30k9njRZ21pm2drKYm2342jFnGWzttxPmZVg==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "peerDependencies": { - "eslint": "^8.0.1", - "eslint-plugin-import": "^2.25.2", - "eslint-plugin-n": "^15.0.0", - "eslint-plugin-promise": "^6.0.0" - } - }, - "node_modules/eslint-config-standard-jsx": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-standard-jsx/-/eslint-config-standard-jsx-11.0.0.tgz", - "integrity": "sha512-+1EV/R0JxEK1L0NGolAr8Iktm3Rgotx3BKwgaX+eAuSX8D952LULKtjgZD3F+e6SvibONnhLwoTi9DPxN5LvvQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "peerDependencies": { - "eslint": "^8.8.0", - "eslint-plugin-react": "^7.28.0" - } - }, - "node_modules/eslint-import-resolver-node": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", - "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==", - "dev": true, - "dependencies": { - "debug": "^3.2.7", - "resolve": "^1.20.0" - } - }, - "node_modules/eslint-import-resolver-node/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/eslint-module-utils": { - "version": "2.7.4", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.4.tgz", - "integrity": "sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA==", - "dev": true, - "dependencies": { - "debug": "^3.2.7" - }, - "engines": { - "node": ">=4" - }, - "peerDependenciesMeta": { - "eslint": { - "optional": true - } - } - }, - "node_modules/eslint-module-utils/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/eslint-plugin-es": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz", - "integrity": "sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==", - "dev": true, - "dependencies": { - "eslint-utils": "^2.0.0", - "regexpp": "^3.0.0" - }, - "engines": { - "node": ">=8.10.0" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - }, - "peerDependencies": { - "eslint": ">=4.19.1" - } - }, - "node_modules/eslint-plugin-es/node_modules/eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", - "dev": true, - "dependencies": { - "eslint-visitor-keys": "^1.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, - "node_modules/eslint-plugin-es/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-plugin-import": { - "version": "2.26.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", - "integrity": "sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==", - "dev": true, - "dependencies": { - "array-includes": "^3.1.4", - "array.prototype.flat": "^1.2.5", - "debug": "^2.6.9", - "doctrine": "^2.1.0", - "eslint-import-resolver-node": "^0.3.6", - "eslint-module-utils": "^2.7.3", - "has": "^1.0.3", - "is-core-module": "^2.8.1", - "is-glob": "^4.0.3", - "minimatch": "^3.1.2", - "object.values": "^1.1.5", - "resolve": "^1.22.0", - "tsconfig-paths": "^3.14.1" - }, - "engines": { - "node": ">=4" - }, - "peerDependencies": { - "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" - } - }, - "node_modules/eslint-plugin-import/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/eslint-plugin-import/node_modules/doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", - "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/eslint-plugin-import/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true - }, - "node_modules/eslint-plugin-import/node_modules/resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", - "dev": true, - "dependencies": { - "is-core-module": "^2.9.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/eslint-plugin-n": { - "version": "15.3.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.3.0.tgz", - "integrity": "sha512-IyzPnEWHypCWasDpxeJnim60jhlumbmq0pubL6IOcnk8u2y53s5QfT8JnXy7skjHJ44yWHRb11PLtDHuu1kg/Q==", - "dev": true, - "dependencies": { - "builtins": "^5.0.1", - "eslint-plugin-es": "^4.1.0", - "eslint-utils": "^3.0.0", - "ignore": "^5.1.1", - "is-core-module": "^2.10.0", - "minimatch": "^3.1.2", - "resolve": "^1.22.1", - "semver": "^7.3.7" - }, - "engines": { - "node": ">=12.22.0" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - }, - "peerDependencies": { - "eslint": ">=7.0.0" - } - }, - "node_modules/eslint-plugin-n/node_modules/resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", - "dev": true, - "dependencies": { - "is-core-module": "^2.9.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/eslint-plugin-n/node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/eslint-plugin-promise": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.1.0.tgz", - "integrity": "sha512-NYCfDZF/KHt27p06nFAttgWuFyIDSUMnNaJBIY1FY9GpBFhdT2vMG64HlFguSgcJeyM5by6Yr5csSOuJm60eXQ==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" - } - }, - "node_modules/eslint-plugin-react": { - "version": "7.31.10", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.31.10.tgz", - "integrity": "sha512-e4N/nc6AAlg4UKW/mXeYWd3R++qUano5/o+t+wnWxIf+bLsOaH3a4q74kX3nDjYym3VBN4HyO9nEn1GcAqgQOA==", - "dev": true, - "dependencies": { - "array-includes": "^3.1.5", - "array.prototype.flatmap": "^1.3.0", - "doctrine": "^2.1.0", - "estraverse": "^5.3.0", - "jsx-ast-utils": "^2.4.1 || ^3.0.0", - "minimatch": "^3.1.2", - "object.entries": "^1.1.5", - "object.fromentries": "^2.0.5", - "object.hasown": "^1.1.1", - "object.values": "^1.1.5", - "prop-types": "^15.8.1", - "resolve": "^2.0.0-next.3", - "semver": "^6.3.0", - "string.prototype.matchall": "^4.0.7" - }, - "engines": { - "node": ">=4" - }, - "peerDependencies": { - "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8" - } - }, - "node_modules/eslint-plugin-react/node_modules/doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", - "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/eslint-plugin-react/node_modules/resolve": { - "version": "2.0.0-next.4", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.4.tgz", - "integrity": "sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ==", - "dev": true, - "dependencies": { - "is-core-module": "^2.9.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/eslint-scope/node_modules/estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "dev": true, - "dependencies": { - "eslint-visitor-keys": "^2.0.0" - }, - "engines": { - "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - }, - "peerDependencies": { - "eslint": ">=5" - } - }, - "node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/eslint/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/eslint/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "node_modules/eslint/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/eslint/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/eslint/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/eslint/node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/eslint-scope": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", - "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", - "dev": true, - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/eslint/node_modules/eslint-visitor-keys": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", - "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/eslint/node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.3" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/eslint/node_modules/globals": { - "version": "13.17.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", - "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", - "dev": true, - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint/node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/eslint/node_modules/levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/eslint/node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", - "dev": true, - "dependencies": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/eslint/node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/eslint/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint/node_modules/type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/eslint/node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/espree": { - "version": "9.4.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.0.tgz", - "integrity": "sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw==", - "dev": true, - "dependencies": { - "acorn": "^8.8.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/espree/node_modules/eslint-visitor-keys": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", - "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", - "dev": true, - "dependencies": { - "estraverse": "^5.1.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "dependencies": { - "estraverse": "^5.2.0" - }, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/expect": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/expect/-/expect-29.2.0.tgz", - "integrity": "sha512-03ClF3GWwUqd9Grgkr9ZSdaCJGMRA69PQ8jT7o+Bx100VlGiAFf9/8oIm9Qve7ZVJhuJxFftqFhviZJRxxNfvg==", - "dev": true, - "dependencies": { - "@jest/expect-utils": "^29.2.0", - "jest-get-type": "^29.2.0", - "jest-matcher-utils": "^29.2.0", - "jest-message-util": "^29.2.0", - "jest-util": "^29.2.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, - "node_modules/fast-glob": { - "version": "3.2.12", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", - "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, - "node_modules/fastq": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", - "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", - "dev": true, - "dependencies": { - "reusify": "^1.0.4" - } - }, - "node_modules/fb-watchman": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", - "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", - "dev": true, - "dependencies": { - "bser": "2.1.1" - } - }, - "node_modules/file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", - "dev": true, - "dependencies": { - "flat-cache": "^3.0.4" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", - "dev": true, - "dependencies": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/flatted": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.4.tgz", - "integrity": "sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw==", - "dev": true - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "node_modules/function.prototype.name": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", - "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.0", - "functions-have-names": "^1.2.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/functions-have-names": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", - "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true, - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", - "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-package-type": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", - "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", - "dev": true, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/get-stdin": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-8.0.0.tgz", - "integrity": "sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/get-symbol-description": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", - "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "engines": { - "node": ">=4" - } - }, - "node_modules/globby": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-13.1.2.tgz", - "integrity": "sha512-LKSDZXToac40u8Q1PQtZihbNdTYSNMuWe+K5l+oa6KgDzSvVrHXlJy40hUP522RjAIoNLJYBJi7ow+rbFpIhHQ==", - "dev": true, - "dependencies": { - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.11", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/globby/node_modules/slash": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", - "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, - "node_modules/grapheme-splitter": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", - "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", - "dev": true - }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/has-bigints": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", - "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "engines": { - "node": ">=4" - } - }, - "node_modules/has-property-descriptors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", - "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", - "dependencies": { - "get-intrinsic": "^1.1.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", - "dev": true, - "dependencies": { - "has-symbols": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/html-escaper": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", - "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", - "dev": true - }, - "node_modules/human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "dev": true, - "engines": { - "node": ">=10.17.0" - } - }, - "node_modules/husky": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.1.tgz", - "integrity": "sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==", - "dev": true, - "bin": { - "husky": "lib/bin.js" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/typicode" - } - }, - "node_modules/ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/import-fresh/node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/import-local": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", - "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", - "dev": true, - "dependencies": { - "pkg-dir": "^4.2.0", - "resolve-cwd": "^3.0.0" - }, - "bin": { - "import-local-fixture": "fixtures/cli.js" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true, - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "node_modules/internal-slot": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", - "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", - "dev": true, - "dependencies": { - "get-intrinsic": "^1.1.0", - "has": "^1.0.3", - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "dev": true - }, - "node_modules/is-bigint": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", - "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", - "dev": true, - "dependencies": { - "has-bigints": "^1.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-boolean-object": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", - "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-callable": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", - "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-core-module": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz", - "integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==", - "dependencies": { - "has": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-date-object": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", - "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-generator-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", - "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-negative-zero": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", - "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-number-object": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", - "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-regex": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", - "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-shared-array-buffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", - "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-string": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", - "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-symbol": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", - "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", - "dev": true, - "dependencies": { - "has-symbols": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-weakref": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", - "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "node_modules/istanbul-lib-coverage": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", - "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-instrument": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.1.0.tgz", - "integrity": "sha512-czwUz525rkOFDJxfKK6mYfIs9zBKILyrZQxjz3ABhjQXhbhFsSbo1HW/BFcsDnfJYJWA6thRR5/TUY2qs5W99Q==", - "dev": true, - "dependencies": { - "@babel/core": "^7.12.3", - "@babel/parser": "^7.14.7", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.2.0", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", - "dev": true, - "dependencies": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-report/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-report/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-source-maps": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", - "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", - "dev": true, - "dependencies": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/istanbul-reports": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", - "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", - "dev": true, - "dependencies": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest/-/jest-29.2.0.tgz", - "integrity": "sha512-6krPemKUXCEu5Fh3j6ZVoLMjpTQVm0OCU+7f3K/9gllX8wNIE6NSCQ6s0q2RDoiKLRaQlVRHyscjSPRPqCI0Fg==", - "dev": true, - "dependencies": { - "@jest/core": "^29.2.0", - "@jest/types": "^29.2.0", - "import-local": "^3.0.2", - "jest-cli": "^29.2.0" - }, - "bin": { - "jest": "bin/jest.js" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - } - }, - "node_modules/jest-changed-files": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.2.0.tgz", - "integrity": "sha512-qPVmLLyBmvF5HJrY7krDisx6Voi8DmlV3GZYX0aFNbaQsZeoz1hfxcCMbqDGuQCxU1dJy9eYc2xscE8QrCCYaA==", - "dev": true, - "dependencies": { - "execa": "^5.0.0", - "p-limit": "^3.1.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-changed-files/node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/jest-circus": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.2.0.tgz", - "integrity": "sha512-bpJRMe+VtvYlF3q8JNx+/cAo4FYvNCiR5s7Z0Scf8aC+KJ2ineSjZKtw1cIZbythlplkiro0My8nc65pfCqJ3A==", - "dev": true, - "dependencies": { - "@jest/environment": "^29.2.0", - "@jest/expect": "^29.2.0", - "@jest/test-result": "^29.2.0", - "@jest/types": "^29.2.0", - "@types/node": "*", - "chalk": "^4.0.0", - "co": "^4.6.0", - "dedent": "^0.7.0", - "is-generator-fn": "^2.0.0", - "jest-each": "^29.2.0", - "jest-matcher-utils": "^29.2.0", - "jest-message-util": "^29.2.0", - "jest-runtime": "^29.2.0", - "jest-snapshot": "^29.2.0", - "jest-util": "^29.2.0", - "p-limit": "^3.1.0", - "pretty-format": "^29.2.0", - "slash": "^3.0.0", - "stack-utils": "^2.0.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-circus/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-circus/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-circus/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-circus/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-circus/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-circus/node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/jest-circus/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-cli": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.2.0.tgz", - "integrity": "sha512-/581TzbXeO+5kbtSlhXEthGiVJCC8AP0jgT0iZINAAMW+tTFj2uWU7z+HNUH5yIYdHV7AvRr0fWLrmHJGIruHg==", - "dev": true, - "dependencies": { - "@jest/core": "^29.2.0", - "@jest/test-result": "^29.2.0", - "@jest/types": "^29.2.0", - "chalk": "^4.0.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.9", - "import-local": "^3.0.2", - "jest-config": "^29.2.0", - "jest-util": "^29.2.0", - "jest-validate": "^29.2.0", - "prompts": "^2.0.1", - "yargs": "^17.3.1" - }, - "bin": { - "jest": "bin/jest.js" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - } - }, - "node_modules/jest-cli/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-cli/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-cli/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-cli/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-cli/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-cli/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-config": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.2.0.tgz", - "integrity": "sha512-IkdCsrHIoxDPZAyFcdtQrCQ3uftLqns6Joj0tlbxiAQW4k/zTXmIygqWBmPNxO9FbFkDrhtYZiLHXjaJh9rS+Q==", - "dev": true, - "dependencies": { - "@babel/core": "^7.11.6", - "@jest/test-sequencer": "^29.2.0", - "@jest/types": "^29.2.0", - "babel-jest": "^29.2.0", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "deepmerge": "^4.2.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "jest-circus": "^29.2.0", - "jest-environment-node": "^29.2.0", - "jest-get-type": "^29.2.0", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.2.0", - "jest-runner": "^29.2.0", - "jest-util": "^29.2.0", - "jest-validate": "^29.2.0", - "micromatch": "^4.0.4", - "parse-json": "^5.2.0", - "pretty-format": "^29.2.0", - "slash": "^3.0.0", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "@types/node": "*", - "ts-node": ">=9.0.0" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "ts-node": { - "optional": true - } - } - }, - "node_modules/jest-config/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-config/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-config/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-config/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-config/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-config/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-diff": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.2.0.tgz", - "integrity": "sha512-GsH07qQL+/D/GxlnU+sSg9GL3fBOcuTlmtr3qr2pnkiODCwubNN2/7slW4m3CvxDsEus/VEOfQKRFLyXsUlnZw==", - "dev": true, - "dependencies": { - "chalk": "^4.0.0", - "diff-sequences": "^29.2.0", - "jest-get-type": "^29.2.0", - "pretty-format": "^29.2.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-diff/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-diff/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-diff/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-diff/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-diff/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-diff/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-docblock": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.2.0.tgz", - "integrity": "sha512-bkxUsxTgWQGbXV5IENmfiIuqZhJcyvF7tU4zJ/7ioTutdz4ToB5Yx6JOFBpgI+TphRY4lhOyCWGNH/QFQh5T6A==", - "dev": true, - "dependencies": { - "detect-newline": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-each": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.2.0.tgz", - "integrity": "sha512-h4LeC3L/R7jIMfTdYowevPIssvcPYQ7Qzs+pCSYsJgPztIizXwKmnfhZXBA4WVqdmvMcpmseYEXb67JT7IJ2eg==", - "dev": true, - "dependencies": { - "@jest/types": "^29.2.0", - "chalk": "^4.0.0", - "jest-get-type": "^29.2.0", - "jest-util": "^29.2.0", - "pretty-format": "^29.2.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-each/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-each/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-each/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-each/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-each/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-each/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-environment-node": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.2.0.tgz", - "integrity": "sha512-b4qQGVStPMvtZG97Ac0rvnmSIjCZturFU7MQRMp4JDFl7zoaDLTtXmFjFP1tNmi9te6kR8d+Htbv3nYeoaIz6g==", - "dev": true, - "dependencies": { - "@jest/environment": "^29.2.0", - "@jest/fake-timers": "^29.2.0", - "@jest/types": "^29.2.0", - "@types/node": "*", - "jest-mock": "^29.2.0", - "jest-util": "^29.2.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-get-type": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.2.0.tgz", - "integrity": "sha512-uXNJlg8hKFEnDgFsrCjznB+sTxdkuqiCL6zMgA75qEbAJjJYTs9XPrvDctrEig2GDow22T/LvHgO57iJhXB/UA==", - "dev": true, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-haste-map": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.2.0.tgz", - "integrity": "sha512-qu9lGFi7qJ8v37egS1phZZUJYiMyWnKwu83NlNT1qs50TbedIX2hFl+9ztsJ7U/ENaHwk1/Bs8fqOIQsScIRwg==", - "dev": true, - "dependencies": { - "@jest/types": "^29.2.0", - "@types/graceful-fs": "^4.1.3", - "@types/node": "*", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "graceful-fs": "^4.2.9", - "jest-regex-util": "^29.2.0", - "jest-util": "^29.2.0", - "jest-worker": "^29.2.0", - "micromatch": "^4.0.4", - "walker": "^1.0.8" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "optionalDependencies": { - "fsevents": "^2.3.2" - } - }, - "node_modules/jest-leak-detector": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.2.0.tgz", - "integrity": "sha512-FXT9sCFdct42+oOqGIr/9kmUw3RbhvpkwidCBT5ySHHoWNGd3c9n7HXpFKjEz9UnUITRCGdn0q2s6Sxrq36kwg==", - "dev": true, - "dependencies": { - "jest-get-type": "^29.2.0", - "pretty-format": "^29.2.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-matcher-utils": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.2.0.tgz", - "integrity": "sha512-FcEfKZ4vm28yCdBsvC69EkrEhcfex+IYlRctNJXsRG9+WC3WxgBNORnECIgqUtj7o/h1d8o7xB/dFUiLi4bqtw==", - "dev": true, - "dependencies": { - "chalk": "^4.0.0", - "jest-diff": "^29.2.0", - "jest-get-type": "^29.2.0", - "pretty-format": "^29.2.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-matcher-utils/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-matcher-utils/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-matcher-utils/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-matcher-utils/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-matcher-utils/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-matcher-utils/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-message-util": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.2.0.tgz", - "integrity": "sha512-arBfk5yMFMTnMB22GyG601xGSGthA02vWSewPaxoFo0F9wBqDOyxccPbCcYu8uibw3kduSHXdCOd1PsLSgdomg==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.12.13", - "@jest/types": "^29.2.0", - "@types/stack-utils": "^2.0.0", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "micromatch": "^4.0.4", - "pretty-format": "^29.2.0", - "slash": "^3.0.0", - "stack-utils": "^2.0.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-message-util/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-message-util/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-message-util/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-message-util/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-message-util/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-message-util/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-mock": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.2.0.tgz", - "integrity": "sha512-aiWGR0P8ivssIO17xkehLGFtCcef2ZwQFNPwEer1jQLHxPctDlIg3Hs6QMq1KpPz5dkCcgM7mwGif4a9IPznlg==", - "dev": true, - "dependencies": { - "@jest/types": "^29.2.0", - "@types/node": "*", - "jest-util": "^29.2.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-pnp-resolver": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz", - "integrity": "sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w==", - "dev": true, - "engines": { - "node": ">=6" - }, - "peerDependencies": { - "jest-resolve": "*" - }, - "peerDependenciesMeta": { - "jest-resolve": { - "optional": true - } - } - }, - "node_modules/jest-regex-util": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.2.0.tgz", - "integrity": "sha512-6yXn0kg2JXzH30cr2NlThF+70iuO/3irbaB4mh5WyqNIvLLP+B6sFdluO1/1RJmslyh/f9osnefECflHvTbwVA==", - "dev": true, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-resolve": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.2.0.tgz", - "integrity": "sha512-f5c0ljNg2guDBCC7wi92vAhNuA0BtAG5vkY7Fob0c7sUMU1g87mTXqRmjrVFe2XvdwP5m5T/e5KJsCKu9hRvBA==", - "dev": true, - "dependencies": { - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.2.0", - "jest-pnp-resolver": "^1.2.2", - "jest-util": "^29.2.0", - "jest-validate": "^29.2.0", - "resolve": "^1.20.0", - "resolve.exports": "^1.1.0", - "slash": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-resolve-dependencies": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.2.0.tgz", - "integrity": "sha512-Cd0Z39sDntEnfR9PoUdFHUAGDvtKI0/7Wt73l3lt03A3yQ+A6Qi3XmBuqGjdFl2QbXaPa937oLhilG612P8HGQ==", - "dev": true, - "dependencies": { - "jest-regex-util": "^29.2.0", - "jest-snapshot": "^29.2.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-resolve/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-resolve/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-resolve/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-resolve/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-resolve/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-resolve/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-runner": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.2.0.tgz", - "integrity": "sha512-VPBrCwl9fM2mc5yk6yZhNrgXzRJMD5jfLmntkMLlrVq4hQPWbRK998iJlR+DOGCO04TC9PPYLntOJ001Vnf28g==", - "dev": true, - "dependencies": { - "@jest/console": "^29.2.0", - "@jest/environment": "^29.2.0", - "@jest/test-result": "^29.2.0", - "@jest/transform": "^29.2.0", - "@jest/types": "^29.2.0", - "@types/node": "*", - "chalk": "^4.0.0", - "emittery": "^0.10.2", - "graceful-fs": "^4.2.9", - "jest-docblock": "^29.2.0", - "jest-environment-node": "^29.2.0", - "jest-haste-map": "^29.2.0", - "jest-leak-detector": "^29.2.0", - "jest-message-util": "^29.2.0", - "jest-resolve": "^29.2.0", - "jest-runtime": "^29.2.0", - "jest-util": "^29.2.0", - "jest-watcher": "^29.2.0", - "jest-worker": "^29.2.0", - "p-limit": "^3.1.0", - "source-map-support": "0.5.13" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-runner/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-runner/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-runner/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-runner/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-runner/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-runner/node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/jest-runner/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-runtime": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.2.0.tgz", - "integrity": "sha512-+GDmzCrswQF+mvI0upTYMe/OPYnlRRNLLDHM9AFLp2y7zxWoDoYgb8DL3WwJ8d9m743AzrnvBV9JQHi/0ed7dg==", - "dev": true, - "dependencies": { - "@jest/environment": "^29.2.0", - "@jest/fake-timers": "^29.2.0", - "@jest/globals": "^29.2.0", - "@jest/source-map": "^29.2.0", - "@jest/test-result": "^29.2.0", - "@jest/transform": "^29.2.0", - "@jest/types": "^29.2.0", - "@types/node": "*", - "chalk": "^4.0.0", - "cjs-module-lexer": "^1.0.0", - "collect-v8-coverage": "^1.0.0", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.2.0", - "jest-message-util": "^29.2.0", - "jest-mock": "^29.2.0", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.2.0", - "jest-snapshot": "^29.2.0", - "jest-util": "^29.2.0", - "slash": "^3.0.0", - "strip-bom": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-runtime/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-runtime/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-runtime/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-runtime/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-runtime/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-runtime/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-snapshot": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.2.0.tgz", - "integrity": "sha512-YCKrOR0PLRXROmww73fHO9oeY4tL+LPQXWR3yml1+hKbQDR8j1VUrVzB65hKSJJgxBOr1vWx+hmz2by8JjAU5w==", - "dev": true, - "dependencies": { - "@babel/core": "^7.11.6", - "@babel/generator": "^7.7.2", - "@babel/plugin-syntax-jsx": "^7.7.2", - "@babel/plugin-syntax-typescript": "^7.7.2", - "@babel/traverse": "^7.7.2", - "@babel/types": "^7.3.3", - "@jest/expect-utils": "^29.2.0", - "@jest/transform": "^29.2.0", - "@jest/types": "^29.2.0", - "@types/babel__traverse": "^7.0.6", - "@types/prettier": "^2.1.5", - "babel-preset-current-node-syntax": "^1.0.0", - "chalk": "^4.0.0", - "expect": "^29.2.0", - "graceful-fs": "^4.2.9", - "jest-diff": "^29.2.0", - "jest-get-type": "^29.2.0", - "jest-haste-map": "^29.2.0", - "jest-matcher-utils": "^29.2.0", - "jest-message-util": "^29.2.0", - "jest-util": "^29.2.0", - "natural-compare": "^1.4.0", - "pretty-format": "^29.2.0", - "semver": "^7.3.5" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-snapshot/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-snapshot/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-snapshot/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-snapshot/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-snapshot/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-snapshot/node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/jest-snapshot/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-util": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.2.0.tgz", - "integrity": "sha512-8M1dx12ujkBbnhwytrezWY0Ut79hbflwodE+qZKjxSRz5qt4xDp6dQQJaOCFvCmE0QJqp9KyEK33lpPNjnhevw==", - "dev": true, - "dependencies": { - "@jest/types": "^29.2.0", - "@types/node": "*", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", - "picomatch": "^2.2.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-util/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-util/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-util/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-util/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-util/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-util/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-validate": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.2.0.tgz", - "integrity": "sha512-4Vl51bPNeFeDok9aJiOnrC6tqJbOp4iMCYlewoC2ZzYJZ5+6pfr3KObAdx5wP8auHcg2MRaguiqj5OdScZa72g==", - "dev": true, - "dependencies": { - "@jest/types": "^29.2.0", - "camelcase": "^6.2.0", - "chalk": "^4.0.0", - "jest-get-type": "^29.2.0", - "leven": "^3.1.0", - "pretty-format": "^29.2.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-validate/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-validate/node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/jest-validate/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-validate/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-validate/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-validate/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-validate/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-watcher": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.2.0.tgz", - "integrity": "sha512-bRh0JdUeN+cl9XfK7tMnXLm4Mv70hG2SZlqbkFe5CTs7oeCkbwlGBk/mEfEJ63mrxZ8LPbnfaMpfSmkhEQBEGA==", - "dev": true, - "dependencies": { - "@jest/test-result": "^29.2.0", - "@jest/types": "^29.2.0", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "emittery": "^0.10.2", - "jest-util": "^29.2.0", - "string-length": "^4.0.1" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-watcher/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-watcher/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-watcher/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-watcher/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/jest-watcher/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-watcher/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-worker": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.2.0.tgz", - "integrity": "sha512-mluOlMbRX1H59vGVzPcVg2ALfCausbBpxC8a2KWOzInhYHZibbHH8CB0C1JkmkpfurrkOYgF7FPmypuom1OM9A==", - "dev": true, - "dependencies": { - "@types/node": "*", - "jest-util": "^29.2.0", - "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-worker/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-worker/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, - "node_modules/js-sdsl": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.1.5.tgz", - "integrity": "sha512-08bOAKweV2NUC1wqTtf3qZlnpOX/R2DU9ikpjOHs0H+ibQv3zpncVQg6um4uYtRtrwIX8M4Nh3ytK4HGlYAq7Q==", - "dev": true - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" - }, - "node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "bin": { - "jsesc": "bin/jsesc" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true - }, - "node_modules/json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true - }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", - "dev": true - }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/jsx-ast-utils": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.3.tgz", - "integrity": "sha512-fYQHZTZ8jSfmWZ0iyzfwiU4WDX4HpHbMCZ3gPlWYiCl3BoeOTsqKBqnTVfH2rYT7eP5c3sVbeSPHnnJOaTrWiw==", - "dev": true, - "dependencies": { - "array-includes": "^3.1.5", - "object.assign": "^4.1.3" - }, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/leven": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", - "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/lines-and-columns": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true - }, - "node_modules/load-json-file": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-5.3.0.tgz", - "integrity": "sha512-cJGP40Jc/VXUsp8/OrnyKyTZ1y6v/dphm3bioS+RrKXjK2BB6wHUd6JptZEFDGgGahMT+InnZO5i1Ei9mpC8Bw==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.15", - "parse-json": "^4.0.0", - "pify": "^4.0.1", - "strip-bom": "^3.0.0", - "type-fest": "^0.3.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/load-json-file/node_modules/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", - "dev": true, - "dependencies": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/load-json-file/node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/load-json-file/node_modules/type-fest": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz", - "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/lodash.debounce": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", - "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==" - }, - "node_modules/lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true - }, - "node_modules/loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dev": true, - "dependencies": { - "js-tokens": "^3.0.0 || ^4.0.0" - }, - "bin": { - "loose-envify": "cli.js" - } - }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/makeerror": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", - "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", - "dev": true, - "dependencies": { - "tmpl": "1.0.5" - } - }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dev": true, - "dependencies": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minimist": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", - "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", - "dev": true - }, - "node_modules/node-int64": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", - "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", - "dev": true - }, - "node_modules/node-releases": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.6.tgz", - "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==" - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "dependencies": { - "path-key": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-inspect": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", - "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/object.assign": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", - "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "has-symbols": "^1.0.3", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object.entries": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.5.tgz", - "integrity": "sha512-TyxmjUoZggd4OrrU1W66FMDG6CuqJxsFvymeyXI51+vQLN67zYfZseptRge703kKQdo4uccgAKebXFcRCzk4+g==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/object.fromentries": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.5.tgz", - "integrity": "sha512-CAyG5mWQRRiBU57Re4FKoTBjXfDoNwdFVH2Y1tS9PqCsfUTymAohOkEMSG3aRNKmv4lV3O7p1et7c187q6bynw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object.hasown": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.1.tgz", - "integrity": "sha512-LYLe4tivNQzq4JdaWW6WO3HMZZJWzkkH8fnI6EebWl0VZth2wL2Lovm74ep2/gZzlaTdV62JZHEqHQ2yVn8Q/A==", - "dev": true, - "dependencies": { - "define-properties": "^1.1.4", - "es-abstract": "^1.19.5" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object.values": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", - "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "dependencies": { - "mimic-fn": "^2.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/parse-json": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", - "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" - }, - "node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/pirates": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz", - "integrity": "sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==", - "dev": true, - "engines": { - "node": ">= 6" - } - }, - "node_modules/pkg-conf": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-3.1.0.tgz", - "integrity": "sha512-m0OTbR/5VPNPqO1ph6Fqbj7Hv6QU7gR/tQW40ZqrL1rjgCU85W6C1bJn0BItuJqnR98PWzw7Z8hHeChD1WrgdQ==", - "dev": true, - "dependencies": { - "find-up": "^3.0.0", - "load-json-file": "^5.2.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/pkg-conf/node_modules/find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "dependencies": { - "locate-path": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/pkg-conf/node_modules/locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "dependencies": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/pkg-conf/node_modules/p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "dependencies": { - "p-limit": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/pkg-conf/node_modules/path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/pretty-format": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.2.0.tgz", - "integrity": "sha512-QCSUFdwOi924g24czhOH5eTkXxUCqlLGZBRCySlwDYHIXRJkdGyjJc9nZaqhlFBZws8dq5Dvk0lCilsmlfsPxw==", - "dev": true, - "dependencies": { - "@jest/schemas": "^29.0.0", - "ansi-styles": "^5.0.0", - "react-is": "^18.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/pretty-format/node_modules/ansi-styles": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", - "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/prompts": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", - "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", - "dev": true, - "dependencies": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.5" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/prop-types": { - "version": "15.8.1", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", - "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", - "dev": true, - "dependencies": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.13.1" - } - }, - "node_modules/prop-types/node_modules/react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", - "dev": true - }, - "node_modules/punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/react-is": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", - "dev": true - }, - "node_modules/regenerate": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", - "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==" - }, - "node_modules/regenerate-unicode-properties": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.0.tgz", - "integrity": "sha512-d1VudCLoIGitcU/hEg2QqvyGZQmdC0Lf8BqdOMXGFSvJP4bNV1+XqbPQeHHLD51Jh4QJJ225dlIFvY4Ly6MXmQ==", - "dependencies": { - "regenerate": "^1.4.2" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/regenerator-runtime": { - "version": "0.13.10", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.10.tgz", - "integrity": "sha512-KepLsg4dU12hryUO7bp/axHAKvwGOCV0sGloQtpagJ12ai+ojVDqkeGSiRX1zlq+kjIMZ1t7gpze+26QqtdGqw==" - }, - "node_modules/regenerator-transform": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.15.0.tgz", - "integrity": "sha512-LsrGtPmbYg19bcPHwdtmXwbW+TqNvtY4riE3P83foeHRroMbH6/2ddFBfab3t7kbzc7v7p4wbkIecHImqt0QNg==", - "dependencies": { - "@babel/runtime": "^7.8.4" - } - }, - "node_modules/regexp.prototype.flags": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", - "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "functions-have-names": "^1.2.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, - "node_modules/regexpu-core": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.2.1.tgz", - "integrity": "sha512-HrnlNtpvqP1Xkb28tMhBUO2EbyUHdQlsnlAhzWcwHy8WJR53UWr7/MAvqrsQKMbV4qdpv03oTMG8iIhfsPFktQ==", - "dependencies": { - "regenerate": "^1.4.2", - "regenerate-unicode-properties": "^10.1.0", - "regjsgen": "^0.7.1", - "regjsparser": "^0.9.1", - "unicode-match-property-ecmascript": "^2.0.0", - "unicode-match-property-value-ecmascript": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/regjsgen": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.7.1.tgz", - "integrity": "sha512-RAt+8H2ZEzHeYWxZ3H2z6tF18zyyOnlcdaafLrm21Bguj7uZy6ULibiAFdXEtKQY4Sy7wDTwDiOazasMLc4KPA==" - }, - "node_modules/regjsparser": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.9.1.tgz", - "integrity": "sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ==", - "dependencies": { - "jsesc": "~0.5.0" - }, - "bin": { - "regjsparser": "bin/parser" - } - }, - "node_modules/regjsparser/node_modules/jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==", - "bin": { - "jsesc": "bin/jsesc" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", - "dependencies": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/resolve-cwd": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", - "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", - "dev": true, - "dependencies": { - "resolve-from": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/resolve.exports": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-1.1.0.tgz", - "integrity": "sha512-J1l+Zxxp4XK3LUDZ9m60LRJF/mAe4z6a4xyabPHk7pvK5t35dACV32iIjJDFeWZFfZlO29w6SZ67knR0tHzJtQ==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true, - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, - "node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "node_modules/safe-regex-test": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", - "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.3", - "is-regex": "^1.1.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true - }, - "node_modules/sisteransi": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", - "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", - "dev": true - }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-support": { - "version": "0.5.13", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", - "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", - "dev": true, - "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "node_modules/stack-utils": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.5.tgz", - "integrity": "sha512-xrQcmYhOsn/1kX+Vraq+7j4oE2j/6BFscZ0etmYg81xuM8Gq0022Pxb8+IqgOFUIaxHs0KaSb7T1+OegiNrNFA==", - "dev": true, - "dependencies": { - "escape-string-regexp": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/stack-utils/node_modules/escape-string-regexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/standard": { - "version": "17.0.0", - "resolved": "https://registry.npmjs.org/standard/-/standard-17.0.0.tgz", - "integrity": "sha512-GlCM9nzbLUkr+TYR5I2WQoIah4wHA2lMauqbyPLV/oI5gJxqhHzhjl9EG2N0lr/nRqI3KCbCvm/W3smxvLaChA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "eslint": "^8.13.0", - "eslint-config-standard": "17.0.0", - "eslint-config-standard-jsx": "^11.0.0", - "eslint-plugin-import": "^2.26.0", - "eslint-plugin-n": "^15.1.0", - "eslint-plugin-promise": "^6.0.0", - "eslint-plugin-react": "^7.28.0", - "standard-engine": "^15.0.0" - }, - "bin": { - "standard": "bin/cmd.js" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/standard-engine": { - "version": "15.0.0", - "resolved": "https://registry.npmjs.org/standard-engine/-/standard-engine-15.0.0.tgz", - "integrity": "sha512-4xwUhJNo1g/L2cleysUqUv7/btn7GEbYJvmgKrQ2vd/8pkTmN8cpqAZg+BT8Z1hNeEH787iWUdOpL8fmApLtxA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "get-stdin": "^8.0.0", - "minimist": "^1.2.6", - "pkg-conf": "^3.1.0", - "xdg-basedir": "^4.0.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/string-length": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", - "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", - "dev": true, - "dependencies": { - "char-regex": "^1.0.2", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/string.prototype.matchall": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.7.tgz", - "integrity": "sha512-f48okCX7JiwVi1NXCVWcFnZgADDC/n2vePlQ/KUCNqCikLLilQvwjMO8+BHVKvgzH0JB0J9LEPgxOGT02RoETg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1", - "get-intrinsic": "^1.1.1", - "has-symbols": "^1.0.3", - "internal-slot": "^1.0.3", - "regexp.prototype.flags": "^1.4.1", - "side-channel": "^1.0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/string.prototype.trimend": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", - "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.19.5" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/string.prototype.trimstart": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", - "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.19.5" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-bom": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", - "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/test-exclude": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", - "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", - "dev": true, - "dependencies": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", - "dev": true - }, - "node_modules/tmpl": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", - "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", - "dev": true - }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", - "engines": { - "node": ">=4" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/tsconfig-paths": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", - "integrity": "sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==", - "dev": true, - "dependencies": { - "@types/json5": "^0.0.29", - "json5": "^1.0.1", - "minimist": "^1.2.6", - "strip-bom": "^3.0.0" - } - }, - "node_modules/tsconfig-paths/node_modules/json5": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", - "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", - "dev": true, - "dependencies": { - "minimist": "^1.2.0" - }, - "bin": { - "json5": "lib/cli.js" - } - }, - "node_modules/tsconfig-paths/node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/unbox-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", - "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "has-bigints": "^1.0.2", - "has-symbols": "^1.0.3", - "which-boxed-primitive": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/unicode-canonical-property-names-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", - "integrity": "sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==", - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-match-property-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", - "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", - "dependencies": { - "unicode-canonical-property-names-ecmascript": "^2.0.0", - "unicode-property-aliases-ecmascript": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-match-property-value-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.0.0.tgz", - "integrity": "sha512-7Yhkc0Ye+t4PNYzOGKedDhXbYIBe1XEQYQxOPyhcXNMJ0WCABqqj6ckydd6pWRZTHV4GuCPKdBAUiMc60tsKVw==", - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-property-aliases-ecmascript": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz", - "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==", - "engines": { - "node": ">=4" - } - }, - "node_modules/update-browserslist-db": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz", - "integrity": "sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - } - ], - "dependencies": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" - }, - "bin": { - "browserslist-lint": "cli.js" - }, - "peerDependencies": { - "browserslist": ">= 4.21.0" - } - }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/v8-to-istanbul": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz", - "integrity": "sha512-74Y4LqY74kLE6IFyIjPtkSTWzUZmj8tdHT9Ii/26dvQ6K9Dl2NbEfj0XgU2sHCtKgt5VupqhlO/5aWuqS+IY1w==", - "dev": true, - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.12", - "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^1.6.0" - }, - "engines": { - "node": ">=10.12.0" - } - }, - "node_modules/walker": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", - "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", - "dev": true, - "dependencies": { - "makeerror": "1.0.12" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/which-boxed-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", - "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", - "dev": true, - "dependencies": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/wrap-ansi/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/wrap-ansi/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "node_modules/write-file-atomic": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", - "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", - "dev": true, - "dependencies": { - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.7" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/xdg-basedir": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", - "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, - "node_modules/yargs": { - "version": "17.6.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.0.tgz", - "integrity": "sha512-8H/wTDqlSwoSnScvV2N/JHfLWOKuh5MVla9hqLjK3nsfyy6Y4kDSYSvkU5YCUEPOSnRXfIyx3Sq+B/IWudTo4g==", - "dev": true, - "dependencies": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "dev": true, - "engines": { - "node": ">=12" - } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - } - }, - "dependencies": { - "@ampproject/remapping": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", - "integrity": "sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==", - "requires": { - "@jridgewell/gen-mapping": "^0.1.0", - "@jridgewell/trace-mapping": "^0.3.9" - } - }, - "@babel/code-frame": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", - "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", - "requires": { - "@babel/highlight": "^7.18.6" - } - }, - "@babel/compat-data": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.19.4.tgz", - "integrity": "sha512-CHIGpJcUQ5lU9KrPHTjBMhVwQG6CQjxfg36fGXl3qk/Gik1WwWachaXFuo0uCWJT/mStOKtcbFJCaVLihC1CMw==" - }, - "@babel/core": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.19.3.tgz", - "integrity": "sha512-WneDJxdsjEvyKtXKsaBGbDeiyOjR5vYq4HcShxnIbG0qixpoHjI3MqeZM9NDvsojNCEBItQE4juOo/bU6e72gQ==", - "requires": { - "@ampproject/remapping": "^2.1.0", - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.19.3", - "@babel/helper-compilation-targets": "^7.19.3", - "@babel/helper-module-transforms": "^7.19.0", - "@babel/helpers": "^7.19.0", - "@babel/parser": "^7.19.3", - "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.3", - "@babel/types": "^7.19.3", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.1", - "semver": "^6.3.0" - } - }, - "@babel/eslint-parser": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.19.1.tgz", - "integrity": "sha512-AqNf2QWt1rtu2/1rLswy6CDP7H9Oh3mMhk177Y67Rg8d7RD9WfOLLv8CGn6tisFvS2htm86yIe1yLF6I1UDaGQ==", - "dev": true, - "requires": { - "@nicolo-ribaudo/eslint-scope-5-internals": "5.1.1-v1", - "eslint-visitor-keys": "^2.1.0", - "semver": "^6.3.0" - } - }, - "@babel/generator": { - "version": "7.19.5", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.19.5.tgz", - "integrity": "sha512-DxbNz9Lz4aMZ99qPpO1raTbcrI1ZeYh+9NR9qhfkQIbFtVEqotHojEBxHzmxhVONkGt6VyrqVQcgpefMy9pqcg==", - "requires": { - "@babel/types": "^7.19.4", - "@jridgewell/gen-mapping": "^0.3.2", - "jsesc": "^2.5.1" - }, - "dependencies": { - "@jridgewell/gen-mapping": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz", - "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==", - "requires": { - "@jridgewell/set-array": "^1.0.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" - } - } - } - }, - "@babel/helper-annotate-as-pure": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.18.6.tgz", - "integrity": "sha512-duORpUiYrEpzKIop6iNbjnwKLAKnJ47csTyRACyEmWj0QdUrm5aqNJGHSSEQSUAvNW0ojX0dOmK9dZduvkfeXA==", - "requires": { - "@babel/types": "^7.18.6" - } - }, - "@babel/helper-builder-binary-assignment-operator-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.18.9.tgz", - "integrity": "sha512-yFQ0YCHoIqarl8BCRwBL8ulYUaZpz3bNsA7oFepAzee+8/+ImtADXNOmO5vJvsPff3qi+hvpkY/NYBTrBQgdNw==", - "requires": { - "@babel/helper-explode-assignable-expression": "^7.18.6", - "@babel/types": "^7.18.9" - } - }, - "@babel/helper-compilation-targets": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.3.tgz", - "integrity": "sha512-65ESqLGyGmLvgR0mst5AdW1FkNlj9rQsCKduzEoEPhBCDFGXvz2jW6bXFG6i0/MrV2s7hhXjjb2yAzcPuQlLwg==", - "requires": { - "@babel/compat-data": "^7.19.3", - "@babel/helper-validator-option": "^7.18.6", - "browserslist": "^4.21.3", - "semver": "^6.3.0" - } - }, - "@babel/helper-create-class-features-plugin": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.19.0.tgz", - "integrity": "sha512-NRz8DwF4jT3UfrmUoZjd0Uph9HQnP30t7Ash+weACcyNkiYTywpIjDBgReJMKgr+n86sn2nPVVmJ28Dm053Kqw==", - "requires": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.19.0", - "@babel/helper-member-expression-to-functions": "^7.18.9", - "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/helper-replace-supers": "^7.18.9", - "@babel/helper-split-export-declaration": "^7.18.6" - } - }, - "@babel/helper-create-regexp-features-plugin": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.19.0.tgz", - "integrity": "sha512-htnV+mHX32DF81amCDrwIDr8nrp1PTm+3wfBN9/v8QJOLEioOCOG7qNyq0nHeFiWbT3Eb7gsPwEmV64UCQ1jzw==", - "requires": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "regexpu-core": "^5.1.0" - } - }, - "@babel/helper-define-polyfill-provider": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.3.tgz", - "integrity": "sha512-z5aQKU4IzbqCC1XH0nAqfsFLMVSo22SBKUc0BxGrLkolTdPTructy0ToNnlO2zA4j9Q/7pjMZf0DSY+DSTYzww==", - "requires": { - "@babel/helper-compilation-targets": "^7.17.7", - "@babel/helper-plugin-utils": "^7.16.7", - "debug": "^4.1.1", - "lodash.debounce": "^4.0.8", - "resolve": "^1.14.2", - "semver": "^6.1.2" - } - }, - "@babel/helper-environment-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", - "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==" - }, - "@babel/helper-explode-assignable-expression": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.18.6.tgz", - "integrity": "sha512-eyAYAsQmB80jNfg4baAtLeWAQHfHFiR483rzFK+BhETlGZaQC9bsfrugfXDCbRHLQbIA7U5NxhhOxN7p/dWIcg==", - "requires": { - "@babel/types": "^7.18.6" - } - }, - "@babel/helper-function-name": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz", - "integrity": "sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w==", - "requires": { - "@babel/template": "^7.18.10", - "@babel/types": "^7.19.0" - } - }, - "@babel/helper-hoist-variables": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", - "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", - "requires": { - "@babel/types": "^7.18.6" - } - }, - "@babel/helper-member-expression-to-functions": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.18.9.tgz", - "integrity": "sha512-RxifAh2ZoVU67PyKIO4AMi1wTenGfMR/O/ae0CCRqwgBAt5v7xjdtRw7UoSbsreKrQn5t7r89eruK/9JjYHuDg==", - "requires": { - "@babel/types": "^7.18.9" - } - }, - "@babel/helper-module-imports": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz", - "integrity": "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==", - "requires": { - "@babel/types": "^7.18.6" - } - }, - "@babel/helper-module-transforms": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.19.0.tgz", - "integrity": "sha512-3HBZ377Fe14RbLIA+ac3sY4PTgpxHVkFrESaWhoI5PuyXPBBX8+C34qblV9G89ZtycGJCmCI/Ut+VUDK4bltNQ==", - "requires": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-simple-access": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/helper-validator-identifier": "^7.18.6", - "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.0", - "@babel/types": "^7.19.0" - } - }, - "@babel/helper-optimise-call-expression": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.18.6.tgz", - "integrity": "sha512-HP59oD9/fEHQkdcbgFCnbmgH5vIQTJbxh2yf+CdM89/glUNnuzr87Q8GIjGEnOktTROemO0Pe0iPAYbqZuOUiA==", - "requires": { - "@babel/types": "^7.18.6" - } - }, - "@babel/helper-plugin-utils": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.19.0.tgz", - "integrity": "sha512-40Ryx7I8mT+0gaNxm8JGTZFUITNqdLAgdg0hXzeVZxVD6nFsdhQvip6v8dqkRHzsz1VFpFAaOCHNn0vKBL7Czw==" - }, - "@babel/helper-remap-async-to-generator": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.18.9.tgz", - "integrity": "sha512-dI7q50YKd8BAv3VEfgg7PS7yD3Rtbi2J1XMXaalXO0W0164hYLnh8zpjRS0mte9MfVp/tltvr/cfdXPvJr1opA==", - "requires": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-wrap-function": "^7.18.9", - "@babel/types": "^7.18.9" - } - }, - "@babel/helper-replace-supers": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.19.1.tgz", - "integrity": "sha512-T7ahH7wV0Hfs46SFh5Jz3s0B6+o8g3c+7TMxu7xKfmHikg7EAZ3I2Qk9LFhjxXq8sL7UkP5JflezNwoZa8WvWw==", - "requires": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-member-expression-to-functions": "^7.18.9", - "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/traverse": "^7.19.1", - "@babel/types": "^7.19.0" - } - }, - "@babel/helper-simple-access": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.19.4.tgz", - "integrity": "sha512-f9Xq6WqBFqaDfbCzn2w85hwklswz5qsKlh7f08w4Y9yhJHpnNC0QemtSkK5YyOY8kPGvyiwdzZksGUhnGdaUIg==", - "requires": { - "@babel/types": "^7.19.4" - } - }, - "@babel/helper-skip-transparent-expression-wrappers": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.18.9.tgz", - "integrity": "sha512-imytd2gHi3cJPsybLRbmFrF7u5BIEuI2cNheyKi3/iOBC63kNn3q8Crn2xVuESli0aM4KYsyEqKyS7lFL8YVtw==", - "requires": { - "@babel/types": "^7.18.9" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", - "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", - "requires": { - "@babel/types": "^7.18.6" - } - }, - "@babel/helper-string-parser": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", - "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==" - }, - "@babel/helper-validator-identifier": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", - "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==" - }, - "@babel/helper-validator-option": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz", - "integrity": "sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==" - }, - "@babel/helper-wrap-function": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.19.0.tgz", - "integrity": "sha512-txX8aN8CZyYGTwcLhlk87KRqncAzhh5TpQamZUa0/u3an36NtDpUP6bQgBCBcLeBs09R/OwQu3OjK0k/HwfNDg==", - "requires": { - "@babel/helper-function-name": "^7.19.0", - "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.0", - "@babel/types": "^7.19.0" - } - }, - "@babel/helpers": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.19.4.tgz", - "integrity": "sha512-G+z3aOx2nfDHwX/kyVii5fJq+bgscg89/dJNWpYeKeBv3v9xX8EIabmx1k6u9LS04H7nROFVRVK+e3k0VHp+sw==", - "requires": { - "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.4", - "@babel/types": "^7.19.4" - } - }, - "@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", - "requires": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - } - }, - "@babel/parser": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.4.tgz", - "integrity": "sha512-qpVT7gtuOLjWeDTKLkJ6sryqLliBaFpAtGeqw5cs5giLldvh+Ch0plqnUMKoVAUS6ZEueQQiZV+p5pxtPitEsA==" - }, - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.18.6.tgz", - "integrity": "sha512-Dgxsyg54Fx1d4Nge8UnvTrED63vrwOdPmyvPzlNN/boaliRP54pm3pGzZD1SJUwrBA+Cs/xdG8kXX6Mn/RfISQ==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.18.9.tgz", - "integrity": "sha512-AHrP9jadvH7qlOj6PINbgSuphjQUAK7AOT7DPjBo9EHoLhQTnnK5u45e1Hd4DbSQEO9nqPWtQ89r+XEOWFScKg==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-skip-transparent-expression-wrappers": "^7.18.9", - "@babel/plugin-proposal-optional-chaining": "^7.18.9" - } - }, - "@babel/plugin-proposal-async-generator-functions": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.19.1.tgz", - "integrity": "sha512-0yu8vNATgLy4ivqMNBIwb1HebCelqN7YX8SL3FDXORv/RqT0zEEWUCH4GH44JsSrvCu6GqnAdR5EBFAPeNBB4Q==", - "requires": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-remap-async-to-generator": "^7.18.9", - "@babel/plugin-syntax-async-generators": "^7.8.4" - } - }, - "@babel/plugin-proposal-class-properties": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz", - "integrity": "sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ==", - "requires": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-proposal-class-static-block": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.18.6.tgz", - "integrity": "sha512-+I3oIiNxrCpup3Gi8n5IGMwj0gOCAjcJUSQEcotNnCCPMEnixawOQ+KeJPlgfjzx+FKQ1QSyZOWe7wmoJp7vhw==", - "requires": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-class-static-block": "^7.14.5" - } - }, - "@babel/plugin-proposal-dynamic-import": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.18.6.tgz", - "integrity": "sha512-1auuwmK+Rz13SJj36R+jqFPMJWyKEDd7lLSdOj4oJK0UTgGueSAtkrCvz9ewmgyU/P941Rv2fQwZJN8s6QruXw==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-dynamic-import": "^7.8.3" - } - }, - "@babel/plugin-proposal-export-namespace-from": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.18.9.tgz", - "integrity": "sha512-k1NtHyOMvlDDFeb9G5PhUXuGj8m/wiwojgQVEhJ/fsVsMCpLyOP4h0uGEjYJKrRI+EVPlb5Jk+Gt9P97lOGwtA==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3" - } - }, - "@babel/plugin-proposal-json-strings": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.18.6.tgz", - "integrity": "sha512-lr1peyn9kOdbYc0xr0OdHTZ5FMqS6Di+H0Fz2I/JwMzGmzJETNeOFq2pBySw6X/KFL5EWDjlJuMsUGRFb8fQgQ==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-json-strings": "^7.8.3" - } - }, - "@babel/plugin-proposal-logical-assignment-operators": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.18.9.tgz", - "integrity": "sha512-128YbMpjCrP35IOExw2Fq+x55LMP42DzhOhX2aNNIdI9avSWl2PI0yuBWarr3RYpZBSPtabfadkH2yeRiMD61Q==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" - } - }, - "@babel/plugin-proposal-nullish-coalescing-operator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.18.6.tgz", - "integrity": "sha512-wQxQzxYeJqHcfppzBDnm1yAY0jSRkUXR2z8RePZYrKwMKgMlE8+Z6LUno+bd6LvbGh8Gltvy74+9pIYkr+XkKA==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" - } - }, - "@babel/plugin-proposal-numeric-separator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.18.6.tgz", - "integrity": "sha512-ozlZFogPqoLm8WBr5Z8UckIoE4YQ5KESVcNudyXOR8uqIkliTEgJ3RoketfG6pmzLdeZF0H/wjE9/cCEitBl7Q==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-numeric-separator": "^7.10.4" - } - }, - "@babel/plugin-proposal-object-rest-spread": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.19.4.tgz", - "integrity": "sha512-wHmj6LDxVDnL+3WhXteUBaoM1aVILZODAUjg11kHqG4cOlfgMQGxw6aCgvrXrmaJR3Bn14oZhImyCPZzRpC93Q==", - "requires": { - "@babel/compat-data": "^7.19.4", - "@babel/helper-compilation-targets": "^7.19.3", - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.18.8" - } - }, - "@babel/plugin-proposal-optional-catch-binding": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.18.6.tgz", - "integrity": "sha512-Q40HEhs9DJQyaZfUjjn6vE8Cv4GmMHCYuMGIWUnlxH6400VGxOuwWsPt4FxXxJkC/5eOzgn0z21M9gMT4MOhbw==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" - } - }, - "@babel/plugin-proposal-optional-chaining": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.18.9.tgz", - "integrity": "sha512-v5nwt4IqBXihxGsW2QmCWMDS3B3bzGIk/EQVZz2ei7f3NJl8NzAJVvUmpDW5q1CRNY+Beb/k58UAH1Km1N411w==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-skip-transparent-expression-wrappers": "^7.18.9", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" - } - }, - "@babel/plugin-proposal-private-methods": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.18.6.tgz", - "integrity": "sha512-nutsvktDItsNn4rpGItSNV2sz1XwS+nfU0Rg8aCx3W3NOKVzdMjJRu0O5OkgDp3ZGICSTbgRpxZoWsxoKRvbeA==", - "requires": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-proposal-private-property-in-object": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.18.6.tgz", - "integrity": "sha512-9Rysx7FOctvT5ouj5JODjAFAkgGoudQuLPamZb0v1TGLpapdNaftzifU8NTWQm0IRjqoYypdrSmyWgkocDQ8Dw==", - "requires": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5" - } - }, - "@babel/plugin-proposal-unicode-property-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.18.6.tgz", - "integrity": "sha512-2BShG/d5yoZyXZfVePH91urL5wTG6ASZU9M4o03lKK8u8UW1y08OMttBSOADTcJrnPMpvDXRG3G8fyLh4ovs8w==", - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-syntax-async-generators": { - "version": "7.8.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", - "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-bigint": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", - "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-class-properties": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", - "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", - "requires": { - "@babel/helper-plugin-utils": "^7.12.13" - } - }, - "@babel/plugin-syntax-class-static-block": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", - "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-syntax-dynamic-import": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", - "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-export-namespace-from": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz", - "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==", - "requires": { - "@babel/helper-plugin-utils": "^7.8.3" - } - }, - "@babel/plugin-syntax-import-assertions": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.18.6.tgz", - "integrity": "sha512-/DU3RXad9+bZwrgWJQKbr39gYbJpLJHezqEzRzi/BHRlJ9zsQb4CK2CA/5apllXNomwA1qHwzvHl+AdEmC5krQ==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-syntax-import-meta": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", - "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-json-strings": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", - "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-jsx": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz", - "integrity": "sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-syntax-logical-assignment-operators": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", - "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-nullish-coalescing-operator": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", - "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-numeric-separator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", - "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", - "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-optional-catch-binding": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", - "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-optional-chaining": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", - "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-private-property-in-object": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", - "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-syntax-top-level-await": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", - "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-syntax-typescript": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.18.6.tgz", - "integrity": "sha512-mAWAuq4rvOepWCBid55JuRNvpTNf2UGVgoz4JV0fXEKolsVZDzsa4NqCef758WZJj/GDu0gVGItjKFiClTAmZA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-transform-arrow-functions": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.18.6.tgz", - "integrity": "sha512-9S9X9RUefzrsHZmKMbDXxweEH+YlE8JJEuat9FdvW9Qh1cw7W64jELCtWNkPBPX5En45uy28KGvA/AySqUh8CQ==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-transform-async-to-generator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.18.6.tgz", - "integrity": "sha512-ARE5wZLKnTgPW7/1ftQmSi1CmkqqHo2DNmtztFhvgtOWSDfq0Cq9/9L+KnZNYSNrydBekhW3rwShduf59RoXag==", - "requires": { - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/helper-remap-async-to-generator": "^7.18.6" - } - }, - "@babel/plugin-transform-block-scoped-functions": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.18.6.tgz", - "integrity": "sha512-ExUcOqpPWnliRcPqves5HJcJOvHvIIWfuS4sroBUenPuMdmW+SMHDakmtS7qOo13sVppmUijqeTv7qqGsvURpQ==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-transform-block-scoping": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.19.4.tgz", - "integrity": "sha512-934S2VLLlt2hRJwPf4MczaOr4hYF0z+VKPwqTNxyKX7NthTiPfhuKFWQZHXRM0vh/wo/VyXB3s4bZUNA08l+tQ==", - "requires": { - "@babel/helper-plugin-utils": "^7.19.0" - } - }, - "@babel/plugin-transform-classes": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.19.0.tgz", - "integrity": "sha512-YfeEE9kCjqTS9IitkgfJuxjcEtLUHMqa8yUJ6zdz8vR7hKuo6mOy2C05P0F1tdMmDCeuyidKnlrw/iTppHcr2A==", - "requires": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-compilation-targets": "^7.19.0", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.19.0", - "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-replace-supers": "^7.18.9", - "@babel/helper-split-export-declaration": "^7.18.6", - "globals": "^11.1.0" - } - }, - "@babel/plugin-transform-computed-properties": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.18.9.tgz", - "integrity": "sha512-+i0ZU1bCDymKakLxn5srGHrsAPRELC2WIbzwjLhHW9SIE1cPYkLCL0NlnXMZaM1vhfgA2+M7hySk42VBvrkBRw==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.9" - } - }, - "@babel/plugin-transform-destructuring": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.19.4.tgz", - "integrity": "sha512-t0j0Hgidqf0aM86dF8U+vXYReUgJnlv4bZLsyoPnwZNrGY+7/38o8YjaELrvHeVfTZao15kjR0PVv0nju2iduA==", - "requires": { - "@babel/helper-plugin-utils": "^7.19.0" - } - }, - "@babel/plugin-transform-dotall-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.18.6.tgz", - "integrity": "sha512-6S3jpun1eEbAxq7TdjLotAsl4WpQI9DxfkycRcKrjhQYzU87qpXdknpBg/e+TdcMehqGnLFi7tnFUBR02Vq6wg==", - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-transform-duplicate-keys": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.18.9.tgz", - "integrity": "sha512-d2bmXCtZXYc59/0SanQKbiWINadaJXqtvIQIzd4+hNwkWBgyCd5F/2t1kXoUdvPMrxzPvhK6EMQRROxsue+mfw==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.9" - } - }, - "@babel/plugin-transform-exponentiation-operator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.18.6.tgz", - "integrity": "sha512-wzEtc0+2c88FVR34aQmiz56dxEkxr2g8DQb/KfaFa1JYXOFVsbhvAonFN6PwVWj++fKmku8NP80plJ5Et4wqHw==", - "requires": { - "@babel/helper-builder-binary-assignment-operator-visitor": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-transform-for-of": { - "version": "7.18.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.18.8.tgz", - "integrity": "sha512-yEfTRnjuskWYo0k1mHUqrVWaZwrdq8AYbfrpqULOJOaucGSp4mNMVps+YtA8byoevxS/urwU75vyhQIxcCgiBQ==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-transform-function-name": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.18.9.tgz", - "integrity": "sha512-WvIBoRPaJQ5yVHzcnJFor7oS5Ls0PYixlTYE63lCj2RtdQEl15M68FXQlxnG6wdraJIXRdR7KI+hQ7q/9QjrCQ==", - "requires": { - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-function-name": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9" - } - }, - "@babel/plugin-transform-literals": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.18.9.tgz", - "integrity": "sha512-IFQDSRoTPnrAIrI5zoZv73IFeZu2dhu6irxQjY9rNjTT53VmKg9fenjvoiOWOkJ6mm4jKVPtdMzBY98Fp4Z4cg==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.9" - } - }, - "@babel/plugin-transform-member-expression-literals": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.18.6.tgz", - "integrity": "sha512-qSF1ihLGO3q+/g48k85tUjD033C29TNTVB2paCwZPVmOsjn9pClvYYrM2VeJpBY2bcNkuny0YUyTNRyRxJ54KA==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-transform-modules-amd": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.18.6.tgz", - "integrity": "sha512-Pra5aXsmTsOnjM3IajS8rTaLCy++nGM4v3YR4esk5PCsyg9z8NA5oQLwxzMUtDBd8F+UmVza3VxoAaWCbzH1rg==", - "requires": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" - } - }, - "@babel/plugin-transform-modules-commonjs": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.18.6.tgz", - "integrity": "sha512-Qfv2ZOWikpvmedXQJDSbxNqy7Xr/j2Y8/KfijM0iJyKkBTmWuvCA1yeH1yDM7NJhBW/2aXxeucLj6i80/LAJ/Q==", - "requires": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/helper-simple-access": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" - } - }, - "@babel/plugin-transform-modules-systemjs": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.19.0.tgz", - "integrity": "sha512-x9aiR0WXAWmOWsqcsnrzGR+ieaTMVyGyffPVA7F8cXAGt/UxefYv6uSHZLkAFChN5M5Iy1+wjE+xJuPt22H39A==", - "requires": { - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-module-transforms": "^7.19.0", - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-validator-identifier": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" - } - }, - "@babel/plugin-transform-modules-umd": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.18.6.tgz", - "integrity": "sha512-dcegErExVeXcRqNtkRU/z8WlBLnvD4MRnHgNs3MytRO1Mn1sHRyhbcpYbVMGclAqOjdW+9cfkdZno9dFdfKLfQ==", - "requires": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-transform-named-capturing-groups-regex": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.19.1.tgz", - "integrity": "sha512-oWk9l9WItWBQYS4FgXD4Uyy5kq898lvkXpXQxoJEY1RnvPk4R/Dvu2ebXU9q8lP+rlMwUQTFf2Ok6d78ODa0kw==", - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.19.0", - "@babel/helper-plugin-utils": "^7.19.0" - } - }, - "@babel/plugin-transform-new-target": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.18.6.tgz", - "integrity": "sha512-DjwFA/9Iu3Z+vrAn+8pBUGcjhxKguSMlsFqeCKbhb9BAV756v0krzVK04CRDi/4aqmk8BsHb4a/gFcaA5joXRw==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-transform-object-super": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.18.6.tgz", - "integrity": "sha512-uvGz6zk+pZoS1aTZrOvrbj6Pp/kK2mp45t2B+bTDre2UgsZZ8EZLSJtUg7m/no0zOJUWgFONpB7Zv9W2tSaFlA==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/helper-replace-supers": "^7.18.6" - } - }, - "@babel/plugin-transform-parameters": { - "version": "7.18.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.18.8.tgz", - "integrity": "sha512-ivfbE3X2Ss+Fj8nnXvKJS6sjRG4gzwPMsP+taZC+ZzEGjAYlvENixmt1sZ5Ca6tWls+BlKSGKPJ6OOXvXCbkFg==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-transform-property-literals": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.18.6.tgz", - "integrity": "sha512-cYcs6qlgafTud3PAzrrRNbQtfpQ8+y/+M5tKmksS9+M1ckbH6kzY8MrexEM9mcA6JDsukE19iIRvAyYl463sMg==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-transform-regenerator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.18.6.tgz", - "integrity": "sha512-poqRI2+qiSdeldcz4wTSTXBRryoq3Gc70ye7m7UD5Ww0nE29IXqMl6r7Nd15WBgRd74vloEMlShtH6CKxVzfmQ==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "regenerator-transform": "^0.15.0" - } - }, - "@babel/plugin-transform-reserved-words": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.18.6.tgz", - "integrity": "sha512-oX/4MyMoypzHjFrT1CdivfKZ+XvIPMFXwwxHp/r0Ddy2Vuomt4HDFGmft1TAY2yiTKiNSsh3kjBAzcM8kSdsjA==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-transform-runtime": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.19.1.tgz", - "integrity": "sha512-2nJjTUFIzBMP/f/miLxEK9vxwW/KUXsdvN4sR//TmuDhe6yU2h57WmIOE12Gng3MDP/xpjUV/ToZRdcf8Yj4fA==", - "requires": { - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-plugin-utils": "^7.19.0", - "babel-plugin-polyfill-corejs2": "^0.3.3", - "babel-plugin-polyfill-corejs3": "^0.6.0", - "babel-plugin-polyfill-regenerator": "^0.4.1", - "semver": "^6.3.0" - } - }, - "@babel/plugin-transform-shorthand-properties": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.18.6.tgz", - "integrity": "sha512-eCLXXJqv8okzg86ywZJbRn19YJHU4XUa55oz2wbHhaQVn/MM+XhukiT7SYqp/7o00dg52Rj51Ny+Ecw4oyoygw==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-transform-spread": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.19.0.tgz", - "integrity": "sha512-RsuMk7j6n+r752EtzyScnWkQyuJdli6LdO5Klv8Yx0OfPVTcQkIUfS8clx5e9yHXzlnhOZF3CbQ8C2uP5j074w==", - "requires": { - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-skip-transparent-expression-wrappers": "^7.18.9" - } - }, - "@babel/plugin-transform-sticky-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.18.6.tgz", - "integrity": "sha512-kfiDrDQ+PBsQDO85yj1icueWMfGfJFKN1KCkndygtu/C9+XUfydLC8Iv5UYJqRwy4zk8EcplRxEOeLyjq1gm6Q==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-transform-template-literals": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.18.9.tgz", - "integrity": "sha512-S8cOWfT82gTezpYOiVaGHrCbhlHgKhQt8XH5ES46P2XWmX92yisoZywf5km75wv5sYcXDUCLMmMxOLCtthDgMA==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.9" - } - }, - "@babel/plugin-transform-typeof-symbol": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.18.9.tgz", - "integrity": "sha512-SRfwTtF11G2aemAZWivL7PD+C9z52v9EvMqH9BuYbabyPuKUvSWks3oCg6041pT925L4zVFqaVBeECwsmlguEw==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.9" - } - }, - "@babel/plugin-transform-unicode-escapes": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.18.10.tgz", - "integrity": "sha512-kKAdAI+YzPgGY/ftStBFXTI1LZFju38rYThnfMykS+IXy8BVx+res7s2fxf1l8I35DV2T97ezo6+SGrXz6B3iQ==", - "requires": { - "@babel/helper-plugin-utils": "^7.18.9" - } - }, - "@babel/plugin-transform-unicode-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.18.6.tgz", - "integrity": "sha512-gE7A6Lt7YLnNOL3Pb9BNeZvi+d8l7tcRrG4+pwJjK9hD2xX4mEvjlQW60G9EEmfXVYRPv9VRQcyegIVHCql/AA==", - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/preset-env": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.19.4.tgz", - "integrity": "sha512-5QVOTXUdqTCjQuh2GGtdd7YEhoRXBMVGROAtsBeLGIbIz3obCBIfRMT1I3ZKkMgNzwkyCkftDXSSkHxnfVf4qg==", - "requires": { - "@babel/compat-data": "^7.19.4", - "@babel/helper-compilation-targets": "^7.19.3", - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-validator-option": "^7.18.6", - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.18.6", - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.18.9", - "@babel/plugin-proposal-async-generator-functions": "^7.19.1", - "@babel/plugin-proposal-class-properties": "^7.18.6", - "@babel/plugin-proposal-class-static-block": "^7.18.6", - "@babel/plugin-proposal-dynamic-import": "^7.18.6", - "@babel/plugin-proposal-export-namespace-from": "^7.18.9", - "@babel/plugin-proposal-json-strings": "^7.18.6", - "@babel/plugin-proposal-logical-assignment-operators": "^7.18.9", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", - "@babel/plugin-proposal-numeric-separator": "^7.18.6", - "@babel/plugin-proposal-object-rest-spread": "^7.19.4", - "@babel/plugin-proposal-optional-catch-binding": "^7.18.6", - "@babel/plugin-proposal-optional-chaining": "^7.18.9", - "@babel/plugin-proposal-private-methods": "^7.18.6", - "@babel/plugin-proposal-private-property-in-object": "^7.18.6", - "@babel/plugin-proposal-unicode-property-regex": "^7.18.6", - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-class-properties": "^7.12.13", - "@babel/plugin-syntax-class-static-block": "^7.14.5", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-import-assertions": "^7.18.6", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5", - "@babel/plugin-syntax-top-level-await": "^7.14.5", - "@babel/plugin-transform-arrow-functions": "^7.18.6", - "@babel/plugin-transform-async-to-generator": "^7.18.6", - "@babel/plugin-transform-block-scoped-functions": "^7.18.6", - "@babel/plugin-transform-block-scoping": "^7.19.4", - "@babel/plugin-transform-classes": "^7.19.0", - "@babel/plugin-transform-computed-properties": "^7.18.9", - "@babel/plugin-transform-destructuring": "^7.19.4", - "@babel/plugin-transform-dotall-regex": "^7.18.6", - "@babel/plugin-transform-duplicate-keys": "^7.18.9", - "@babel/plugin-transform-exponentiation-operator": "^7.18.6", - "@babel/plugin-transform-for-of": "^7.18.8", - "@babel/plugin-transform-function-name": "^7.18.9", - "@babel/plugin-transform-literals": "^7.18.9", - "@babel/plugin-transform-member-expression-literals": "^7.18.6", - "@babel/plugin-transform-modules-amd": "^7.18.6", - "@babel/plugin-transform-modules-commonjs": "^7.18.6", - "@babel/plugin-transform-modules-systemjs": "^7.19.0", - "@babel/plugin-transform-modules-umd": "^7.18.6", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.19.1", - "@babel/plugin-transform-new-target": "^7.18.6", - "@babel/plugin-transform-object-super": "^7.18.6", - "@babel/plugin-transform-parameters": "^7.18.8", - "@babel/plugin-transform-property-literals": "^7.18.6", - "@babel/plugin-transform-regenerator": "^7.18.6", - "@babel/plugin-transform-reserved-words": "^7.18.6", - "@babel/plugin-transform-shorthand-properties": "^7.18.6", - "@babel/plugin-transform-spread": "^7.19.0", - "@babel/plugin-transform-sticky-regex": "^7.18.6", - "@babel/plugin-transform-template-literals": "^7.18.9", - "@babel/plugin-transform-typeof-symbol": "^7.18.9", - "@babel/plugin-transform-unicode-escapes": "^7.18.10", - "@babel/plugin-transform-unicode-regex": "^7.18.6", - "@babel/preset-modules": "^0.1.5", - "@babel/types": "^7.19.4", - "babel-plugin-polyfill-corejs2": "^0.3.3", - "babel-plugin-polyfill-corejs3": "^0.6.0", - "babel-plugin-polyfill-regenerator": "^0.4.1", - "core-js-compat": "^3.25.1", - "semver": "^6.3.0" - } - }, - "@babel/preset-modules": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.5.tgz", - "integrity": "sha512-A57th6YRG7oR3cq/yt/Y84MvGgE0eJG2F1JLhKuyG+jFxEgrd/HAMJatiFtmOiZurz+0DkrvbheCLaV5f2JfjA==", - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", - "@babel/plugin-transform-dotall-regex": "^7.4.4", - "@babel/types": "^7.4.4", - "esutils": "^2.0.2" - } - }, - "@babel/runtime": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.19.4.tgz", - "integrity": "sha512-EXpLCrk55f+cYqmHsSR+yD/0gAIMxxA9QK9lnQWzhMCvt+YmoBN7Zx94s++Kv0+unHk39vxNO8t+CMA2WSS3wA==", - "requires": { - "regenerator-runtime": "^0.13.4" - } - }, - "@babel/template": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.10.tgz", - "integrity": "sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA==", - "requires": { - "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.18.10", - "@babel/types": "^7.18.10" - } - }, - "@babel/traverse": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.19.4.tgz", - "integrity": "sha512-w3K1i+V5u2aJUOXBFFC5pveFLmtq1s3qcdDNC2qRI6WPBQIDaKFqXxDEqDO/h1dQ3HjsZoZMyIy6jGLq0xtw+g==", - "requires": { - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.19.4", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.19.0", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.19.4", - "@babel/types": "^7.19.4", - "debug": "^4.1.0", - "globals": "^11.1.0" - } - }, - "@babel/types": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.19.4.tgz", - "integrity": "sha512-M5LK7nAeS6+9j7hAq+b3fQs+pNfUtTGq+yFFfHnauFA8zQtLRfmuipmsKDKKLuyG+wC8ABW43A153YNawNTEtw==", - "requires": { - "@babel/helper-string-parser": "^7.19.4", - "@babel/helper-validator-identifier": "^7.19.1", - "to-fast-properties": "^2.0.0" - } - }, - "@bcoe/v8-coverage": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", - "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", - "dev": true - }, - "@eslint/eslintrc": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz", - "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==", - "dev": true, - "requires": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.4.0", - "globals": "^13.15.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "dependencies": { - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "globals": { - "version": "13.17.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", - "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", - "dev": true, - "requires": { - "type-fest": "^0.20.2" - } - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - }, - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true - } - } - }, - "@humanwhocodes/config-array": { - "version": "0.10.7", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.7.tgz", - "integrity": "sha512-MDl6D6sBsaV452/QSdX+4CXIjZhIcI0PELsxUjk4U828yd58vk3bTIvk/6w5FY+4hIy9sLW0sfrV7K7Kc++j/w==", - "dev": true, - "requires": { - "@humanwhocodes/object-schema": "^1.2.1", - "debug": "^4.1.1", - "minimatch": "^3.0.4" - } - }, - "@humanwhocodes/module-importer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", - "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", - "dev": true - }, - "@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", - "dev": true - }, - "@istanbuljs/load-nyc-config": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", - "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", - "dev": true, - "requires": { - "camelcase": "^5.3.1", - "find-up": "^4.1.0", - "get-package-type": "^0.1.0", - "js-yaml": "^3.13.1", - "resolve-from": "^5.0.0" - } - }, - "@istanbuljs/schema": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", - "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", - "dev": true - }, - "@jest/console": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.2.0.tgz", - "integrity": "sha512-Xz1Wu+ZZxcB3RS8U3HdkFxlRJ7kLXI/by9X7d2/gvseIWPwYu/c1EsYy77cB5iyyHGOy3whS2HycjcuzIF4Jow==", - "dev": true, - "requires": { - "@jest/types": "^29.2.0", - "@types/node": "*", - "chalk": "^4.0.0", - "jest-message-util": "^29.2.0", - "jest-util": "^29.2.0", - "slash": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@jest/core": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.2.0.tgz", - "integrity": "sha512-+gyJ3bX+kGEW/eqt/0kI7fLjqiFr3AN8O+rlEl1fYRf7D8h4Sj4tBGo9YOSirvWgvemoH2EPRya35bgvcPFzHQ==", - "dev": true, - "requires": { - "@jest/console": "^29.2.0", - "@jest/reporters": "^29.2.0", - "@jest/test-result": "^29.2.0", - "@jest/transform": "^29.2.0", - "@jest/types": "^29.2.0", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.9", - "jest-changed-files": "^29.2.0", - "jest-config": "^29.2.0", - "jest-haste-map": "^29.2.0", - "jest-message-util": "^29.2.0", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.2.0", - "jest-resolve-dependencies": "^29.2.0", - "jest-runner": "^29.2.0", - "jest-runtime": "^29.2.0", - "jest-snapshot": "^29.2.0", - "jest-util": "^29.2.0", - "jest-validate": "^29.2.0", - "jest-watcher": "^29.2.0", - "micromatch": "^4.0.4", - "pretty-format": "^29.2.0", - "slash": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@jest/environment": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.2.0.tgz", - "integrity": "sha512-foaVv1QVPB31Mno3LlL58PxEQQOLZd9zQfCpyQQCQIpUAtdFP1INBjkphxrCfKT13VxpA0z5jFGIkmZk0DAg2Q==", - "dev": true, - "requires": { - "@jest/fake-timers": "^29.2.0", - "@jest/types": "^29.2.0", - "@types/node": "*", - "jest-mock": "^29.2.0" - } - }, - "@jest/expect": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.2.0.tgz", - "integrity": "sha512-+3lxcYL9e0xPJGOR33utxxejn+Mulz40kY0oy0FVsmIESW87NZDJ7B1ovaIqeX0xIgPX4laS5SGlqD2uSoBMcw==", - "dev": true, - "requires": { - "expect": "^29.2.0", - "jest-snapshot": "^29.2.0" - } - }, - "@jest/expect-utils": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.2.0.tgz", - "integrity": "sha512-nz2IDF7nb1qmj9hx8Ja3MFab2q9Ml8QbOaaeJNyX5JQJHU8QUvEDiMctmhGEkk3Kzr8w8vAqz4hPk/ogJSrUhg==", - "dev": true, - "requires": { - "jest-get-type": "^29.2.0" - } - }, - "@jest/fake-timers": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.2.0.tgz", - "integrity": "sha512-mX0V0uQsgeSLTt0yTqanAhhpeUKMGd2uq+PSLAfO40h72bvfNNQ7pIEl9vIwNMFxRih1ENveEjSBsLjxGGDPSw==", - "dev": true, - "requires": { - "@jest/types": "^29.2.0", - "@sinonjs/fake-timers": "^9.1.2", - "@types/node": "*", - "jest-message-util": "^29.2.0", - "jest-mock": "^29.2.0", - "jest-util": "^29.2.0" - } - }, - "@jest/globals": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.2.0.tgz", - "integrity": "sha512-JQxtEVNWiai1p3PIzAJZSyEqQdAJGvNKvinZDPfu0mhiYEVx6E+PiBuDWj1sVUW8hzu+R3DVqaWC9K2xcLRIAA==", - "dev": true, - "requires": { - "@jest/environment": "^29.2.0", - "@jest/expect": "^29.2.0", - "@jest/types": "^29.2.0", - "jest-mock": "^29.2.0" - } - }, - "@jest/reporters": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.2.0.tgz", - "integrity": "sha512-BXoAJatxTZ18U0cwD7C8qBo8V6vef8AXYRBZdhqE5DF9CmpqmhMfw9c7OUvYqMTnBBK9A0NgXGO4Lc9EJzdHvw==", - "dev": true, - "requires": { - "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^29.2.0", - "@jest/test-result": "^29.2.0", - "@jest/transform": "^29.2.0", - "@jest/types": "^29.2.0", - "@jridgewell/trace-mapping": "^0.3.15", - "@types/node": "*", - "chalk": "^4.0.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^5.1.0", - "istanbul-lib-report": "^3.0.0", - "istanbul-lib-source-maps": "^4.0.0", - "istanbul-reports": "^3.1.3", - "jest-message-util": "^29.2.0", - "jest-util": "^29.2.0", - "jest-worker": "^29.2.0", - "slash": "^3.0.0", - "string-length": "^4.0.1", - "strip-ansi": "^6.0.0", - "v8-to-istanbul": "^9.0.1" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@jest/schemas": { - "version": "29.0.0", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.0.0.tgz", - "integrity": "sha512-3Ab5HgYIIAnS0HjqJHQYZS+zXc4tUmTmBH3z83ajI6afXp8X3ZtdLX+nXx+I7LNkJD7uN9LAVhgnjDgZa2z0kA==", - "dev": true, - "requires": { - "@sinclair/typebox": "^0.24.1" - } - }, - "@jest/source-map": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.2.0.tgz", - "integrity": "sha512-1NX9/7zzI0nqa6+kgpSdKPK+WU1p+SJk3TloWZf5MzPbxri9UEeXX5bWZAPCzbQcyuAzubcdUHA7hcNznmRqWQ==", - "dev": true, - "requires": { - "@jridgewell/trace-mapping": "^0.3.15", - "callsites": "^3.0.0", - "graceful-fs": "^4.2.9" - } - }, - "@jest/test-result": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.2.0.tgz", - "integrity": "sha512-l76EPJ6QqtzsCLS4aimJqWO53pxZ82o3aE+Brcmo1HJ/phb9+MR7gPhyDdN6VSGaLJCRVJBZgWEhAEz+qON0Fw==", - "dev": true, - "requires": { - "@jest/console": "^29.2.0", - "@jest/types": "^29.2.0", - "@types/istanbul-lib-coverage": "^2.0.0", - "collect-v8-coverage": "^1.0.0" - } - }, - "@jest/test-sequencer": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.2.0.tgz", - "integrity": "sha512-NCnjZcGnVdva6IDqF7TCuFsXs2F1tohiNF9sasSJNzD7VfN5ic9XgcS/oPDalGiPLxCmGKj4kewqqrKAqBACcQ==", - "dev": true, - "requires": { - "@jest/test-result": "^29.2.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.2.0", - "slash": "^3.0.0" - } - }, - "@jest/transform": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.2.0.tgz", - "integrity": "sha512-NXMujGHy+B4DAj4dGnVPD0SIXlR2Z/N8Gp9h3mF66kcIRult1WWqY3/CEIrJcKviNWaFPYhZjCG2L3fteWzcUw==", - "dev": true, - "requires": { - "@babel/core": "^7.11.6", - "@jest/types": "^29.2.0", - "@jridgewell/trace-mapping": "^0.3.15", - "babel-plugin-istanbul": "^6.1.1", - "chalk": "^4.0.0", - "convert-source-map": "^1.4.0", - "fast-json-stable-stringify": "^2.1.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.2.0", - "jest-regex-util": "^29.2.0", - "jest-util": "^29.2.0", - "micromatch": "^4.0.4", - "pirates": "^4.0.4", - "slash": "^3.0.0", - "write-file-atomic": "^4.0.1" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@jest/types": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.2.0.tgz", - "integrity": "sha512-mfgpQz4Z2xGo37m6KD8xEpKelaVzvYVRijmLPePn9pxgaPEtX+SqIyPNzzoeCPXKYbB4L/wYSgXDL8o3Gop78Q==", - "dev": true, - "requires": { - "@jest/schemas": "^29.0.0", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@jridgewell/gen-mapping": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", - "integrity": "sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==", - "requires": { - "@jridgewell/set-array": "^1.0.0", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, - "@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==" - }, - "@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==" - }, - "@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" - }, - "@jridgewell/trace-mapping": { - "version": "0.3.17", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", - "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", - "requires": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" - } - }, - "@nicolo-ribaudo/eslint-scope-5-internals": { - "version": "5.1.1-v1", - "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz", - "integrity": "sha512-54/JRvkLIzzDWshCWfuhadfrfZVPiElY8Fcgmg1HroEly/EDSszzhBAsarCux+D/kOslTRquNzuyGSmUSTTHGg==", - "dev": true, - "requires": { - "eslint-scope": "5.1.1" - } - }, - "@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - } - }, - "@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true - }, - "@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "requires": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - } - }, - "@sinclair/typebox": { - "version": "0.24.46", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.24.46.tgz", - "integrity": "sha512-ng4ut1z2MCBhK/NwDVwIQp3pAUOCs/KNaW3cBxdFB2xTDrOuo1xuNmpr/9HHFhxqIvHrs1NTH3KJg6q+JSy1Kw==", - "dev": true - }, - "@sinonjs/commons": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz", - "integrity": "sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ==", - "dev": true, - "requires": { - "type-detect": "4.0.8" - } - }, - "@sinonjs/fake-timers": { - "version": "9.1.2", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-9.1.2.tgz", - "integrity": "sha512-BPS4ynJW/o92PUR4wgriz2Ud5gpST5vz6GQfMixEDK0Z8ZCUv2M7SkBLykH56T++Xs+8ln9zTGbOvNGIe02/jw==", - "dev": true, - "requires": { - "@sinonjs/commons": "^1.7.0" - } - }, - "@types/babel__core": { - "version": "7.1.19", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.19.tgz", - "integrity": "sha512-WEOTgRsbYkvA/KCsDwVEGkd7WAr1e3g31VHQ8zy5gul/V1qKullU/BU5I68X5v7V3GnB9eotmom4v5a5gjxorw==", - "dev": true, - "requires": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "@types/babel__generator": { - "version": "7.6.4", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.4.tgz", - "integrity": "sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==", - "dev": true, - "requires": { - "@babel/types": "^7.0.0" - } - }, - "@types/babel__template": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.1.tgz", - "integrity": "sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==", - "dev": true, - "requires": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "@types/babel__traverse": { - "version": "7.18.2", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.18.2.tgz", - "integrity": "sha512-FcFaxOr2V5KZCviw1TnutEMVUVsGt4D2hP1TAfXZAMKuHYW3xQhe3jTxNPWutgCJ3/X1c5yX8ZoGVEItxKbwBg==", - "dev": true, - "requires": { - "@babel/types": "^7.3.0" - } - }, - "@types/graceful-fs": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz", - "integrity": "sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/istanbul-lib-coverage": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", - "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", - "dev": true - }, - "@types/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "*" - } - }, - "@types/istanbul-reports": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", - "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", - "dev": true, - "requires": { - "@types/istanbul-lib-report": "*" - } - }, - "@types/jest": { - "version": "29.1.2", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.1.2.tgz", - "integrity": "sha512-y+nlX0h87U0R+wsGn6EBuoRWYyv3KFtwRNP3QWp9+k2tJ2/bqcGS3UxD7jgT+tiwJWWq3UsyV4Y+T6rsMT4XMg==", - "dev": true, - "requires": { - "expect": "^29.0.0", - "pretty-format": "^29.0.0" - } - }, - "@types/json5": { - "version": "0.0.29", - "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", - "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", - "dev": true - }, - "@types/node": { - "version": "18.11.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.0.tgz", - "integrity": "sha512-IOXCvVRToe7e0ny7HpT/X9Rb2RYtElG1a+VshjwT00HxrM2dWBApHQoqsI6WiY7Q03vdf2bCrIGzVrkF/5t10w==", - "dev": true - }, - "@types/prettier": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.1.tgz", - "integrity": "sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow==", - "dev": true - }, - "@types/stack-utils": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", - "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", - "dev": true - }, - "@types/yargs": { - "version": "17.0.13", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.13.tgz", - "integrity": "sha512-9sWaruZk2JGxIQU+IhI1fhPYRcQ0UuTNuKuCW9bR5fp7qi2Llf7WDzNa17Cy7TKnh3cdxDOiyTu6gaLS0eDatg==", - "dev": true, - "requires": { - "@types/yargs-parser": "*" - } - }, - "@types/yargs-parser": { - "version": "21.0.0", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", - "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", - "dev": true - }, - "acorn": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", - "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", - "dev": true - }, - "acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "requires": {} - }, - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, - "requires": { - "type-fest": "^0.21.3" - } - }, - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, - "anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "array-includes": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.5.tgz", - "integrity": "sha512-iSDYZMMyTPkiFasVqfuAQnWAYcvO/SeBSCGKePoEthjp4LEMTe4uLc7b025o4jAZpHhihh8xPo99TNWUWWkGDQ==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.19.5", - "get-intrinsic": "^1.1.1", - "is-string": "^1.0.7" - } - }, - "array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true - }, - "array.prototype.flat": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.0.tgz", - "integrity": "sha512-12IUEkHsAhA4DY5s0FPgNXIdc8VRSqD9Zp78a5au9abH/SOBrsp082JOWFNTjkMozh8mqcdiKuaLGhPeYztxSw==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.2", - "es-shim-unscopables": "^1.0.0" - } - }, - "array.prototype.flatmap": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.0.tgz", - "integrity": "sha512-PZC9/8TKAIxcWKdyeb77EzULHPrIX/tIZebLJUQOMR1OwYosT8yggdfWScfTBCDj5utONvOuPQQumYsU2ULbkg==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.2", - "es-shim-unscopables": "^1.0.0" - } - }, - "babel-jest": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.2.0.tgz", - "integrity": "sha512-c8FkrW1chgcbyBqOo7jFGpQYfVnb43JqjQGV+C2r94k2rZJOukYOZ6+csAqKE4ms+PHc+yevnONxs27jQIxylw==", - "dev": true, - "requires": { - "@jest/transform": "^29.2.0", - "@types/babel__core": "^7.1.14", - "babel-plugin-istanbul": "^6.1.1", - "babel-preset-jest": "^29.2.0", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "slash": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "babel-plugin-dynamic-import-node": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", - "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==", - "requires": { - "object.assign": "^4.1.0" - } - }, - "babel-plugin-istanbul": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", - "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@istanbuljs/load-nyc-config": "^1.0.0", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-instrument": "^5.0.4", - "test-exclude": "^6.0.0" - } - }, - "babel-plugin-jest-hoist": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.2.0.tgz", - "integrity": "sha512-TnspP2WNiR3GLfCsUNHqeXw0RoQ2f9U5hQ5L3XFpwuO8htQmSrhh8qsB6vi5Yi8+kuynN1yjDjQsPfkebmB6ZA==", - "dev": true, - "requires": { - "@babel/template": "^7.3.3", - "@babel/types": "^7.3.3", - "@types/babel__core": "^7.1.14", - "@types/babel__traverse": "^7.0.6" - } - }, - "babel-plugin-polyfill-corejs2": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.3.tgz", - "integrity": "sha512-8hOdmFYFSZhqg2C/JgLUQ+t52o5nirNwaWM2B9LWteozwIvM14VSwdsCAUET10qT+kmySAlseadmfeeSWFCy+Q==", - "requires": { - "@babel/compat-data": "^7.17.7", - "@babel/helper-define-polyfill-provider": "^0.3.3", - "semver": "^6.1.1" - } - }, - "babel-plugin-polyfill-corejs3": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.6.0.tgz", - "integrity": "sha512-+eHqR6OPcBhJOGgsIar7xoAB1GcSwVUA3XjAd7HJNzOXT4wv6/H7KIdA/Nc60cvUlDbKApmqNvD1B1bzOt4nyA==", - "requires": { - "@babel/helper-define-polyfill-provider": "^0.3.3", - "core-js-compat": "^3.25.1" - } - }, - "babel-plugin-polyfill-regenerator": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.4.1.tgz", - "integrity": "sha512-NtQGmyQDXjQqQ+IzRkBVwEOz9lQ4zxAQZgoAYEtU9dJjnl1Oc98qnN7jcp+bE7O7aYzVpavXE3/VKXNzUbh7aw==", - "requires": { - "@babel/helper-define-polyfill-provider": "^0.3.3" - } - }, - "babel-preset-current-node-syntax": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", - "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", - "dev": true, - "requires": { - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-bigint": "^7.8.3", - "@babel/plugin-syntax-class-properties": "^7.8.3", - "@babel/plugin-syntax-import-meta": "^7.8.3", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.8.3", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-top-level-await": "^7.8.3" - } - }, - "babel-preset-jest": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.2.0.tgz", - "integrity": "sha512-z9JmMJppMxNv8N7fNRHvhMg9cvIkMxQBXgFkane3yKVEvEOP+kB50lk8DFRvF9PGqbyXxlmebKWhuDORO8RgdA==", - "dev": true, - "requires": { - "babel-plugin-jest-hoist": "^29.2.0", - "babel-preset-current-node-syntax": "^1.0.0" - } - }, - "balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "browserslist": { - "version": "4.21.4", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.4.tgz", - "integrity": "sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw==", - "requires": { - "caniuse-lite": "^1.0.30001400", - "electron-to-chromium": "^1.4.251", - "node-releases": "^2.0.6", - "update-browserslist-db": "^1.0.9" - } - }, - "bser": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", - "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", - "dev": true, - "requires": { - "node-int64": "^0.4.0" - } - }, - "buffer-from": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true - }, - "builtins": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", - "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", - "dev": true, - "requires": { - "semver": "^7.0.0" - }, - "dependencies": { - "semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - } - } - }, - "call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - } - }, - "callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - }, - "caniuse-lite": { - "version": "1.0.30001419", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001419.tgz", - "integrity": "sha512-aFO1r+g6R7TW+PNQxKzjITwLOyDhVRLjW0LcwS/HCZGUUKTGNp9+IwLC4xyDSZBygVL/mxaFR3HIV6wEKQuSzw==" - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "char-regex": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", - "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", - "dev": true - }, - "ci-info": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.5.0.tgz", - "integrity": "sha512-yH4RezKOGlOhxkmhbeNuC4eYZKAUsEaGtBuBzDDP1eFUKiccDWzBABxBfOx31IDwDIXMTxWuwAxUGModvkbuVw==", - "dev": true - }, - "cjs-module-lexer": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz", - "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", - "dev": true - }, - "cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" - } - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", - "dev": true - }, - "collect-v8-coverage": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz", - "integrity": "sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==", - "dev": true - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "convert-source-map": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", - "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", - "requires": { - "safe-buffer": "~5.1.1" - } - }, - "core-js-compat": { - "version": "3.25.5", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.25.5.tgz", - "integrity": "sha512-ovcyhs2DEBUIE0MGEKHP4olCUW/XYte3Vroyxuh38rD1wAO4dHohsovUC4eAOuzFxE6b+RXvBU3UZ9o0YhUTkA==", - "requires": { - "browserslist": "^4.21.4" - } - }, - "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", - "requires": { - "ms": "2.1.2" - } - }, - "dedent": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", - "integrity": "sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==", - "dev": true - }, - "deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true - }, - "deepmerge": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", - "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", - "dev": true - }, - "define-properties": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", - "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", - "requires": { - "has-property-descriptors": "^1.0.0", - "object-keys": "^1.1.1" - } - }, - "detect-newline": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", - "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", - "dev": true - }, - "diff-sequences": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.2.0.tgz", - "integrity": "sha512-413SY5JpYeSBZxmenGEmCVQ8mCgtFJF0w9PROdaS6z987XC2Pd2GOKqOITLtMftmyFZqgtCOb/QA7/Z3ZXfzIw==", - "dev": true - }, - "dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "requires": { - "path-type": "^4.0.0" - } - }, - "doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, - "electron-to-chromium": { - "version": "1.4.283", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.283.tgz", - "integrity": "sha512-g6RQ9zCOV+U5QVHW9OpFR7rdk/V7xfopNXnyAamdpFgCHgZ1sjI8VuR1+zG2YG/TZk+tQ8mpNkug4P8FU0fuOA==" - }, - "emittery": { - "version": "0.10.2", - "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.10.2.tgz", - "integrity": "sha512-aITqOwnLanpHLNXZJENbOgjUBeHocD+xsSJmNrjovKBW5HbSpW3d1pEls7GFQPUWXiwG9+0P4GtHfEqC/4M0Iw==", - "dev": true - }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, - "requires": { - "is-arrayish": "^0.2.1" - } - }, - "es-abstract": { - "version": "1.20.4", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.4.tgz", - "integrity": "sha512-0UtvRN79eMe2L+UNEF1BwRe364sj/DXhQ/k5FmivgoSdpM90b8Jc0mDzKMGo7QS0BVbOP/bTwBKNnDc9rNzaPA==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "function.prototype.name": "^1.1.5", - "get-intrinsic": "^1.1.3", - "get-symbol-description": "^1.0.0", - "has": "^1.0.3", - "has-property-descriptors": "^1.0.0", - "has-symbols": "^1.0.3", - "internal-slot": "^1.0.3", - "is-callable": "^1.2.7", - "is-negative-zero": "^2.0.2", - "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.2", - "is-string": "^1.0.7", - "is-weakref": "^1.0.2", - "object-inspect": "^1.12.2", - "object-keys": "^1.1.1", - "object.assign": "^4.1.4", - "regexp.prototype.flags": "^1.4.3", - "safe-regex-test": "^1.0.0", - "string.prototype.trimend": "^1.0.5", - "string.prototype.trimstart": "^1.0.5", - "unbox-primitive": "^1.0.2" - } - }, - "es-shim-unscopables": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", - "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==", - "dev": true, - "requires": { - "has": "^1.0.3" - } - }, - "es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" - }, - "eslint": { - "version": "8.25.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.25.0.tgz", - "integrity": "sha512-DVlJOZ4Pn50zcKW5bYH7GQK/9MsoQG2d5eDH0ebEkE8PbgzTTmtt/VTH9GGJ4BfeZCpBLqFfvsjX35UacUL83A==", - "dev": true, - "requires": { - "@eslint/eslintrc": "^1.3.3", - "@humanwhocodes/config-array": "^0.10.5", - "@humanwhocodes/module-importer": "^1.0.1", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "doctrine": "^3.0.0", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.3.0", - "espree": "^9.4.0", - "esquery": "^1.4.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "find-up": "^5.0.0", - "glob-parent": "^6.0.1", - "globals": "^13.15.0", - "globby": "^11.1.0", - "grapheme-splitter": "^1.0.4", - "ignore": "^5.2.0", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "js-sdsl": "^4.1.4", - "js-yaml": "^4.1.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "regexpp": "^3.2.0", - "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", - "text-table": "^0.2.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true - }, - "eslint-scope": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", - "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", - "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - } - }, - "eslint-visitor-keys": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", - "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", - "dev": true - }, - "find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "requires": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - } - }, - "glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dev": true, - "requires": { - "is-glob": "^4.0.3" - } - }, - "globals": { - "version": "13.17.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", - "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", - "dev": true, - "requires": { - "type-fest": "^0.20.2" - } - }, - "globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "requires": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - }, - "levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - } - }, - "locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "requires": { - "p-locate": "^5.0.0" - } - }, - "optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", - "dev": true, - "requires": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" - } - }, - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "requires": { - "p-limit": "^3.0.2" - } - }, - "prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1" - } - }, - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true - } - } - }, - "eslint-config-standard": { - "version": "17.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-17.0.0.tgz", - "integrity": "sha512-/2ks1GKyqSOkH7JFvXJicu0iMpoojkwB+f5Du/1SC0PtBL+s8v30k9njRZ21pm2drKYm2342jFnGWzttxPmZVg==", - "dev": true, - "requires": {} - }, - "eslint-config-standard-jsx": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-standard-jsx/-/eslint-config-standard-jsx-11.0.0.tgz", - "integrity": "sha512-+1EV/R0JxEK1L0NGolAr8Iktm3Rgotx3BKwgaX+eAuSX8D952LULKtjgZD3F+e6SvibONnhLwoTi9DPxN5LvvQ==", - "dev": true, - "requires": {} - }, - "eslint-import-resolver-node": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", - "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==", - "dev": true, - "requires": { - "debug": "^3.2.7", - "resolve": "^1.20.0" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - } - } - }, - "eslint-module-utils": { - "version": "2.7.4", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.4.tgz", - "integrity": "sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA==", - "dev": true, - "requires": { - "debug": "^3.2.7" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - } - } - }, - "eslint-plugin-es": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz", - "integrity": "sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==", - "dev": true, - "requires": { - "eslint-utils": "^2.0.0", - "regexpp": "^3.0.0" - }, - "dependencies": { - "eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^1.1.0" - } - }, - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true - } - } - }, - "eslint-plugin-import": { - "version": "2.26.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", - "integrity": "sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==", - "dev": true, - "requires": { - "array-includes": "^3.1.4", - "array.prototype.flat": "^1.2.5", - "debug": "^2.6.9", - "doctrine": "^2.1.0", - "eslint-import-resolver-node": "^0.3.6", - "eslint-module-utils": "^2.7.3", - "has": "^1.0.3", - "is-core-module": "^2.8.1", - "is-glob": "^4.0.3", - "minimatch": "^3.1.2", - "object.values": "^1.1.5", - "resolve": "^1.22.0", - "tsconfig-paths": "^3.14.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true - }, - "resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", - "dev": true, - "requires": { - "is-core-module": "^2.9.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - } - } - } - }, - "eslint-plugin-n": { - "version": "15.3.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.3.0.tgz", - "integrity": "sha512-IyzPnEWHypCWasDpxeJnim60jhlumbmq0pubL6IOcnk8u2y53s5QfT8JnXy7skjHJ44yWHRb11PLtDHuu1kg/Q==", - "dev": true, - "requires": { - "builtins": "^5.0.1", - "eslint-plugin-es": "^4.1.0", - "eslint-utils": "^3.0.0", - "ignore": "^5.1.1", - "is-core-module": "^2.10.0", - "minimatch": "^3.1.2", - "resolve": "^1.22.1", - "semver": "^7.3.7" - }, - "dependencies": { - "resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", - "dev": true, - "requires": { - "is-core-module": "^2.9.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - } - }, - "semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - } - } - }, - "eslint-plugin-promise": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.1.0.tgz", - "integrity": "sha512-NYCfDZF/KHt27p06nFAttgWuFyIDSUMnNaJBIY1FY9GpBFhdT2vMG64HlFguSgcJeyM5by6Yr5csSOuJm60eXQ==", - "dev": true, - "requires": {} - }, - "eslint-plugin-react": { - "version": "7.31.10", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.31.10.tgz", - "integrity": "sha512-e4N/nc6AAlg4UKW/mXeYWd3R++qUano5/o+t+wnWxIf+bLsOaH3a4q74kX3nDjYym3VBN4HyO9nEn1GcAqgQOA==", - "dev": true, - "requires": { - "array-includes": "^3.1.5", - "array.prototype.flatmap": "^1.3.0", - "doctrine": "^2.1.0", - "estraverse": "^5.3.0", - "jsx-ast-utils": "^2.4.1 || ^3.0.0", - "minimatch": "^3.1.2", - "object.entries": "^1.1.5", - "object.fromentries": "^2.0.5", - "object.hasown": "^1.1.1", - "object.values": "^1.1.5", - "prop-types": "^15.8.1", - "resolve": "^2.0.0-next.3", - "semver": "^6.3.0", - "string.prototype.matchall": "^4.0.7" - }, - "dependencies": { - "doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, - "resolve": { - "version": "2.0.0-next.4", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.4.tgz", - "integrity": "sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ==", - "dev": true, - "requires": { - "is-core-module": "^2.9.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - } - } - } - }, - "eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - }, - "dependencies": { - "estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true - } - } - }, - "eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^2.0.0" - } - }, - "eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true - }, - "espree": { - "version": "9.4.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.0.tgz", - "integrity": "sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw==", - "dev": true, - "requires": { - "acorn": "^8.8.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.3.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", - "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", - "dev": true - } - } - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, - "esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", - "dev": true, - "requires": { - "estraverse": "^5.1.0" - } - }, - "esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "requires": { - "estraverse": "^5.2.0" - } - }, - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true - }, - "esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" - }, - "execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - } - }, - "exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", - "dev": true - }, - "expect": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/expect/-/expect-29.2.0.tgz", - "integrity": "sha512-03ClF3GWwUqd9Grgkr9ZSdaCJGMRA69PQ8jT7o+Bx100VlGiAFf9/8oIm9Qve7ZVJhuJxFftqFhviZJRxxNfvg==", - "dev": true, - "requires": { - "@jest/expect-utils": "^29.2.0", - "jest-get-type": "^29.2.0", - "jest-matcher-utils": "^29.2.0", - "jest-message-util": "^29.2.0", - "jest-util": "^29.2.0" - } - }, - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, - "fast-glob": { - "version": "3.2.12", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", - "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - } - }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, - "fastq": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", - "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", - "dev": true, - "requires": { - "reusify": "^1.0.4" - } - }, - "fb-watchman": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", - "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", - "dev": true, - "requires": { - "bser": "2.1.1" - } - }, - "file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", - "dev": true, - "requires": { - "flat-cache": "^3.0.4" - } - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", - "dev": true, - "requires": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" - } - }, - "flatted": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.4.tgz", - "integrity": "sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw==", - "dev": true - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "optional": true - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "function.prototype.name": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", - "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.0", - "functions-have-names": "^1.2.2" - } - }, - "functions-have-names": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", - "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", - "dev": true - }, - "gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==" - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", - "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" - } - }, - "get-package-type": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", - "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", - "dev": true - }, - "get-stdin": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-8.0.0.tgz", - "integrity": "sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==", - "dev": true - }, - "get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true - }, - "get-symbol-description": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", - "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.1" - } - }, - "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" - }, - "globby": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-13.1.2.tgz", - "integrity": "sha512-LKSDZXToac40u8Q1PQtZihbNdTYSNMuWe+K5l+oa6KgDzSvVrHXlJy40hUP522RjAIoNLJYBJi7ow+rbFpIhHQ==", - "dev": true, - "requires": { - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.11", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^4.0.0" - }, - "dependencies": { - "slash": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", - "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", - "dev": true - } - } - }, - "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, - "grapheme-splitter": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", - "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", - "dev": true - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-bigints": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", - "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==" - }, - "has-property-descriptors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", - "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", - "requires": { - "get-intrinsic": "^1.1.1" - } - }, - "has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" - }, - "has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", - "dev": true, - "requires": { - "has-symbols": "^1.0.2" - } - }, - "html-escaper": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", - "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", - "dev": true - }, - "human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "dev": true - }, - "husky": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.1.tgz", - "integrity": "sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==", - "dev": true - }, - "ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", - "dev": true - }, - "import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, - "requires": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "dependencies": { - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true - } - } - }, - "import-local": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", - "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", - "dev": true, - "requires": { - "pkg-dir": "^4.2.0", - "resolve-cwd": "^3.0.0" - } - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "internal-slot": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", - "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", - "dev": true, - "requires": { - "get-intrinsic": "^1.1.0", - "has": "^1.0.3", - "side-channel": "^1.0.4" - } - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "dev": true - }, - "is-bigint": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", - "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", - "dev": true, - "requires": { - "has-bigints": "^1.0.1" - } - }, - "is-boolean-object": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", - "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, - "is-callable": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", - "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", - "dev": true - }, - "is-core-module": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz", - "integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==", - "requires": { - "has": "^1.0.3" - } - }, - "is-date-object": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", - "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", - "dev": true, - "requires": { - "has-tostringtag": "^1.0.0" - } - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "is-generator-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", - "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", - "dev": true - }, - "is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-negative-zero": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", - "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", - "dev": true - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "is-number-object": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", - "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", - "dev": true, - "requires": { - "has-tostringtag": "^1.0.0" - } - }, - "is-regex": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", - "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, - "is-shared-array-buffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", - "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", - "dev": true, - "requires": { - "call-bind": "^1.0.2" - } - }, - "is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true - }, - "is-string": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", - "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", - "dev": true, - "requires": { - "has-tostringtag": "^1.0.0" - } - }, - "is-symbol": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", - "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", - "dev": true, - "requires": { - "has-symbols": "^1.0.2" - } - }, - "is-weakref": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", - "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", - "dev": true, - "requires": { - "call-bind": "^1.0.2" - } - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "istanbul-lib-coverage": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", - "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", - "dev": true - }, - "istanbul-lib-instrument": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.1.0.tgz", - "integrity": "sha512-czwUz525rkOFDJxfKK6mYfIs9zBKILyrZQxjz3ABhjQXhbhFsSbo1HW/BFcsDnfJYJWA6thRR5/TUY2qs5W99Q==", - "dev": true, - "requires": { - "@babel/core": "^7.12.3", - "@babel/parser": "^7.14.7", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.2.0", - "semver": "^6.3.0" - } - }, - "istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", - "dev": true, - "requires": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", - "supports-color": "^7.1.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "istanbul-lib-source-maps": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", - "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", - "dev": true, - "requires": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" - } - }, - "istanbul-reports": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", - "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", - "dev": true, - "requires": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" - } - }, - "jest": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest/-/jest-29.2.0.tgz", - "integrity": "sha512-6krPemKUXCEu5Fh3j6ZVoLMjpTQVm0OCU+7f3K/9gllX8wNIE6NSCQ6s0q2RDoiKLRaQlVRHyscjSPRPqCI0Fg==", - "dev": true, - "requires": { - "@jest/core": "^29.2.0", - "@jest/types": "^29.2.0", - "import-local": "^3.0.2", - "jest-cli": "^29.2.0" - } - }, - "jest-changed-files": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.2.0.tgz", - "integrity": "sha512-qPVmLLyBmvF5HJrY7krDisx6Voi8DmlV3GZYX0aFNbaQsZeoz1hfxcCMbqDGuQCxU1dJy9eYc2xscE8QrCCYaA==", - "dev": true, - "requires": { - "execa": "^5.0.0", - "p-limit": "^3.1.0" - }, - "dependencies": { - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - } - } - }, - "jest-circus": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.2.0.tgz", - "integrity": "sha512-bpJRMe+VtvYlF3q8JNx+/cAo4FYvNCiR5s7Z0Scf8aC+KJ2ineSjZKtw1cIZbythlplkiro0My8nc65pfCqJ3A==", - "dev": true, - "requires": { - "@jest/environment": "^29.2.0", - "@jest/expect": "^29.2.0", - "@jest/test-result": "^29.2.0", - "@jest/types": "^29.2.0", - "@types/node": "*", - "chalk": "^4.0.0", - "co": "^4.6.0", - "dedent": "^0.7.0", - "is-generator-fn": "^2.0.0", - "jest-each": "^29.2.0", - "jest-matcher-utils": "^29.2.0", - "jest-message-util": "^29.2.0", - "jest-runtime": "^29.2.0", - "jest-snapshot": "^29.2.0", - "jest-util": "^29.2.0", - "p-limit": "^3.1.0", - "pretty-format": "^29.2.0", - "slash": "^3.0.0", - "stack-utils": "^2.0.3" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-cli": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.2.0.tgz", - "integrity": "sha512-/581TzbXeO+5kbtSlhXEthGiVJCC8AP0jgT0iZINAAMW+tTFj2uWU7z+HNUH5yIYdHV7AvRr0fWLrmHJGIruHg==", - "dev": true, - "requires": { - "@jest/core": "^29.2.0", - "@jest/test-result": "^29.2.0", - "@jest/types": "^29.2.0", - "chalk": "^4.0.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.9", - "import-local": "^3.0.2", - "jest-config": "^29.2.0", - "jest-util": "^29.2.0", - "jest-validate": "^29.2.0", - "prompts": "^2.0.1", - "yargs": "^17.3.1" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-config": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.2.0.tgz", - "integrity": "sha512-IkdCsrHIoxDPZAyFcdtQrCQ3uftLqns6Joj0tlbxiAQW4k/zTXmIygqWBmPNxO9FbFkDrhtYZiLHXjaJh9rS+Q==", - "dev": true, - "requires": { - "@babel/core": "^7.11.6", - "@jest/test-sequencer": "^29.2.0", - "@jest/types": "^29.2.0", - "babel-jest": "^29.2.0", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "deepmerge": "^4.2.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "jest-circus": "^29.2.0", - "jest-environment-node": "^29.2.0", - "jest-get-type": "^29.2.0", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.2.0", - "jest-runner": "^29.2.0", - "jest-util": "^29.2.0", - "jest-validate": "^29.2.0", - "micromatch": "^4.0.4", - "parse-json": "^5.2.0", - "pretty-format": "^29.2.0", - "slash": "^3.0.0", - "strip-json-comments": "^3.1.1" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-diff": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.2.0.tgz", - "integrity": "sha512-GsH07qQL+/D/GxlnU+sSg9GL3fBOcuTlmtr3qr2pnkiODCwubNN2/7slW4m3CvxDsEus/VEOfQKRFLyXsUlnZw==", - "dev": true, - "requires": { - "chalk": "^4.0.0", - "diff-sequences": "^29.2.0", - "jest-get-type": "^29.2.0", - "pretty-format": "^29.2.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-docblock": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.2.0.tgz", - "integrity": "sha512-bkxUsxTgWQGbXV5IENmfiIuqZhJcyvF7tU4zJ/7ioTutdz4ToB5Yx6JOFBpgI+TphRY4lhOyCWGNH/QFQh5T6A==", - "dev": true, - "requires": { - "detect-newline": "^3.0.0" - } - }, - "jest-each": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.2.0.tgz", - "integrity": "sha512-h4LeC3L/R7jIMfTdYowevPIssvcPYQ7Qzs+pCSYsJgPztIizXwKmnfhZXBA4WVqdmvMcpmseYEXb67JT7IJ2eg==", - "dev": true, - "requires": { - "@jest/types": "^29.2.0", - "chalk": "^4.0.0", - "jest-get-type": "^29.2.0", - "jest-util": "^29.2.0", - "pretty-format": "^29.2.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-environment-node": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.2.0.tgz", - "integrity": "sha512-b4qQGVStPMvtZG97Ac0rvnmSIjCZturFU7MQRMp4JDFl7zoaDLTtXmFjFP1tNmi9te6kR8d+Htbv3nYeoaIz6g==", - "dev": true, - "requires": { - "@jest/environment": "^29.2.0", - "@jest/fake-timers": "^29.2.0", - "@jest/types": "^29.2.0", - "@types/node": "*", - "jest-mock": "^29.2.0", - "jest-util": "^29.2.0" - } - }, - "jest-get-type": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.2.0.tgz", - "integrity": "sha512-uXNJlg8hKFEnDgFsrCjznB+sTxdkuqiCL6zMgA75qEbAJjJYTs9XPrvDctrEig2GDow22T/LvHgO57iJhXB/UA==", - "dev": true - }, - "jest-haste-map": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.2.0.tgz", - "integrity": "sha512-qu9lGFi7qJ8v37egS1phZZUJYiMyWnKwu83NlNT1qs50TbedIX2hFl+9ztsJ7U/ENaHwk1/Bs8fqOIQsScIRwg==", - "dev": true, - "requires": { - "@jest/types": "^29.2.0", - "@types/graceful-fs": "^4.1.3", - "@types/node": "*", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "fsevents": "^2.3.2", - "graceful-fs": "^4.2.9", - "jest-regex-util": "^29.2.0", - "jest-util": "^29.2.0", - "jest-worker": "^29.2.0", - "micromatch": "^4.0.4", - "walker": "^1.0.8" - } - }, - "jest-leak-detector": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.2.0.tgz", - "integrity": "sha512-FXT9sCFdct42+oOqGIr/9kmUw3RbhvpkwidCBT5ySHHoWNGd3c9n7HXpFKjEz9UnUITRCGdn0q2s6Sxrq36kwg==", - "dev": true, - "requires": { - "jest-get-type": "^29.2.0", - "pretty-format": "^29.2.0" - } - }, - "jest-matcher-utils": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.2.0.tgz", - "integrity": "sha512-FcEfKZ4vm28yCdBsvC69EkrEhcfex+IYlRctNJXsRG9+WC3WxgBNORnECIgqUtj7o/h1d8o7xB/dFUiLi4bqtw==", - "dev": true, - "requires": { - "chalk": "^4.0.0", - "jest-diff": "^29.2.0", - "jest-get-type": "^29.2.0", - "pretty-format": "^29.2.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-message-util": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.2.0.tgz", - "integrity": "sha512-arBfk5yMFMTnMB22GyG601xGSGthA02vWSewPaxoFo0F9wBqDOyxccPbCcYu8uibw3kduSHXdCOd1PsLSgdomg==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.12.13", - "@jest/types": "^29.2.0", - "@types/stack-utils": "^2.0.0", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "micromatch": "^4.0.4", - "pretty-format": "^29.2.0", - "slash": "^3.0.0", - "stack-utils": "^2.0.3" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-mock": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.2.0.tgz", - "integrity": "sha512-aiWGR0P8ivssIO17xkehLGFtCcef2ZwQFNPwEer1jQLHxPctDlIg3Hs6QMq1KpPz5dkCcgM7mwGif4a9IPznlg==", - "dev": true, - "requires": { - "@jest/types": "^29.2.0", - "@types/node": "*", - "jest-util": "^29.2.0" - } - }, - "jest-pnp-resolver": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz", - "integrity": "sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w==", - "dev": true, - "requires": {} - }, - "jest-regex-util": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.2.0.tgz", - "integrity": "sha512-6yXn0kg2JXzH30cr2NlThF+70iuO/3irbaB4mh5WyqNIvLLP+B6sFdluO1/1RJmslyh/f9osnefECflHvTbwVA==", - "dev": true - }, - "jest-resolve": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.2.0.tgz", - "integrity": "sha512-f5c0ljNg2guDBCC7wi92vAhNuA0BtAG5vkY7Fob0c7sUMU1g87mTXqRmjrVFe2XvdwP5m5T/e5KJsCKu9hRvBA==", - "dev": true, - "requires": { - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.2.0", - "jest-pnp-resolver": "^1.2.2", - "jest-util": "^29.2.0", - "jest-validate": "^29.2.0", - "resolve": "^1.20.0", - "resolve.exports": "^1.1.0", - "slash": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-resolve-dependencies": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.2.0.tgz", - "integrity": "sha512-Cd0Z39sDntEnfR9PoUdFHUAGDvtKI0/7Wt73l3lt03A3yQ+A6Qi3XmBuqGjdFl2QbXaPa937oLhilG612P8HGQ==", - "dev": true, - "requires": { - "jest-regex-util": "^29.2.0", - "jest-snapshot": "^29.2.0" - } - }, - "jest-runner": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.2.0.tgz", - "integrity": "sha512-VPBrCwl9fM2mc5yk6yZhNrgXzRJMD5jfLmntkMLlrVq4hQPWbRK998iJlR+DOGCO04TC9PPYLntOJ001Vnf28g==", - "dev": true, - "requires": { - "@jest/console": "^29.2.0", - "@jest/environment": "^29.2.0", - "@jest/test-result": "^29.2.0", - "@jest/transform": "^29.2.0", - "@jest/types": "^29.2.0", - "@types/node": "*", - "chalk": "^4.0.0", - "emittery": "^0.10.2", - "graceful-fs": "^4.2.9", - "jest-docblock": "^29.2.0", - "jest-environment-node": "^29.2.0", - "jest-haste-map": "^29.2.0", - "jest-leak-detector": "^29.2.0", - "jest-message-util": "^29.2.0", - "jest-resolve": "^29.2.0", - "jest-runtime": "^29.2.0", - "jest-util": "^29.2.0", - "jest-watcher": "^29.2.0", - "jest-worker": "^29.2.0", - "p-limit": "^3.1.0", - "source-map-support": "0.5.13" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-runtime": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.2.0.tgz", - "integrity": "sha512-+GDmzCrswQF+mvI0upTYMe/OPYnlRRNLLDHM9AFLp2y7zxWoDoYgb8DL3WwJ8d9m743AzrnvBV9JQHi/0ed7dg==", - "dev": true, - "requires": { - "@jest/environment": "^29.2.0", - "@jest/fake-timers": "^29.2.0", - "@jest/globals": "^29.2.0", - "@jest/source-map": "^29.2.0", - "@jest/test-result": "^29.2.0", - "@jest/transform": "^29.2.0", - "@jest/types": "^29.2.0", - "@types/node": "*", - "chalk": "^4.0.0", - "cjs-module-lexer": "^1.0.0", - "collect-v8-coverage": "^1.0.0", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.2.0", - "jest-message-util": "^29.2.0", - "jest-mock": "^29.2.0", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.2.0", - "jest-snapshot": "^29.2.0", - "jest-util": "^29.2.0", - "slash": "^3.0.0", - "strip-bom": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-snapshot": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.2.0.tgz", - "integrity": "sha512-YCKrOR0PLRXROmww73fHO9oeY4tL+LPQXWR3yml1+hKbQDR8j1VUrVzB65hKSJJgxBOr1vWx+hmz2by8JjAU5w==", - "dev": true, - "requires": { - "@babel/core": "^7.11.6", - "@babel/generator": "^7.7.2", - "@babel/plugin-syntax-jsx": "^7.7.2", - "@babel/plugin-syntax-typescript": "^7.7.2", - "@babel/traverse": "^7.7.2", - "@babel/types": "^7.3.3", - "@jest/expect-utils": "^29.2.0", - "@jest/transform": "^29.2.0", - "@jest/types": "^29.2.0", - "@types/babel__traverse": "^7.0.6", - "@types/prettier": "^2.1.5", - "babel-preset-current-node-syntax": "^1.0.0", - "chalk": "^4.0.0", - "expect": "^29.2.0", - "graceful-fs": "^4.2.9", - "jest-diff": "^29.2.0", - "jest-get-type": "^29.2.0", - "jest-haste-map": "^29.2.0", - "jest-matcher-utils": "^29.2.0", - "jest-message-util": "^29.2.0", - "jest-util": "^29.2.0", - "natural-compare": "^1.4.0", - "pretty-format": "^29.2.0", - "semver": "^7.3.5" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-util": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.2.0.tgz", - "integrity": "sha512-8M1dx12ujkBbnhwytrezWY0Ut79hbflwodE+qZKjxSRz5qt4xDp6dQQJaOCFvCmE0QJqp9KyEK33lpPNjnhevw==", - "dev": true, - "requires": { - "@jest/types": "^29.2.0", - "@types/node": "*", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", - "picomatch": "^2.2.3" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-validate": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.2.0.tgz", - "integrity": "sha512-4Vl51bPNeFeDok9aJiOnrC6tqJbOp4iMCYlewoC2ZzYJZ5+6pfr3KObAdx5wP8auHcg2MRaguiqj5OdScZa72g==", - "dev": true, - "requires": { - "@jest/types": "^29.2.0", - "camelcase": "^6.2.0", - "chalk": "^4.0.0", - "jest-get-type": "^29.2.0", - "leven": "^3.1.0", - "pretty-format": "^29.2.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-watcher": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.2.0.tgz", - "integrity": "sha512-bRh0JdUeN+cl9XfK7tMnXLm4Mv70hG2SZlqbkFe5CTs7oeCkbwlGBk/mEfEJ63mrxZ8LPbnfaMpfSmkhEQBEGA==", - "dev": true, - "requires": { - "@jest/test-result": "^29.2.0", - "@jest/types": "^29.2.0", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "emittery": "^0.10.2", - "jest-util": "^29.2.0", - "string-length": "^4.0.1" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-worker": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.2.0.tgz", - "integrity": "sha512-mluOlMbRX1H59vGVzPcVg2ALfCausbBpxC8a2KWOzInhYHZibbHH8CB0C1JkmkpfurrkOYgF7FPmypuom1OM9A==", - "dev": true, - "requires": { - "@types/node": "*", - "jest-util": "^29.2.0", - "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "js-sdsl": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.1.5.tgz", - "integrity": "sha512-08bOAKweV2NUC1wqTtf3qZlnpOX/R2DU9ikpjOHs0H+ibQv3zpncVQg6um4uYtRtrwIX8M4Nh3ytK4HGlYAq7Q==", - "dev": true - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" - }, - "js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==" - }, - "json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true - }, - "json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", - "dev": true - }, - "json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==" - }, - "jsx-ast-utils": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.3.tgz", - "integrity": "sha512-fYQHZTZ8jSfmWZ0iyzfwiU4WDX4HpHbMCZ3gPlWYiCl3BoeOTsqKBqnTVfH2rYT7eP5c3sVbeSPHnnJOaTrWiw==", - "dev": true, - "requires": { - "array-includes": "^3.1.5", - "object.assign": "^4.1.3" - } - }, - "kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", - "dev": true - }, - "leven": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", - "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", - "dev": true - }, - "lines-and-columns": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true - }, - "load-json-file": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-5.3.0.tgz", - "integrity": "sha512-cJGP40Jc/VXUsp8/OrnyKyTZ1y6v/dphm3bioS+RrKXjK2BB6wHUd6JptZEFDGgGahMT+InnZO5i1Ei9mpC8Bw==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.15", - "parse-json": "^4.0.0", - "pify": "^4.0.1", - "strip-bom": "^3.0.0", - "type-fest": "^0.3.0" - }, - "dependencies": { - "parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", - "dev": true, - "requires": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - } }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", - "dev": true - }, - "type-fest": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz", - "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==", - "dev": true - } - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "lodash.debounce": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", - "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==" - }, - "lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true - }, - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dev": true, - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, - "makeerror": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", - "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", - "dev": true, - "requires": { - "tmpl": "1.0.5" - } - }, - "merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, - "merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true - }, - "micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dev": true, - "requires": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - } - }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", - "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", - "dev": true - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", - "dev": true - }, - "node-int64": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", - "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", - "dev": true - }, - "node-releases": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.6.tgz", - "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==" - }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true - }, - "npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "requires": { - "path-key": "^3.0.0" - } - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "dev": true - }, - "object-inspect": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", - "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", - "dev": true - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" - }, - "object.assign": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", - "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "has-symbols": "^1.0.3", - "object-keys": "^1.1.1" + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } } }, - "object.entries": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.5.tgz", - "integrity": "sha512-TyxmjUoZggd4OrrU1W66FMDG6CuqJxsFvymeyXI51+vQLN67zYfZseptRge703kKQdo4uccgAKebXFcRCzk4+g==", + "node_modules/vite-node": { + "version": "0.34.6", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-0.34.6.tgz", + "integrity": "sha512-nlBMJ9x6n7/Amaz6F3zJ97EBwR2FkzhBRxF5e+jE6LA3yi6Wtc2lyTij1OnDMIr34v5g/tVQtsVAzhT0jc5ygA==", "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1" + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.3.4", + "mlly": "^1.4.0", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0-0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": ">=v14.18.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" } }, - "object.fromentries": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.5.tgz", - "integrity": "sha512-CAyG5mWQRRiBU57Re4FKoTBjXfDoNwdFVH2Y1tS9PqCsfUTymAohOkEMSG3aRNKmv4lV3O7p1et7c187q6bynw==", + "node_modules/vitest": { + "version": "0.34.6", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.34.6.tgz", + "integrity": "sha512-+5CALsOvbNKnS+ZHMXtuUC7nL8/7F1F2DnHGjSsszX8zCjWSSviphCb/NuS9Nzf4Q03KyyDRBAXhF/8lffME4Q==", "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1" + "dependencies": { + "@types/chai": "^4.3.5", + "@types/chai-subset": "^1.3.3", + "@types/node": "*", + "@vitest/expect": "0.34.6", + "@vitest/runner": "0.34.6", + "@vitest/snapshot": "0.34.6", + "@vitest/spy": "0.34.6", + "@vitest/utils": "0.34.6", + "acorn": "^8.9.0", + "acorn-walk": "^8.2.0", + "cac": "^6.7.14", + "chai": "^4.3.10", + "debug": "^4.3.4", + "local-pkg": "^0.4.3", + "magic-string": "^0.30.1", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "std-env": "^3.3.3", + "strip-literal": "^1.0.1", + "tinybench": "^2.5.0", + "tinypool": "^0.7.0", + "vite": "^3.1.0 || ^4.0.0 || ^5.0.0-0", + "vite-node": "0.34.6", + "why-is-node-running": "^2.2.2" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": ">=v14.18.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@vitest/browser": "*", + "@vitest/ui": "*", + "happy-dom": "*", + "jsdom": "*", + "playwright": "*", + "safaridriver": "*", + "webdriverio": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "playwright": { + "optional": true + }, + "safaridriver": { + "optional": true + }, + "webdriverio": { + "optional": true + } } }, - "object.hasown": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.1.tgz", - "integrity": "sha512-LYLe4tivNQzq4JdaWW6WO3HMZZJWzkkH8fnI6EebWl0VZth2wL2Lovm74ep2/gZzlaTdV62JZHEqHQ2yVn8Q/A==", + "node_modules/why-is-node-running": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", + "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", "dev": true, - "requires": { - "define-properties": "^1.1.4", - "es-abstract": "^1.19.5" + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" } + } + }, + "dependencies": { + "@esbuild/android-arm": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", + "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", + "dev": true, + "optional": true }, - "object.values": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", - "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", + "@esbuild/android-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", + "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1" - } + "optional": true }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "@esbuild/android-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", + "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", "dev": true, - "requires": { - "wrappy": "1" - } + "optional": true }, - "onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "@esbuild/darwin-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", + "integrity": "sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==", "dev": true, - "requires": { - "mimic-fn": "^2.1.0" - } + "optional": true }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "@esbuild/darwin-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", + "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", "dev": true, - "requires": { - "p-try": "^2.0.0" - } + "optional": true }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "@esbuild/freebsd-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", + "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", "dev": true, - "requires": { - "p-limit": "^2.2.0" - } + "optional": true }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true + "@esbuild/freebsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", + "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", + "dev": true, + "optional": true }, - "parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "@esbuild/linux-arm": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", + "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", "dev": true, - "requires": { - "callsites": "^3.0.0" - } + "optional": true }, - "parse-json": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", - "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "@esbuild/linux-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", + "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - } + "optional": true }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true + "@esbuild/linux-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", + "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", + "dev": true, + "optional": true }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true + "@esbuild/linux-loong64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", + "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", + "dev": true, + "optional": true }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true + "@esbuild/linux-mips64el": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", + "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", + "dev": true, + "optional": true }, - "path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + "@esbuild/linux-ppc64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", + "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", + "dev": true, + "optional": true }, - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true + "@esbuild/linux-riscv64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", + "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", + "dev": true, + "optional": true }, - "picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + "@esbuild/linux-s390x": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", + "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", + "dev": true, + "optional": true }, - "picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true + "@esbuild/linux-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", + "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", + "dev": true, + "optional": true }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "dev": true + "@esbuild/netbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", + "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", + "dev": true, + "optional": true }, - "pirates": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz", - "integrity": "sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==", - "dev": true + "@esbuild/openbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", + "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", + "dev": true, + "optional": true }, - "pkg-conf": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-3.1.0.tgz", - "integrity": "sha512-m0OTbR/5VPNPqO1ph6Fqbj7Hv6QU7gR/tQW40ZqrL1rjgCU85W6C1bJn0BItuJqnR98PWzw7Z8hHeChD1WrgdQ==", + "@esbuild/sunos-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", + "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", "dev": true, - "requires": { - "find-up": "^3.0.0", - "load-json-file": "^5.2.0" - }, - "dependencies": { - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", - "dev": true - } - } + "optional": true }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "@esbuild/win32-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", + "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", "dev": true, - "requires": { - "find-up": "^4.0.0" - } + "optional": true }, - "pretty-format": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.2.0.tgz", - "integrity": "sha512-QCSUFdwOi924g24czhOH5eTkXxUCqlLGZBRCySlwDYHIXRJkdGyjJc9nZaqhlFBZws8dq5Dvk0lCilsmlfsPxw==", + "@esbuild/win32-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", + "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", "dev": true, - "requires": { - "@jest/schemas": "^29.0.0", - "ansi-styles": "^5.0.0", - "react-is": "^18.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", - "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", - "dev": true - } - } + "optional": true }, - "prompts": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", - "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "@esbuild/win32-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", + "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", "dev": true, - "requires": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.5" - } + "optional": true }, - "prop-types": { - "version": "15.8.1", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", - "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", "dev": true, "requires": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.13.1" - }, - "dependencies": { - "react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", - "dev": true - } + "@sinclair/typebox": "^0.27.8" } }, - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true - }, - "queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true - }, - "react-is": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", "dev": true }, - "regenerate": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", - "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==" - }, - "regenerate-unicode-properties": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.0.tgz", - "integrity": "sha512-d1VudCLoIGitcU/hEg2QqvyGZQmdC0Lf8BqdOMXGFSvJP4bNV1+XqbPQeHHLD51Jh4QJJ225dlIFvY4Ly6MXmQ==", - "requires": { - "regenerate": "^1.4.2" - } - }, - "regenerator-runtime": { - "version": "0.13.10", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.10.tgz", - "integrity": "sha512-KepLsg4dU12hryUO7bp/axHAKvwGOCV0sGloQtpagJ12ai+ojVDqkeGSiRX1zlq+kjIMZ1t7gpze+26QqtdGqw==" - }, - "regenerator-transform": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.15.0.tgz", - "integrity": "sha512-LsrGtPmbYg19bcPHwdtmXwbW+TqNvtY4riE3P83foeHRroMbH6/2ddFBfab3t7kbzc7v7p4wbkIecHImqt0QNg==", - "requires": { - "@babel/runtime": "^7.8.4" - } - }, - "regexp.prototype.flags": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", - "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", "dev": true, "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "functions-have-names": "^1.2.2" + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" } }, - "regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", "dev": true }, - "regexpu-core": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.2.1.tgz", - "integrity": "sha512-HrnlNtpvqP1Xkb28tMhBUO2EbyUHdQlsnlAhzWcwHy8WJR53UWr7/MAvqrsQKMbV4qdpv03oTMG8iIhfsPFktQ==", - "requires": { - "regenerate": "^1.4.2", - "regenerate-unicode-properties": "^10.1.0", - "regjsgen": "^0.7.1", - "regjsparser": "^0.9.1", - "unicode-match-property-ecmascript": "^2.0.0", - "unicode-match-property-value-ecmascript": "^2.0.0" - } - }, - "regjsgen": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.7.1.tgz", - "integrity": "sha512-RAt+8H2ZEzHeYWxZ3H2z6tF18zyyOnlcdaafLrm21Bguj7uZy6ULibiAFdXEtKQY4Sy7wDTwDiOazasMLc4KPA==" - }, - "regjsparser": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.9.1.tgz", - "integrity": "sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ==", + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, "requires": { - "jsesc": "~0.5.0" - }, - "dependencies": { - "jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==" - } + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" } }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", "dev": true }, - "resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", - "requires": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" - } + "@types/chai": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.6.tgz", + "integrity": "sha512-VOVRLM1mBxIRxydiViqPcKn6MIxZytrbMpd6RJLIWKxUNr3zux8no0Oc7kJx0WAPIitgZ0gkrDS+btlqQpubpw==", + "dev": true }, - "resolve-cwd": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", - "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "@types/chai-subset": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz", + "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==", "dev": true, "requires": { - "resolve-from": "^5.0.0" + "@types/chai": "*" } }, - "resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true - }, - "resolve.exports": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-1.1.0.tgz", - "integrity": "sha512-J1l+Zxxp4XK3LUDZ9m60LRJF/mAe4z6a4xyabPHk7pvK5t35dACV32iIjJDFeWZFfZlO29w6SZ67knR0tHzJtQ==", - "dev": true - }, - "reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "@types/node": { + "version": "18.11.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.0.tgz", + "integrity": "sha512-IOXCvVRToe7e0ny7HpT/X9Rb2RYtElG1a+VshjwT00HxrM2dWBApHQoqsI6WiY7Q03vdf2bCrIGzVrkF/5t10w==", "dev": true }, - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "@vitest/expect": { + "version": "0.34.6", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.34.6.tgz", + "integrity": "sha512-QUzKpUQRc1qC7qdGo7rMK3AkETI7w18gTCUrsNnyjjJKYiuUB9+TQK3QnR1unhCnWRC0AbKv2omLGQDF/mIjOw==", "dev": true, "requires": { - "glob": "^7.1.3" + "@vitest/spy": "0.34.6", + "@vitest/utils": "0.34.6", + "chai": "^4.3.10" } }, - "run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "@vitest/runner": { + "version": "0.34.6", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-0.34.6.tgz", + "integrity": "sha512-1CUQgtJSLF47NnhN+F9X2ycxUP0kLHQ/JWvNHbeBfwW8CzEGgeskzNnHDyv1ieKTltuR6sdIHV+nmR6kPxQqzQ==", "dev": true, "requires": { - "queue-microtask": "^1.2.2" + "@vitest/utils": "0.34.6", + "p-limit": "^4.0.0", + "pathe": "^1.1.1" + }, + "dependencies": { + "p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "dev": true, + "requires": { + "yocto-queue": "^1.0.0" + } + }, + "yocto-queue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", + "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", + "dev": true + } } }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "safe-regex-test": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", - "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "@vitest/snapshot": { + "version": "0.34.6", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-0.34.6.tgz", + "integrity": "sha512-B3OZqYn6k4VaN011D+ve+AA4whM4QkcwcrwaKwAbyyvS/NB1hCWjFIBQxAQQSQir9/RtyAAGuq+4RJmbn2dH4w==", "dev": true, "requires": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.3", - "is-regex": "^1.1.4" + "magic-string": "^0.30.1", + "pathe": "^1.1.1", + "pretty-format": "^29.5.0" } }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "@vitest/spy": { + "version": "0.34.6", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-0.34.6.tgz", + "integrity": "sha512-xaCvneSaeBw/cz8ySmF7ZwGvL0lBjfvqc1LpQ/vcdHEvpLn3Ff1vAvjw+CoGn0802l++5L/pxb7whwcWAw+DUQ==", "dev": true, "requires": { - "shebang-regex": "^3.0.0" + "tinyspy": "^2.1.1" } }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true - }, - "side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "@vitest/utils": { + "version": "0.34.6", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-0.34.6.tgz", + "integrity": "sha512-IG5aDD8S6zlvloDsnzHw0Ut5xczlF+kv2BOTo+iXfPr54Yhi5qbVOgGB1hZaVq4iJ4C/MZ2J0y15IlsV/ZcI0A==", "dev": true, "requires": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "diff-sequences": "^29.4.3", + "loupe": "^2.3.6", + "pretty-format": "^29.5.0" } }, - "signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true - }, - "sisteransi": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", - "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "acorn": { + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", "dev": true }, - "slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", "dev": true }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true }, - "source-map-support": { - "version": "0.5.13", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", - "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "dev": true, "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" + "fill-range": "^7.0.1" } }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", "dev": true }, - "stack-utils": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.5.tgz", - "integrity": "sha512-xrQcmYhOsn/1kX+Vraq+7j4oE2j/6BFscZ0etmYg81xuM8Gq0022Pxb8+IqgOFUIaxHs0KaSb7T1+OegiNrNFA==", + "chai": { + "version": "4.3.10", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.10.tgz", + "integrity": "sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==", "dev": true, "requires": { - "escape-string-regexp": "^2.0.0" - }, - "dependencies": { - "escape-string-regexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", - "dev": true - } + "assertion-error": "^1.1.0", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", + "pathval": "^1.1.1", + "type-detect": "^4.0.8" } }, - "standard": { - "version": "17.0.0", - "resolved": "https://registry.npmjs.org/standard/-/standard-17.0.0.tgz", - "integrity": "sha512-GlCM9nzbLUkr+TYR5I2WQoIah4wHA2lMauqbyPLV/oI5gJxqhHzhjl9EG2N0lr/nRqI3KCbCvm/W3smxvLaChA==", + "check-error": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", + "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", "dev": true, "requires": { - "eslint": "^8.13.0", - "eslint-config-standard": "17.0.0", - "eslint-config-standard-jsx": "^11.0.0", - "eslint-plugin-import": "^2.26.0", - "eslint-plugin-n": "^15.1.0", - "eslint-plugin-promise": "^6.0.0", - "eslint-plugin-react": "^7.28.0", - "standard-engine": "^15.0.0" + "get-func-name": "^2.0.2" } }, - "standard-engine": { - "version": "15.0.0", - "resolved": "https://registry.npmjs.org/standard-engine/-/standard-engine-15.0.0.tgz", - "integrity": "sha512-4xwUhJNo1g/L2cleysUqUv7/btn7GEbYJvmgKrQ2vd/8pkTmN8cpqAZg+BT8Z1hNeEH787iWUdOpL8fmApLtxA==", + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "requires": { - "get-stdin": "^8.0.0", - "minimist": "^1.2.6", - "pkg-conf": "^3.1.0", - "xdg-basedir": "^4.0.0" + "ms": "2.1.2" } }, - "string-length": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", - "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "deep-eql": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", "dev": true, "requires": { - "char-regex": "^1.0.2", - "strip-ansi": "^6.0.0" + "type-detect": "^4.0.0" } }, - "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } + "diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "dev": true }, - "string.prototype.matchall": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.7.tgz", - "integrity": "sha512-f48okCX7JiwVi1NXCVWcFnZgADDC/n2vePlQ/KUCNqCikLLilQvwjMO8+BHVKvgzH0JB0J9LEPgxOGT02RoETg==", + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", "dev": true, "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1", - "get-intrinsic": "^1.1.1", - "has-symbols": "^1.0.3", - "internal-slot": "^1.0.3", - "regexp.prototype.flags": "^1.4.1", - "side-channel": "^1.0.4" + "path-type": "^4.0.0" } }, - "string.prototype.trimend": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", - "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.19.5" + "esbuild": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", + "integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==", + "dev": true, + "requires": { + "@esbuild/android-arm": "0.18.20", + "@esbuild/android-arm64": "0.18.20", + "@esbuild/android-x64": "0.18.20", + "@esbuild/darwin-arm64": "0.18.20", + "@esbuild/darwin-x64": "0.18.20", + "@esbuild/freebsd-arm64": "0.18.20", + "@esbuild/freebsd-x64": "0.18.20", + "@esbuild/linux-arm": "0.18.20", + "@esbuild/linux-arm64": "0.18.20", + "@esbuild/linux-ia32": "0.18.20", + "@esbuild/linux-loong64": "0.18.20", + "@esbuild/linux-mips64el": "0.18.20", + "@esbuild/linux-ppc64": "0.18.20", + "@esbuild/linux-riscv64": "0.18.20", + "@esbuild/linux-s390x": "0.18.20", + "@esbuild/linux-x64": "0.18.20", + "@esbuild/netbsd-x64": "0.18.20", + "@esbuild/openbsd-x64": "0.18.20", + "@esbuild/sunos-x64": "0.18.20", + "@esbuild/win32-arm64": "0.18.20", + "@esbuild/win32-ia32": "0.18.20", + "@esbuild/win32-x64": "0.18.20" } }, - "string.prototype.trimstart": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", - "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", + "fast-glob": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", + "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", "dev": true, "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.19.5" + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" } }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", "dev": true, "requires": { - "ansi-regex": "^5.0.1" - } - }, - "strip-bom": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", - "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", - "dev": true - }, - "strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true - }, - "strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "requires": { - "has-flag": "^3.0.0" + "reusify": "^1.0.4" } }, - "supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true - }, - "test-exclude": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", - "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "dev": true, "requires": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" + "to-regex-range": "^5.0.1" } }, - "text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", - "dev": true + "fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "optional": true }, - "tmpl": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", - "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "get-func-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", "dev": true }, - "to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=" - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, "requires": { - "is-number": "^7.0.0" + "is-glob": "^4.0.1" } }, - "tsconfig-paths": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", - "integrity": "sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==", + "globby": { + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", + "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", "dev": true, "requires": { - "@types/json5": "^0.0.29", - "json5": "^1.0.1", - "minimist": "^1.2.6", - "strip-bom": "^3.0.0" + "dir-glob": "^3.0.1", + "fast-glob": "^3.3.0", + "ignore": "^5.2.4", + "merge2": "^1.4.1", + "slash": "^4.0.0" }, "dependencies": { - "json5": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", - "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", - "dev": true, - "requires": { - "minimist": "^1.2.0" - } - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", "dev": true } } }, - "type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "husky": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", "dev": true }, - "type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", "dev": true }, - "unbox-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", - "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "requires": { - "call-bind": "^1.0.2", - "has-bigints": "^1.0.2", - "has-symbols": "^1.0.3", - "which-boxed-primitive": "^1.0.2" + "is-extglob": "^2.1.1" } }, - "unicode-canonical-property-names-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", - "integrity": "sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==" + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true }, - "unicode-match-property-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", - "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", - "requires": { - "unicode-canonical-property-names-ecmascript": "^2.0.0", - "unicode-property-aliases-ecmascript": "^2.0.0" - } + "jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "dev": true }, - "unicode-match-property-value-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.0.0.tgz", - "integrity": "sha512-7Yhkc0Ye+t4PNYzOGKedDhXbYIBe1XEQYQxOPyhcXNMJ0WCABqqj6ckydd6pWRZTHV4GuCPKdBAUiMc60tsKVw==" - }, - "unicode-property-aliases-ecmascript": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz", - "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==" - }, - "update-browserslist-db": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz", - "integrity": "sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==", + "local-pkg": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.3.tgz", + "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==", + "dev": true + }, + "loupe": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", + "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", + "dev": true, "requires": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" + "get-func-name": "^2.0.0" } }, - "uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "magic-string": { + "version": "0.30.4", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.4.tgz", + "integrity": "sha512-Q/TKtsC5BPm0kGqgBIF9oXAs/xEf2vRKiIB4wCRQTJOQIByZ1d+NnUOotvJOvNpi5RNIgVOMC3pOuaP1ZTDlVg==", "dev": true, "requires": { - "punycode": "^2.1.0" + "@jridgewell/sourcemap-codec": "^1.4.15" } }, - "v8-to-istanbul": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz", - "integrity": "sha512-74Y4LqY74kLE6IFyIjPtkSTWzUZmj8tdHT9Ii/26dvQ6K9Dl2NbEfj0XgU2sHCtKgt5VupqhlO/5aWuqS+IY1w==", + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", "dev": true, "requires": { - "@jridgewell/trace-mapping": "^0.3.12", - "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^1.6.0" + "braces": "^3.0.2", + "picomatch": "^2.3.1" } }, - "walker": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", - "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "mlly": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.4.2.tgz", + "integrity": "sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==", "dev": true, "requires": { - "makeerror": "1.0.12" + "acorn": "^8.10.0", + "pathe": "^1.1.1", + "pkg-types": "^1.0.3", + "ufo": "^1.3.0" } }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "nanoid": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "dev": true + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, + "pathe": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.1.tgz", + "integrity": "sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==", + "dev": true + }, + "pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true + }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, + "pkg-types": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.3.tgz", + "integrity": "sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==", "dev": true, "requires": { - "isexe": "^2.0.0" + "jsonc-parser": "^3.2.0", + "mlly": "^1.2.0", + "pathe": "^1.1.0" } }, - "which-boxed-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", - "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "postcss": { + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", "dev": true, "requires": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" } }, - "word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "prettier": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", + "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", "dev": true }, - "wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", "dev": true, "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" }, "dependencies": { "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", "dev": true } } }, - "wrappy": { + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, + "react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "dev": true + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, + "rollup": { + "version": "3.29.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", + "integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==", + "dev": true, + "requires": { + "fsevents": "~2.3.2" + } + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true + }, + "source-map-js": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true + }, + "stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true + }, + "std-env": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.4.3.tgz", + "integrity": "sha512-f9aPhy8fYBuMN+sNfakZV18U39PbalgjXG3lLB9WkaYTxijru61wb57V9wxxNthXM5Sd88ETBWi29qLAsHO52Q==", "dev": true }, - "write-file-atomic": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", - "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "strip-literal": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.3.0.tgz", + "integrity": "sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==", "dev": true, "requires": { - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.7" + "acorn": "^8.10.0" } }, - "xdg-basedir": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", - "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", + "tinybench": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.5.1.tgz", + "integrity": "sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg==", "dev": true }, - "y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "tinypool": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.7.0.tgz", + "integrity": "sha512-zSYNUlYSMhJ6Zdou4cJwo/p7w5nmAH17GRfU/ui3ctvjXFErXXkruT4MWW6poDeXgCaIBlGLrfU6TbTXxyGMww==", "dev": true }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "tinyspy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.1.1.tgz", + "integrity": "sha512-XPJL2uSzcOyBMky6OFrusqWlzfFrXtE0hPuMgW8A2HmaqrPo4ZQHRN/V0QXN3FSjKxpsbRrFc5LI7KOwBsT1/w==", "dev": true }, - "yargs": { - "version": "17.6.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.0.tgz", - "integrity": "sha512-8H/wTDqlSwoSnScvV2N/JHfLWOKuh5MVla9hqLjK3nsfyy6Y4kDSYSvkU5YCUEPOSnRXfIyx3Sq+B/IWudTo4g==", + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, "requires": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.0.0" + "is-number": "^7.0.0" } }, - "yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true }, - "yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "ufo": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.3.1.tgz", + "integrity": "sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==", "dev": true + }, + "vite": { + "version": "4.4.9", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", + "integrity": "sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==", + "dev": true, + "requires": { + "esbuild": "^0.18.10", + "fsevents": "~2.3.2", + "postcss": "^8.4.27", + "rollup": "^3.27.1" + } + }, + "vite-node": { + "version": "0.34.6", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-0.34.6.tgz", + "integrity": "sha512-nlBMJ9x6n7/Amaz6F3zJ97EBwR2FkzhBRxF5e+jE6LA3yi6Wtc2lyTij1OnDMIr34v5g/tVQtsVAzhT0jc5ygA==", + "dev": true, + "requires": { + "cac": "^6.7.14", + "debug": "^4.3.4", + "mlly": "^1.4.0", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0-0" + } + }, + "vitest": { + "version": "0.34.6", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.34.6.tgz", + "integrity": "sha512-+5CALsOvbNKnS+ZHMXtuUC7nL8/7F1F2DnHGjSsszX8zCjWSSviphCb/NuS9Nzf4Q03KyyDRBAXhF/8lffME4Q==", + "dev": true, + "requires": { + "@types/chai": "^4.3.5", + "@types/chai-subset": "^1.3.3", + "@types/node": "*", + "@vitest/expect": "0.34.6", + "@vitest/runner": "0.34.6", + "@vitest/snapshot": "0.34.6", + "@vitest/spy": "0.34.6", + "@vitest/utils": "0.34.6", + "acorn": "^8.9.0", + "acorn-walk": "^8.2.0", + "cac": "^6.7.14", + "chai": "^4.3.10", + "debug": "^4.3.4", + "local-pkg": "^0.4.3", + "magic-string": "^0.30.1", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "std-env": "^3.3.3", + "strip-literal": "^1.0.1", + "tinybench": "^2.5.0", + "tinypool": "^0.7.0", + "vite": "^3.1.0 || ^4.0.0 || ^5.0.0-0", + "vite-node": "0.34.6", + "why-is-node-running": "^2.2.2" + } + }, + "why-is-node-running": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", + "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", + "dev": true, + "requires": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + } } } } diff --git a/package.json b/package.json index 6ab94ac09e..2dd45beac9 100644 --- a/package.json +++ b/package.json @@ -4,34 +4,20 @@ "type": "module", "description": "A repository for All algorithms implemented in Javascript (for educational purposes only)", "scripts": { - "test": "jest", - "test-changed": "jest --onlyChanged", - "style": "standard", + "test": "vitest run", + "test-watch": "vitest", + "style": "npx prettier . --write", "prepare": "husky install" }, "author": "TheAlgorithms", "license": "GPL-3.0", - "dependencies": { - "@babel/core": "^7.19.3", - "@babel/plugin-transform-runtime": "^7.19.1", - "@babel/preset-env": "^7.19.4" - }, "devDependencies": { - "@babel/eslint-parser": "^7.19.1", - "@types/jest": "^29.1.2", - "babel-jest": "^29.2.0", - "globby": "^13.1.2", - "husky": "^8.0.1", - "jest": "^29.2.0", - "standard": "^17.0.0" + "globby": "^13.2.2", + "husky": "^8.0.3", + "prettier": "^3.0.3", + "vitest": "^0.34.6" }, "engines": { - "node": ">=16.6.0" - }, - "standard": { - "env": [ - "jest" - ], - "parser": "@babel/eslint-parser" + "node": ">=20.6.0" } } diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000000..5709b1addc --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,8 @@ +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + globals: true, + restoreMocks: true + } +}) From 1de5ab7d71d0241ec1903f54d96c9924ab912d2b Mon Sep 17 00:00:00 2001 From: Ayush shah Date: Wed, 4 Oct 2023 09:59:01 +0530 Subject: [PATCH 031/122] Feat: TwoSum function created with test cases (#1399) * fix: #758 optimised armstrongNumber code * fix:#758 Average Median code optimised * feat: TwoSum function added with test cases * revert code * Fix: #758 used ternary operator to make code more optimised * Feat: TwoSum function created with test cases * Feat: TwoSum function created with test cases * Resolved comments and changes requests --- Maths/TwoSum.js | 24 ++++++++++++++++++++++++ Maths/test/TwoSum.test.js | 28 ++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 Maths/TwoSum.js create mode 100644 Maths/test/TwoSum.test.js diff --git a/Maths/TwoSum.js b/Maths/TwoSum.js new file mode 100644 index 0000000000..8aaaea9d14 --- /dev/null +++ b/Maths/TwoSum.js @@ -0,0 +1,24 @@ +/** + * Given an array of integers, find two numbers that add up to a specific target. + * + * @param {number[]} nums - The array of integers. + * @param {number} target - The target sum. + * @returns {number[]} - An array containing the indices of the two numbers. + * + * @example + * const nums = [2, 7, 11, 15]; + * const target = 9; + * const result = twoSum(nums, target); + * // The function should return [0, 1] because nums[0] + nums[1] = 2 + 7 = 9. + */ + +const TwoSum = (nums, target) => { + const numIndicesMap = new Map() + for (let i = 0; i < nums.length; i++) { + const complement = target - nums[i] + if (numIndicesMap.has(complement)) return [numIndicesMap.get(complement), i] + numIndicesMap.set(nums[i], i) + } + return [] +} +export { TwoSum } diff --git a/Maths/test/TwoSum.test.js b/Maths/test/TwoSum.test.js new file mode 100644 index 0000000000..851f180a98 --- /dev/null +++ b/Maths/test/TwoSum.test.js @@ -0,0 +1,28 @@ +import { TwoSum } from '../TwoSum.js' +describe('Two Sum', () => { + const testCasesWithoutSolution = [ + [[8], 8], + [[3, 3, 3, 3], 19] + ] + const testCasesWithSolution = [ + [[2, 7, 11, 15], 9, [0, 1]], + [[15, 2, 11, 7], 13, [1, 2]], + [[2, 7, 11, 15], 17, [0, 3]], + [[7, 15, 11, 2], 18, [0, 2]], + [[2, 7, 11, 15], 26, [2, 3]] + ] + + test.each(testCasesWithoutSolution)( + 'Should return an empty array if there is no solution', + (nums, target) => { + expect(TwoSum(nums, target)).toEqual([]) + } + ) + + test.each(testCasesWithSolution)( + 'Should return the indices of two numbers that add up to the target', + (nums, target, expected) => { + expect(TwoSum(nums, target)).toEqual(expected) + } + ) +}) From 96d122f29e3e175af4ef2ab093393a77cbc2b48c Mon Sep 17 00:00:00 2001 From: YongEaziDev <52831161+yongeazi143@users.noreply.github.com> Date: Thu, 5 Oct 2023 11:00:28 +0100 Subject: [PATCH 032/122] fix: Enhance error handling in factorial function (#1430) --- Recursive/Factorial.js | 9 +++------ Recursive/test/Factorial.test.js | 20 +++++++++++++++----- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Recursive/Factorial.js b/Recursive/Factorial.js index 5a0d560514..4e2b3c1bff 100644 --- a/Recursive/Factorial.js +++ b/Recursive/Factorial.js @@ -9,17 +9,14 @@ */ const factorial = (n) => { - if (!Number.isInteger(n)) { - throw new RangeError('Not a Whole Number') - } - - if (n < 0) { - throw new RangeError('Not a Positive Number') + if (!Number.isInteger(n) || n < 0) { + throw new RangeError('Input should be a non-negative whole number') } if (n === 0) { return 1 } + return n * factorial(n - 1) } diff --git a/Recursive/test/Factorial.test.js b/Recursive/test/Factorial.test.js index 5f32a44332..e89be9831e 100644 --- a/Recursive/test/Factorial.test.js +++ b/Recursive/test/Factorial.test.js @@ -10,10 +10,20 @@ describe('Factorial', () => { }) it('Throw Error for Invalid Input', () => { - expect(() => factorial('-')).toThrow('Not a Whole Number') - expect(() => factorial(null)).toThrow('Not a Whole Number') - expect(() => factorial(undefined)).toThrow('Not a Whole Number') - expect(() => factorial(3.142)).toThrow('Not a Whole Number') - expect(() => factorial(-1)).toThrow('Not a Positive Number') + expect(() => factorial('-')).toThrow( + 'Input should be a non-negative whole number' + ) + expect(() => factorial(null)).toThrow( + 'Input should be a non-negative whole number' + ) + expect(() => factorial(undefined)).toThrow( + 'Input should be a non-negative whole number' + ) + expect(() => factorial(3.142)).toThrow( + 'Input should be a non-negative whole number' + ) + expect(() => factorial(-1)).toThrow( + 'Input should be a non-negative whole number' + ) }) }) From 342382932d275ae0b2ea33bec58cc8a1a71ecdea Mon Sep 17 00:00:00 2001 From: Kausthub Kannan Date: Thu, 5 Oct 2023 15:31:48 +0530 Subject: [PATCH 033/122] feat: Added Euclidean Distance (#1418) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added Euclidean Distance * Added documentation to params * Use @see annotation --------- Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --- Maths/EuclideanDistance.js | 19 +++++++++++++++++++ Maths/test/EuclideanDistance.test.js | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 Maths/EuclideanDistance.js create mode 100644 Maths/test/EuclideanDistance.test.js diff --git a/Maths/EuclideanDistance.js b/Maths/EuclideanDistance.js new file mode 100644 index 0000000000..0cded84ebb --- /dev/null +++ b/Maths/EuclideanDistance.js @@ -0,0 +1,19 @@ +/** + * @see [Wikipedia](https://en.wikipedia.org/wiki/Euclidean_distance) + * Calculate the Euclidean distance between two vectors. + * @param {number[]} vector1 - The first vector. + * @param {number[]} vector2 - The second vector. + * @returns {number} The Euclidean distance between the two vectors. + */ + +const EuclideanDistance = (vector1, vector2) => { + let sumOfSquares = 0 + + for (let i = 0; i < vector1.length; i++) { + sumOfSquares += Math.pow(vector1[i] - vector2[i], 2) + } + + return Math.sqrt(sumOfSquares) +} + +export { EuclideanDistance } diff --git a/Maths/test/EuclideanDistance.test.js b/Maths/test/EuclideanDistance.test.js new file mode 100644 index 0000000000..d73bb03875 --- /dev/null +++ b/Maths/test/EuclideanDistance.test.js @@ -0,0 +1,19 @@ +import { EuclideanDistance } from '../EuclideanDistance.js' + +describe('EuclideanDistance', () => { + it('should calculate the distance correctly for 2D vectors', () => { + expect(EuclideanDistance([0, 0], [2, 2])).toBeCloseTo(2.8284271247461903, 10) + }) + + it('should calculate the distance correctly for 3D vectors', () => { + expect(EuclideanDistance([0, 0, 0], [2, 2, 2])).toBeCloseTo(3.4641016151377544, 10) + }) + + it('should calculate the distance correctly for 4D vectors', () => { + expect(EuclideanDistance([1, 2, 3, 4], [5, 6, 7, 8])).toBeCloseTo(8.0, 10) + }) + + it('should calculate the distance correctly for different 2D vectors', () => { + expect(EuclideanDistance([1, 2], [4, 6])).toBeCloseTo(5.0, 10) + }) +}) From da0ee876db4c5ec094e4baf9a7939f186d2d5781 Mon Sep 17 00:00:00 2001 From: ABHINESH KUMAR JHA <142514166+AbhineshJha@users.noreply.github.com> Date: Sat, 7 Oct 2023 23:59:12 +0530 Subject: [PATCH 034/122] Fix a typo (#1453) --- Backtracking/GeneratePermutations.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Backtracking/GeneratePermutations.js b/Backtracking/GeneratePermutations.js index 288eeb049b..54fa6bb518 100644 --- a/Backtracking/GeneratePermutations.js +++ b/Backtracking/GeneratePermutations.js @@ -1,5 +1,5 @@ /* - * Problem Statement: Generate all distinct permutations of a an array (all permutations should be in sorted order); + * Problem Statement: Generate all distinct permutations of an array (all permutations should be in sorted order); * * What is permutations? * - Permutation means possible arrangements in a set (here it is an array); From f8ffacd48168a250a0433079f00d2d149cb361be Mon Sep 17 00:00:00 2001 From: Harsh Dev Pathak <118347330+Harshdev098@users.noreply.github.com> Date: Sun, 8 Oct 2023 18:54:59 +0530 Subject: [PATCH 035/122] feat: add Gray Code generation (#1425) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --------- Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --- Bit-Manipulation/GrayCodes.js | 42 +++++++++++++++++++++++++ Bit-Manipulation/test/GrayCodes.test.js | 19 +++++++++++ 2 files changed, 61 insertions(+) create mode 100644 Bit-Manipulation/GrayCodes.js create mode 100644 Bit-Manipulation/test/GrayCodes.test.js diff --git a/Bit-Manipulation/GrayCodes.js b/Bit-Manipulation/GrayCodes.js new file mode 100644 index 0000000000..c9ce8ecab9 --- /dev/null +++ b/Bit-Manipulation/GrayCodes.js @@ -0,0 +1,42 @@ +/** + * Generates a Gray code sequence for the given number of bits. + * @param {number} n - The number of bits in the Gray code sequence. + * @returns {number[]} - An array of Gray codes in binary format. + * @description + * Gray codes are binary sequences in which two successive values differ in only one bit. + * This function generates a Gray code sequence of length 2^n for the given number of bits. + * + * The algorithm follows these steps: + * + * 1. Initialize an array `grayCodes` to store the Gray codes. Start with [0, 1] for n = 1. + * 2. Iterate from 1 to n: + * a. Calculate `highestBit` as 2^i, where `i` is the current iteration index. + * b. Iterate in reverse order through the existing Gray codes: + * - For each Gray code `code`, add `highestBit | code` to `grayCodes`. + * - This operation flips a single bit in each existing code, creating new codes. + * 3. Return the `grayCodes` array containing the Gray codes in decimal representation. + * + *resources: [GFG](https://www.geeksforgeeks.org/generate-n-bit-gray-codes/) + * @example + * const n = 3; + * const grayCodes = generateGrayCodes(n); + * // grayCodes will be [0, 1, 3, 2, 6, 7, 5, 4] for n=3. + */ +function generateGrayCodes(n) { + if (n <= 0) { + return [0] + } + + const grayCodes = [0, 1] + + for (let i = 1; i < n; i++) { + const highestBit = 1 << i + for (let j = grayCodes.length - 1; j >= 0; j--) { + grayCodes.push(highestBit | grayCodes[j]) + } + } + + return grayCodes +} + +export { generateGrayCodes } diff --git a/Bit-Manipulation/test/GrayCodes.test.js b/Bit-Manipulation/test/GrayCodes.test.js new file mode 100644 index 0000000000..2e8c46cb8e --- /dev/null +++ b/Bit-Manipulation/test/GrayCodes.test.js @@ -0,0 +1,19 @@ +import { generateGrayCodes } from '../GrayCodes.js' + +describe('Gray codes', () => { + test.each([ + [0, [0b0]], + [1, [0b0, 0b1]], + [2, [0b00, 0b01, 0b11, 0b10]], + [3, [0b000, 0b001, 0b011, 0b010, 0b110, 0b111, 0b101, 0b100]], + [ + 4, + [ + 0b0000, 0b0001, 0b0011, 0b0010, 0b0110, 0b0111, 0b0101, 0b0100, 0b1100, + 0b1101, 0b1111, 0b1110, 0b1010, 0b1011, 0b1001, 0b1000 + ] + ] + ])('n = %i -> %j', (n, expected) => { + expect(generateGrayCodes(n)).toEqual(expected) + }) +}) From d7dc85232c8243b452455e83c85c77514b7590a5 Mon Sep 17 00:00:00 2001 From: Omar Ferreiro <27824673+IcarusTheFly@users.noreply.github.com> Date: Tue, 10 Oct 2023 08:59:51 +0200 Subject: [PATCH 036/122] feat: Key finder improvement (#1456) * Improve algorithm * Updated Documentation in README.md * Updated Documentation in README.md * Remove unwanted changes * Make the changes fit * Updated Documentation in README.md --------- Co-authored-by: IcarusTheFly Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> --- Ciphers/KeyFinder.js | 149 ++++++++++++++++++++++--------------------- DIRECTORY.md | 2 + 2 files changed, 79 insertions(+), 72 deletions(-) diff --git a/Ciphers/KeyFinder.js b/Ciphers/KeyFinder.js index b9121e1d91..64a3d1c9d4 100644 --- a/Ciphers/KeyFinder.js +++ b/Ciphers/KeyFinder.js @@ -1,7 +1,8 @@ -/****************************************************** - Find and retrieve the encryption key automatically - Note: This is a draft version, please help to modify, Thanks! - ******************************************************/ +/** + * Find and retrieve the encryption key automatically. + * @param {string} str - The input encrypted string. + * @returns {number} - The encryption key found, or 0 if not found. + */ function keyFinder(str) { // str is used to get the input of encrypted string const wordBank = [ @@ -30,8 +31,6 @@ function keyFinder(str) { ' be ', 'Be ' ] - // let wordbankelementCounter = 0; - // let key = 0; // return zero means the key can not be found const inStr = str.toString() // convert the input to String let outStr = '' // store the output value let outStrElement = '' // temporary store the word inside the outStr, it is used for comparison @@ -59,89 +58,95 @@ function keyFinder(str) { return 0 // return 0 if found nothing } -/* this sub-function is used to assist the keyFinder to find the key */ +/** + * This sub-function is used to assist the keyFinder in finding the key. + * @param {string} inStr - The input string. + * @param {number} numShifted - The number of characters to shift in the Caesar cipher. + * @returns {string} - The decrypted string. + */ function caesarCipherEncodeAndDecodeEngine(inStr, numShifted) { const shiftNum = numShifted let charCode = 0 - let outStr = '' let shiftedCharCode = 0 let result = 0 - for (let i = 0; i < inStr.length; i++) { - charCode = inStr[i].charCodeAt() - shiftedCharCode = charCode + shiftNum - result = charCode + return inStr + .split('') + .map((char) => { + charCode = char.charCodeAt() + shiftedCharCode = charCode + shiftNum + result = charCode - if (charCode >= 48 && charCode <= 57) { - if (shiftedCharCode < 48) { - let diff = Math.abs(48 - 1 - shiftedCharCode) % 10 + if (charCode >= 48 && charCode <= 57) { + if (shiftedCharCode < 48) { + let diff = Math.abs(48 - 1 - shiftedCharCode) % 10 - while (diff >= 10) { - diff = diff % 10 - } - document.getElementById('diffID').innerHTML = diff + while (diff >= 10) { + diff = diff % 10 + } + document.getElementById('diffID').innerHTML = diff - shiftedCharCode = 57 - diff + shiftedCharCode = 57 - diff - result = shiftedCharCode - } else if (shiftedCharCode >= 48 && shiftedCharCode <= 57) { - result = shiftedCharCode - } else if (shiftedCharCode > 57) { - let diff = Math.abs(57 + 1 - shiftedCharCode) % 10 + result = shiftedCharCode + } else if (shiftedCharCode >= 48 && shiftedCharCode <= 57) { + result = shiftedCharCode + } else if (shiftedCharCode > 57) { + let diff = Math.abs(57 + 1 - shiftedCharCode) % 10 - while (diff >= 10) { - diff = diff % 10 - } - document.getElementById('diffID').innerHTML = diff + while (diff >= 10) { + diff = diff % 10 + } + document.getElementById('diffID').innerHTML = diff - shiftedCharCode = 48 + diff + shiftedCharCode = 48 + diff - result = shiftedCharCode - } - } else if (charCode >= 65 && charCode <= 90) { - if (shiftedCharCode <= 64) { - let diff = Math.abs(65 - 1 - shiftedCharCode) % 26 - - while (diff % 26 >= 26) { - diff = diff % 26 + result = shiftedCharCode } - shiftedCharCode = 90 - diff - result = shiftedCharCode - } else if (shiftedCharCode >= 65 && shiftedCharCode <= 90) { - result = shiftedCharCode - } else if (shiftedCharCode > 90) { - let diff = Math.abs(shiftedCharCode - 1 - 90) % 26 - - while (diff % 26 >= 26) { - diff = diff % 26 + } else if (charCode >= 65 && charCode <= 90) { + if (shiftedCharCode <= 64) { + let diff = Math.abs(65 - 1 - shiftedCharCode) % 26 + + while (diff % 26 >= 26) { + diff = diff % 26 + } + shiftedCharCode = 90 - diff + result = shiftedCharCode + } else if (shiftedCharCode >= 65 && shiftedCharCode <= 90) { + result = shiftedCharCode + } else if (shiftedCharCode > 90) { + let diff = Math.abs(shiftedCharCode - 1 - 90) % 26 + + while (diff % 26 >= 26) { + diff = diff % 26 + } + shiftedCharCode = 65 + diff + result = shiftedCharCode } - shiftedCharCode = 65 + diff - result = shiftedCharCode - } - } else if (charCode >= 97 && charCode <= 122) { - if (shiftedCharCode <= 96) { - let diff = Math.abs(97 - 1 - shiftedCharCode) % 26 - - while (diff % 26 >= 26) { - diff = diff % 26 - } - shiftedCharCode = 122 - diff - result = shiftedCharCode - } else if (shiftedCharCode >= 97 && shiftedCharCode <= 122) { - result = shiftedCharCode - } else if (shiftedCharCode > 122) { - let diff = Math.abs(shiftedCharCode - 1 - 122) % 26 - - while (diff % 26 >= 26) { - diff = diff % 26 + } else if (charCode >= 97 && charCode <= 122) { + if (shiftedCharCode <= 96) { + let diff = Math.abs(97 - 1 - shiftedCharCode) % 26 + + while (diff % 26 >= 26) { + diff = diff % 26 + } + shiftedCharCode = 122 - diff + result = shiftedCharCode + } else if (shiftedCharCode >= 97 && shiftedCharCode <= 122) { + result = shiftedCharCode + } else if (shiftedCharCode > 122) { + let diff = Math.abs(shiftedCharCode - 1 - 122) % 26 + + while (diff % 26 >= 26) { + diff = diff % 26 + } + shiftedCharCode = 97 + diff + result = shiftedCharCode } - shiftedCharCode = 97 + diff - result = shiftedCharCode } - } - outStr = outStr + String.fromCharCode(parseInt(result)) - } - return outStr + return String.fromCharCode(parseInt(result)) + }) + .join('') } export { keyFinder } diff --git a/DIRECTORY.md b/DIRECTORY.md index 31969e4cd1..a7e5fe2c6c 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -179,6 +179,7 @@ * [DecimalExpansion](Maths/DecimalExpansion.js) * [DecimalIsolate](Maths/DecimalIsolate.js) * [DegreeToRadian](Maths/DegreeToRadian.js) + * [EuclideanDistance](Maths/EuclideanDistance.js) * [EulerMethod](Maths/EulerMethod.js) * [EulersTotient](Maths/EulersTotient.js) * [EulersTotientFunction](Maths/EulersTotientFunction.js) @@ -249,6 +250,7 @@ * [SumOfDigits](Maths/SumOfDigits.js) * [SumOfGeometricProgression](Maths/SumOfGeometricProgression.js) * [TwinPrime](Maths/TwinPrime.js) + * [TwoSum](Maths/TwoSum.js) * [Volume](Maths/Volume.js) * [WhileLoopFactorial](Maths/WhileLoopFactorial.js) * [ZellersCongruenceAlgorithm](Maths/ZellersCongruenceAlgorithm.js) From 05750bce435ea6cc8797179bbfe7a0165d41a9f0 Mon Sep 17 00:00:00 2001 From: Rohit Chaudhari <100275369+rohitkbc@users.noreply.github.com> Date: Tue, 10 Oct 2023 12:30:31 +0530 Subject: [PATCH 037/122] chore: Add gitpod badge (#1466) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f6633bab06..65dfb501df 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ JavaScript Repository of TheAlgorithms, which implements various algorithms and [![JavaScript Banner][banner]](DIRECTORY.md) +[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/TheAlgorithms/JavaScript) [![Checks][checks]][actions] [![Contributions Welcome][welcome]](CONTRIBUTING.md) [![standard.js][standard-logo]][standard-js] From 52858f8a095654e428bb361beb948fcf450be10a Mon Sep 17 00:00:00 2001 From: Gaurav Giri <64427471+gaurovgiri@users.noreply.github.com> Date: Tue, 10 Oct 2023 12:45:59 +0545 Subject: [PATCH 038/122] feat: add algorithm to evaluate postfix string (#1441) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add algorithm to evaluate postfix strings * feat: add test case for evaluate expression * update: add literature reference * fix: import name in testcase * fix: test case result * Make clear that this is postfix * Update tests * add: see reference * fixes mentioned issues * Fix `default` case --------- Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --- Data-Structures/Stack/EvaluateExpression.js | 58 +++++++++++++++++++ .../Stack/test/EvaluateExpression.test.js | 22 +++++++ 2 files changed, 80 insertions(+) create mode 100644 Data-Structures/Stack/EvaluateExpression.js create mode 100644 Data-Structures/Stack/test/EvaluateExpression.test.js diff --git a/Data-Structures/Stack/EvaluateExpression.js b/Data-Structures/Stack/EvaluateExpression.js new file mode 100644 index 0000000000..e59a4a37c0 --- /dev/null +++ b/Data-Structures/Stack/EvaluateExpression.js @@ -0,0 +1,58 @@ +/** + * Evaluate a numeric operations string in postfix notation using a stack. + * Supports basic arithmetic operations: +, -, *, / + * @see https://www.geeksforgeeks.org/evaluation-of-postfix-expression/ + * @param {string} expression - Numeric operations expression to evaluate. Must be a valid postfix expression. + * @returns {number|null} - Result of the expression evaluation, or null if the expression is invalid. + */ +function evaluatePostfixExpression(expression) { + const stack = []; + + // Helper function to perform an operation and push the result to the stack. Returns success. + function performOperation(operator) { + const rightOp = stack.pop(); // Right operand is the top of the stack + const leftOp = stack.pop(); // Left operand is the next item on the stack + + if (leftOp === undefined || rightOp === undefined) { + return false; // Invalid expression + } + switch (operator) { + case '+': + stack.push(leftOp + rightOp); + break; + case '-': + stack.push(leftOp - rightOp); + break; + case '*': + stack.push(leftOp * rightOp); + break; + case '/': + if (rightOp === 0) { + return false; + } + stack.push(leftOp / rightOp); + break; + default: + return false; // Unknown operator + } + return true; + } + + const tokens = expression.split(/\s+/); + + for (const token of tokens) { + if (!isNaN(parseFloat(token))) { + // If the token is a number, push it to the stack + stack.push(parseFloat(token)); + } else { + // If the token is an operator, perform the operation + if (!performOperation(token)) { + return null; // Invalid expression + } + } + } + + return (stack.length === 1) ? stack[0] : null; +} + +export { evaluatePostfixExpression }; diff --git a/Data-Structures/Stack/test/EvaluateExpression.test.js b/Data-Structures/Stack/test/EvaluateExpression.test.js new file mode 100644 index 0000000000..eea764cac2 --- /dev/null +++ b/Data-Structures/Stack/test/EvaluateExpression.test.js @@ -0,0 +1,22 @@ +import { evaluatePostfixExpression } from '../EvaluateExpression.js'; + +describe('evaluatePostfixExpression', () => { + it('should evaluate a valid expression', () => { + const expression = '3 4 * 2 / 5 +'; // (3 * 4) / 2 + 5 = 11 + const result = evaluatePostfixExpression(expression); + expect(result).toBe(11); + }); + + it('should handle division by zero', () => { + const expression = '3 0 /'; // Division by zero + const result = evaluatePostfixExpression(expression); + expect(result).toBe(null); + }); + + it('should handle an invalid expression', () => { + const expression = '3 * 4 2 / +'; // Invalid expression + const result = evaluatePostfixExpression(expression); + expect(result).toBe(null); + }); + +}); From c5a25665e0aa02329e138552e47b3061f6182d22 Mon Sep 17 00:00:00 2001 From: Ridge Kimani <101694484+ridge-kimani@users.noreply.github.com> Date: Tue, 10 Oct 2023 10:04:09 +0300 Subject: [PATCH 039/122] bug: abs returns 0 on an empty array (#1473) * bug: update edge case for empty array * bug: add edge case for empty arrays * feat: add test case for empty array --------- Co-authored-by: Ridge Kimani --- Maths/Abs.js | 4 ++-- Maths/test/Abs.test.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Maths/Abs.js b/Maths/Abs.js index a418ee35f3..53c353fb8b 100644 --- a/Maths/Abs.js +++ b/Maths/Abs.js @@ -12,11 +12,11 @@ const abs = (num) => { const validNumber = +num // converted to number, also can use - Number(num) - if (Number.isNaN(validNumber)) { + if (Number.isNaN(validNumber) || typeof num === 'object') { throw new TypeError('Argument is NaN - Not a Number') } - return validNumber < 0 ? -validNumber : validNumber // if number is less then zero mean negative then it converted to positive. i.e -> n = -2 = -(-2) = 2 + return validNumber < 0 ? -validNumber : validNumber // if number is less than zero mean negative then it converted to positive. i.e -> n = -2 = -(-2) = 2 } export { abs } diff --git a/Maths/test/Abs.test.js b/Maths/test/Abs.test.js index 6a67fa50d1..0749679647 100644 --- a/Maths/test/Abs.test.js +++ b/Maths/test/Abs.test.js @@ -5,6 +5,7 @@ describe('Testing abs function', () => { expect(() => abs('234a')).toThrow() expect(() => abs({})).toThrow() expect(() => abs([12, -32, -60])).toThrow() + expect(() => abs([])).toThrow() // coerces to 0 }) it('Testing for number of string type', () => { From 13161bdadb0a432f5f91de9b17d31ac673196659 Mon Sep 17 00:00:00 2001 From: Rohan <95855114+ROHAN13498@users.noreply.github.com> Date: Tue, 10 Oct 2023 12:44:34 +0530 Subject: [PATCH 040/122] feat: Combined Min Heap and Max Heap classes (#1494) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Combined Min Heap and Max Heap classes * Added JSdoc comments and also improved tests for binary heap * Added private methods for BinaryHeap class * JSDoc knows that a class is a class I assume the @class tag is for classes implemented via constructor functions, not using ES6 class syntax --------- Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --- Data-Structures/Heap/BinaryHeap.js | 151 +++++++++++++++++++ Data-Structures/Heap/MaxHeap.js | 85 ----------- Data-Structures/Heap/MinHeap.js | 127 ---------------- Data-Structures/Heap/test/BinaryHeap.test.js | 72 +++++++++ Data-Structures/Heap/test/MinHeap.test.js | 37 ----- Maths/test/EuclideanDistance.test.js | 10 +- 6 files changed, 231 insertions(+), 251 deletions(-) create mode 100644 Data-Structures/Heap/BinaryHeap.js delete mode 100644 Data-Structures/Heap/MaxHeap.js delete mode 100644 Data-Structures/Heap/MinHeap.js create mode 100644 Data-Structures/Heap/test/BinaryHeap.test.js delete mode 100644 Data-Structures/Heap/test/MinHeap.test.js diff --git a/Data-Structures/Heap/BinaryHeap.js b/Data-Structures/Heap/BinaryHeap.js new file mode 100644 index 0000000000..af4fe3ba75 --- /dev/null +++ b/Data-Structures/Heap/BinaryHeap.js @@ -0,0 +1,151 @@ +/** + * BinaryHeap class represents a binary heap data structure that can be configured as a Min Heap or Max Heap. + * + * Binary heaps are binary trees that are filled level by level and from left to right inside each level. + * They have the property that any parent node has a smaller (for Min Heap) or greater (for Max Heap) priority + * than its children, ensuring that the root of the tree always holds the extremal value. + */ +class BinaryHeap { + /** + * Creates a new BinaryHeap instance. + * @constructor + * @param {Function} comparatorFunction - The comparator function used to determine the order of elements (e.g., minHeapComparator or maxHeapComparator). + */ + constructor(comparatorFunction) { + /** + * The heap array that stores elements. + * @member {Array} + */ + this.heap = [] + + /** + * The comparator function used for ordering elements in the heap. + * @member {Function} + */ + this.comparator = comparatorFunction + } + + /** + * Inserts a new value into the heap. + * @param {*} value - The value to be inserted into the heap. + */ + insert(value) { + this.heap.push(value) + this.#bubbleUp(this.heap.length - 1) + } + + /** + * Returns the number of elements in the heap. + * @returns {number} - The number of elements in the heap. + */ + size() { + return this.heap.length + } + + /** + * Checks if the heap is empty. + * @returns {boolean} - True if the heap is empty, false otherwise. + */ + empty() { + return this.size() === 0 + } + + /** + * Bubbles up a value from the specified index to maintain the heap property. + * @param {number} currIdx - The index of the value to be bubbled up. + * @private + */ + #bubbleUp(currIdx) { + let parentIdx = Math.floor((currIdx - 1) / 2) + + while ( + currIdx > 0 && + this.comparator(this.heap[currIdx], this.heap[parentIdx]) + ) { + this.#swap(currIdx, parentIdx) + currIdx = parentIdx + parentIdx = Math.floor((currIdx - 1) / 2) + } + } + + /** + * Sinks down a value from the specified index to maintain the heap property. + * @param {number} currIdx - The index of the value to be sunk down. + * @private + */ + #sinkDown(currIdx) { + let childOneIdx = currIdx * 2 + 1 + + while (childOneIdx < this.size()) { + const childTwoIdx = childOneIdx + 1 < this.size() ? childOneIdx + 1 : -1 + const swapIdx = + childTwoIdx !== -1 && + this.comparator(this.heap[childTwoIdx], this.heap[childOneIdx]) + ? childTwoIdx + : childOneIdx + + if (this.comparator(this.heap[swapIdx], this.heap[currIdx])) { + this.#swap(currIdx, swapIdx) + currIdx = swapIdx + childOneIdx = currIdx * 2 + 1 + } else { + return + } + } + } + + /** + * Retrieves the top element of the heap without removing it. + * @returns {*} - The top element of the heap. + */ + peek() { + return this.heap[0] + } + + /** + * Removes and returns the top element of the heap. + * @returns {*} - The top element of the heap. + */ + extractTop() { + const top = this.peek() + const last = this.heap.pop() + + if (!this.empty()) { + this.heap[0] = last + this.#sinkDown(0) + } + + return top + } + + /** + * Swaps elements at two specified indices in the heap. + * @param {number} index1 - The index of the first element to be swapped. + * @param {number} index2 - The index of the second element to be swapped. + * @private + */ + #swap(index1, index2) { + ;[this.heap[index1], this.heap[index2]] = [ + this.heap[index2], + this.heap[index1] + ] + } +} + +/** + * Comparator function for creating a Min Heap. + * @param {*} a - The first element to compare. + * @param {*} b - The second element to compare. + * @returns {boolean} - True if 'a' should have higher priority than 'b' in the Min Heap, false otherwise. + */ +const minHeapComparator = (a, b) => a < b + +/** + * Comparator function for creating a Max Heap. + * @param {*} a - The first element to compare. + * @param {*} b - The second element to compare. + * @returns {boolean} - True if 'a' should have higher priority than 'b' in the Max Heap, false otherwise. + */ +const maxHeapComparator = (a, b) => a > b + +export { BinaryHeap, minHeapComparator, maxHeapComparator } diff --git a/Data-Structures/Heap/MaxHeap.js b/Data-Structures/Heap/MaxHeap.js deleted file mode 100644 index 5788d786e3..0000000000 --- a/Data-Structures/Heap/MaxHeap.js +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Author: Samarth Jain - * Max Heap implementation in Javascript - */ - -class BinaryHeap { - constructor() { - this.heap = [] - } - - insert(value) { - this.heap.push(value) - this.heapify() - } - - size() { - return this.heap.length - } - - empty() { - return this.size() === 0 - } - - // using iterative approach to reorder the heap after insertion - heapify() { - let index = this.size() - 1 - - while (index > 0) { - const element = this.heap[index] - const parentIndex = Math.floor((index - 1) / 2) - const parent = this.heap[parentIndex] - - if (parent[0] >= element[0]) break - this.heap[index] = parent - this.heap[parentIndex] = element - index = parentIndex - } - } - - // Extracting the maximum element from the Heap - extractMax() { - const max = this.heap[0] - const tmp = this.heap.pop() - if (!this.empty()) { - this.heap[0] = tmp - this.sinkDown(0) - } - return max - } - - // To restore the balance of the heap after extraction. - sinkDown(index) { - const left = 2 * index + 1 - const right = 2 * index + 2 - let largest = index - const length = this.size() - - if (left < length && this.heap[left][0] > this.heap[largest][0]) { - largest = left - } - if (right < length && this.heap[right][0] > this.heap[largest][0]) { - largest = right - } - // swap - if (largest !== index) { - const tmp = this.heap[largest] - this.heap[largest] = this.heap[index] - this.heap[index] = tmp - this.sinkDown(largest) - } - } -} - -// Example - -// const maxHeap = new BinaryHeap() -// maxHeap.insert([4]) -// maxHeap.insert([3]) -// maxHeap.insert([6]) -// maxHeap.insert([1]) -// maxHeap.insert([8]) -// maxHeap.insert([2]) -// const mx = maxHeap.extractMax() - -export { BinaryHeap } diff --git a/Data-Structures/Heap/MinHeap.js b/Data-Structures/Heap/MinHeap.js deleted file mode 100644 index a115447c97..0000000000 --- a/Data-Structures/Heap/MinHeap.js +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Min Heap is one of the two Binary Heap types (the other is Max Heap) - * which maintains the smallest value of its input array on top and remaining values in loosely (but not perfectly sorted) order. - * - * Min Heaps can be expressed as a 'complete' binary tree structure - * (in which all levels of the binary tree are filled, with the exception of the last level which must be filled left-to-right). - * - * However the Min Heap class below expresses this tree structure as an array - * which represent the binary tree node values in an array ordered from root-to-leaf, left-to-right. - * - * In the array representation, the parent node-child node relationship is such that the - * * parent index relative to its two children are: (parentIdx * 2) and (parent * 2 + 1) - * * and either child's index position relative to its parent is: Math.floor((childIdx-1)/2) - * - * The parent and respective child values define much of heap behavior as we continue to sort or not sort depending on their values. - * * The parent value must be less than or equal to either child's value. - * - * This is a condensed overview but for more information and visuals here is a nice read: https://www.geeksforgeeks.org/binary-heap/ - */ - -class MinHeap { - constructor(array) { - this.heap = this.initializeHeap(array) - } - - /** - * startingParent represents the parent of the last index (=== array.length-1) - * and iterates towards 0 with all index values below sorted to meet heap conditions - */ - initializeHeap(array) { - const startingParent = Math.floor((array.length - 2) / 2) - - for (let currIdx = startingParent; currIdx >= 0; currIdx--) { - this.sinkDown(currIdx, array.length - 1, array) - } - return array - } - - /** - * overall functionality: heap-sort value at a starting index (currIdx) towards end of heap - * - * currIdx is considered to be a starting 'parent' index of two children indices (childOneIdx, childTwoIdx). - * endIdx represents the last valid index in the heap. - * - * first check that childOneIdx and childTwoIdx are both smaller than endIdx - * and check for the smaller heap value between them. - * - * the child index with the smaller heap value is set to a variable called swapIdx. - * - * swapIdx's value will be compared to currIdx (the 'parent' index) - * and if swapIdx's value is smaller than currIdx's value, swap the values in the heap, - * update currIdx and recalculate the new childOneIdx to check heap conditions again. - * - * if there is no swap, it means the children indices and the parent index satisfy heap conditions and can exit the function. - */ - sinkDown(currIdx, endIdx, heap) { - let childOneIdx = currIdx * 2 + 1 - - while (childOneIdx <= endIdx) { - const childTwoIdx = childOneIdx + 1 <= endIdx ? childOneIdx + 1 : -1 - const swapIdx = - childTwoIdx !== -1 && heap[childTwoIdx] < heap[childOneIdx] - ? childTwoIdx - : childOneIdx - - if (heap[swapIdx] < heap[currIdx]) { - this.swap(currIdx, swapIdx, heap) - currIdx = swapIdx - childOneIdx = currIdx * 2 + 1 - } else { - return - } - } - } - - /** - * overall functionality: heap-sort value at a starting index (currIdx) towards front of heap. - * - * while the currIdx's value is smaller than its parent's (parentIdx) value, swap the values in the heap - * update currIdx and recalculate the new parentIdx to check heap condition again. - * - * iteration does not end while a valid currIdx has a value smaller than its parentIdx's value - */ - bubbleUp(currIdx) { - let parentIdx = Math.floor((currIdx - 1) / 2) - - while (currIdx > 0 && this.heap[currIdx] < this.heap[parentIdx]) { - this.swap(currIdx, parentIdx, this.heap) - currIdx = parentIdx - parentIdx = Math.floor((currIdx - 1) / 2) - } - } - - peek() { - return this.heap[0] - } - - /** - * the min heap value should be the first value in the heap (=== this.heap[0]) - * - * firstIdx value and lastIdx value are swapped - * the resulting min heap value now resides at heap[heap.length-1] which is popped and later returned. - * - * the remaining values in the heap are re-sorted - */ - extractMin() { - this.swap(0, this.heap.length - 1, this.heap) - const min = this.heap.pop() - this.sinkDown(0, this.heap.length - 1, this.heap) - return min - } - - // a new value is pushed to the end of the heap and sorted up - insert(value) { - this.heap.push(value) - this.bubbleUp(this.heap.length - 1) - } - - // index-swapping helper method - swap(idx1, idx2, heap) { - const temp = heap[idx1] - heap[idx1] = heap[idx2] - heap[idx2] = temp - } -} - -export { MinHeap } diff --git a/Data-Structures/Heap/test/BinaryHeap.test.js b/Data-Structures/Heap/test/BinaryHeap.test.js new file mode 100644 index 0000000000..56aef11e02 --- /dev/null +++ b/Data-Structures/Heap/test/BinaryHeap.test.js @@ -0,0 +1,72 @@ +import { BinaryHeap, minHeapComparator } from '../BinaryHeap' + +describe('BinaryHeap', () => { + describe('MinHeap', () => { + let minHeap + + beforeEach(() => { + // Initialize a MinHeap + minHeap = new BinaryHeap(minHeapComparator) + minHeap.insert(4) + minHeap.insert(3) + minHeap.insert(6) + minHeap.insert(1) + minHeap.insert(8) + minHeap.insert(2) + }) + + it('should initialize a heap from an input array', () => { + // Check if the heap is initialized correctly + expect(minHeap.heap).toEqual([1, 3, 2, 4, 8, 6]) + }) + + it('should show the top value in the heap', () => { + // Check if the top value is as expected + const minValue = minHeap.peek() + expect(minValue).toEqual(1) + }) + + it('should remove and return the top value in the heap', () => { + // Check if the top value is removed correctly + const minValue = minHeap.extractTop() + expect(minValue).toEqual(1) + expect(minHeap.heap).toEqual([2, 3, 6, 4, 8]) + }) + + it('should handle insertion of duplicate values', () => { + // Check if the heap handles duplicate values correctly + minHeap.insert(2) + console.log(minHeap.heap); + expect(minHeap.heap).toEqual([1, 3, 2, 4, 8, 6, 2]) + }) + + it('should handle an empty heap', () => { + // Check if an empty heap behaves as expected + const emptyHeap = new BinaryHeap(minHeapComparator) + expect(emptyHeap.peek()).toBeUndefined() + expect(emptyHeap.extractTop()).toBeUndefined() + }) + + it('should handle extracting all elements from the heap', () => { + // Check if all elements can be extracted in the correct order + const extractedValues = [] + while (!minHeap.empty()) { + extractedValues.push(minHeap.extractTop()) + } + expect(extractedValues).toEqual([1, 2, 3, 4, 6, 8]) + }) + + it('should insert elements in ascending order', () => { + // Check if elements are inserted in ascending order + const ascendingHeap = new BinaryHeap(minHeapComparator) + ascendingHeap.insert(4) + ascendingHeap.insert(3) + ascendingHeap.insert(2) + ascendingHeap.insert(1) + expect(ascendingHeap.extractTop()).toEqual(1) + expect(ascendingHeap.extractTop()).toEqual(2) + expect(ascendingHeap.extractTop()).toEqual(3) + expect(ascendingHeap.extractTop()).toEqual(4) + }) + }) +}) diff --git a/Data-Structures/Heap/test/MinHeap.test.js b/Data-Structures/Heap/test/MinHeap.test.js deleted file mode 100644 index d7947ad12f..0000000000 --- a/Data-Structures/Heap/test/MinHeap.test.js +++ /dev/null @@ -1,37 +0,0 @@ -import { MinHeap } from '../MinHeap' - -describe('MinHeap', () => { - const array = [2, 4, 10, 23, 43, 42, 39, 7, 9, 16, 85, 1, 51] - let heap - - beforeEach(() => { - heap = new MinHeap(array) - }) - - it('should initialize a heap from an input array', () => { - expect(heap).toEqual({ - heap: [1, 4, 2, 7, 16, 10, 39, 23, 9, 43, 85, 42, 51] - }) // eslint-disable-line - }) - - it('should show the top value in the heap', () => { - const minValue = heap.peek() - - expect(minValue).toEqual(1) - }) - - it('should remove and return the top value in the heap', () => { - const minValue = heap.extractMin() - - expect(minValue).toEqual(1) - expect(heap).toEqual({ heap: [2, 4, 10, 7, 16, 42, 39, 23, 9, 43, 85, 51] }) // eslint-disable-line - }) - - it('should insert a new value and sort until it meets heap conditions', () => { - heap.insert(15) - - expect(heap).toEqual({ - heap: [2, 4, 10, 7, 16, 15, 39, 23, 9, 43, 85, 51, 42] - }) // eslint-disable-line - }) -}) diff --git a/Maths/test/EuclideanDistance.test.js b/Maths/test/EuclideanDistance.test.js index d73bb03875..717ea2e6a0 100644 --- a/Maths/test/EuclideanDistance.test.js +++ b/Maths/test/EuclideanDistance.test.js @@ -2,11 +2,17 @@ import { EuclideanDistance } from '../EuclideanDistance.js' describe('EuclideanDistance', () => { it('should calculate the distance correctly for 2D vectors', () => { - expect(EuclideanDistance([0, 0], [2, 2])).toBeCloseTo(2.8284271247461903, 10) + expect(EuclideanDistance([0, 0], [2, 2])).toBeCloseTo( + 2.8284271247461903, + 10 + ) }) it('should calculate the distance correctly for 3D vectors', () => { - expect(EuclideanDistance([0, 0, 0], [2, 2, 2])).toBeCloseTo(3.4641016151377544, 10) + expect(EuclideanDistance([0, 0, 0], [2, 2, 2])).toBeCloseTo( + 3.4641016151377544, + 10 + ) }) it('should calculate the distance correctly for 4D vectors', () => { From a24450a6290773ef4581209443e5c67123013a2f Mon Sep 17 00:00:00 2001 From: Piyush Katyal <109459034+piyushk77@users.noreply.github.com> Date: Wed, 11 Oct 2023 11:33:02 +0530 Subject: [PATCH 041/122] feat: add determinant algorithm (#1438) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add determinant calculating algorithm * test: add self-tests for determinant algorithm * chore: add wikipedia info link * fix: change initialization to zero * fix: add error throw and general code improvements * fix: add error try and catch * fix: seperate the test loops of error cases * clean up a bit --------- Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --- Maths/Determinant.js | 78 ++++++++++++++++++++++++++++++++++ Maths/test/Determinant.test.js | 63 +++++++++++++++++++++++++++ 2 files changed, 141 insertions(+) create mode 100644 Maths/Determinant.js create mode 100644 Maths/test/Determinant.test.js diff --git a/Maths/Determinant.js b/Maths/Determinant.js new file mode 100644 index 0000000000..d218a6ee98 --- /dev/null +++ b/Maths/Determinant.js @@ -0,0 +1,78 @@ +/** + * Given a square matrix, find its determinant using Laplace Expansion. + * Time Complexity : O(n!) + * + * For more info: https://en.wikipedia.org/wiki/Determinant + * + * @param {number[[]]} matrix - Two dimensional array of integers. + * @returns {number} - An integer equal to the determinant. + * + * @example + * const squareMatrix = [ + * [2,3,4,6], + * [5,8,9,0], + * [7,4,3,9], + * [4,0,2,1] + * ]; + * + * const result = determinant(squareMatrix); + * // The function should return 858 as the resultant determinant. + */ + +const subMatrix = (matrix, i, j) => { + let matrixSize = matrix[0].length + if (matrixSize === 1) { + return matrix[0][0] + } + let subMatrix = [] + for (let x = 0; x < matrixSize; x++) { + if (x === i) { + continue + } + subMatrix.push([]) + for (let y = 0; y < matrixSize; y++) { + if (y === j) { + continue + } + subMatrix[subMatrix.length - 1].push(matrix[x][y]) + } + } + return subMatrix +} + +const isMatrixSquare = (matrix) => { + let numRows = matrix.length + for (let i = 0; i < numRows; i++) { + if (numRows !== matrix[i].length) { + return false + } + } + return true +} + +const determinant = (matrix) => { + if ( + !Array.isArray(matrix) || + matrix.length === 0 || + !Array.isArray(matrix[0]) + ) { + throw new Error('Input is not a valid 2D matrix.') + } + if (!isMatrixSquare(matrix)) { + throw new Error('Square matrix is required.') + } + let numCols = matrix[0].length + if (numCols === 1) { + return matrix[0][0] + } + let result = 0 + let setIndex = 0 + for (let i = 0; i < numCols; i++) { + result += + Math.pow(-1, i) * + matrix[setIndex][i] * + determinant(subMatrix(matrix, setIndex, i)) + } + return result +} +export { determinant } diff --git a/Maths/test/Determinant.test.js b/Maths/test/Determinant.test.js new file mode 100644 index 0000000000..df9d34df83 --- /dev/null +++ b/Maths/test/Determinant.test.js @@ -0,0 +1,63 @@ +import { expect } from 'vitest' +import { determinant } from '../Determinant' +describe('Determinant', () => { + test.each([ + [ + [ + [8, 1, 6], + [1, 2, 3], + [4, 7, 5] + ], + -87 + ], + [ + [ + [2, 1, 0, 2], + [1, 2, 4, 3], + [0, 4, 7, 5], + [4, 7, 9, 8] + ], + 25 + ], + [ + [ + [5, 9], + [3, 7] + ], + 8 + ], + [ + [ + [7, 5, 1, 4, 3], + [6, 8, 7, 9, 6], + [9, 8, 0, 4, 7], + [0, 3, 4, 7, 9], + [3, 6, 2, 8, 8] + ], + 2476 + ], + [[[23]], 23] + ])( + 'Should return the determinant of the square matrix.', + (matrix, expected) => { + expect(determinant(matrix)).toEqual(expected) + } + ) + + test.each([ + [ + [ + [1, 6], + [1, 2, 3], + [4, 7, 5] + ], + 'Square matrix is required.' + ], + [[1, 3, 2, [5, 8, 6], 3], 'Input is not a valid 2D matrix.'] + ])( + 'Should return the error message.', + (matrix, expected) => { + expect(() => determinant(matrix)).toThrowError(expected) + } + ) +}) From 3823eded0a57884a177a6d7df837d927a9b108ba Mon Sep 17 00:00:00 2001 From: Piyush Katyal <109459034+piyushk77@users.noreply.github.com> Date: Wed, 11 Oct 2023 11:34:33 +0530 Subject: [PATCH 042/122] feat: add row echelon matrix algorithm (#1454) * feat: add row echelon matrix algorithm * test: add self-tests for row echelon algorithm * fix: replace rounding with float tolerance * chore: use correct style * fix: use error tolerance and segregate testcases * chore: add necessary explaining comments --- Maths/RowEchelon.js | 150 ++++++++++++++++++++++++++++++++++ Maths/test/RowEchelon.test.js | 89 ++++++++++++++++++++ 2 files changed, 239 insertions(+) create mode 100644 Maths/RowEchelon.js create mode 100644 Maths/test/RowEchelon.test.js diff --git a/Maths/RowEchelon.js b/Maths/RowEchelon.js new file mode 100644 index 0000000000..c773bb80a9 --- /dev/null +++ b/Maths/RowEchelon.js @@ -0,0 +1,150 @@ +/** + * Given a two dimensional matrix, find its row echelon form. + * + * For more info: https://en.wikipedia.org/wiki/Row_echelon_form + * + * @param {number[[]]} matrix - Two dimensional array of rational numbers. + * @returns {number[[]]} - Two dimensional array of rational numbers (row echelon form). + * + * @example + * const matrix = [ + * [2,3,4,5,7], + * [9,8,4,0,9], + * [5,7,4,3,9], + * [3,4,0,2,1] + * ] + * + * const result = rowEchelon(matrix) + * + * // The function returns the corresponding row echelon form: + * // result: + * // [ + * // [1, 1.5, 2, 2.5, 3.5], + * // [0, 1, 2.54545, 4.09091, 4.09091], + * // [0, 0, 1, 1.57692, 1.36539], + * // [0, 0, 0, 1, -0.25] + * // ] + */ + +// Set a tolerance value for floating-point comparisons +const tolerance = 0.000001 + +// Check if all the rows have same length of elements +const isMatrixValid = (matrix) => { + let numRows = matrix.length + let numCols = matrix[0].length + for (let i = 0; i < numRows; i++) { + if (numCols !== matrix[i].length) { + return false + } + } + + // Check for input other than a 2D matrix + if ( + !Array.isArray(matrix) || + matrix.length === 0 || + !Array.isArray(matrix[0]) + ) { + return false + } + return true +} + +const checkNonZero = (currentRow, currentCol, matrix) => { + let numRows = matrix.length + for (let i = currentRow; i < numRows; i++) { + // Checks if the current element is not very near to zero. + if (!isTolerant(0, matrix[i][currentCol], tolerance)) { + return true + } + } + return false +} + +const swapRows = (currentRow, withRow, matrix) => { + let numCols = matrix[0].length + let tempValue = 0 + for (let j = 0; j < numCols; j++) { + tempValue = matrix[currentRow][j] + matrix[currentRow][j] = matrix[withRow][j] + matrix[withRow][j] = tempValue + } +} + +// Select a pivot element in the current column to facilitate row operations. +// Pivot element is the first non-zero element found from the current row +// down to the last row. +const selectPivot = (currentRow, currentCol, matrix) => { + let numRows = matrix.length + for (let i = currentRow; i < numRows; i++) { + if (matrix[i][currentCol] !== 0) { + swapRows(currentRow, i, matrix) + return + } + } +} + +// Multiply each element of the given row with a factor. +const scalarMultiplication = (currentRow, factor, matrix) => { + let numCols = matrix[0].length + for (let j = 0; j < numCols; j++) { + matrix[currentRow][j] *= factor + } +} + +// Subtract one row from another row +const subtractRow = (currentRow, fromRow, matrix) => { + let numCols = matrix[0].length + for (let j = 0; j < numCols; j++) { + matrix[fromRow][j] -= matrix[currentRow][j] + } +} + +// Check if two numbers are equal within a given tolerance +const isTolerant = (a, b, tolerance) => { + const absoluteDifference = Math.abs(a - b) + return absoluteDifference <= tolerance +} + +const rowEchelon = (matrix) => { + // Check if the input matrix is valid; if not, throw an error. + if (!isMatrixValid(matrix)) { + throw new Error('Input is not a valid 2D matrix.') + } + + let numRows = matrix.length + let numCols = matrix[0].length + let result = matrix + + // Iterate through the rows (i) and columns (j) of the matrix. + for (let i = 0, j = 0; i < numRows && j < numCols; ) { + // If the current column has all zero elements below the current row, + // move to the next column. + if (!checkNonZero(i, j, result)) { + j++ + continue + } + + // Select a pivot element and normalize the current row. + selectPivot(i, j, result) + let factor = 1 / result[i][j] + scalarMultiplication(i, factor, result) + + // Make elements below the pivot element zero by performing + // row operations on subsequent rows. + for (let x = i + 1; x < numRows; x++) { + factor = result[x][j] + if (isTolerant(0, factor, tolerance)) { + continue + } + scalarMultiplication(i, factor, result) + subtractRow(i, x, result) + factor = 1 / factor + scalarMultiplication(i, factor, result) + } + i++ + } + return result +} + +export { rowEchelon } diff --git a/Maths/test/RowEchelon.test.js b/Maths/test/RowEchelon.test.js new file mode 100644 index 0000000000..5575bc6d39 --- /dev/null +++ b/Maths/test/RowEchelon.test.js @@ -0,0 +1,89 @@ +import { rowEchelon } from '../RowEchelon' +describe('Determinant', () => { + const tolerance = 0.000001 + test.each([ + [ + [ + [8, 1, 3, 5], + [4, 6, 8, 2], + [3, 5, 6, 8] + ], + [ + [1, 0.125, 0.375, 0.625], + [0, 1, 1.18182, -0.09091], + [0, 0, 1, -11.0769] + ] + ], + [ + [ + [6, 8, 1, 3, 5], + [1, 4, 6, 8, 2], + [0, 3, 5, 6, 8], + [2, 5, 9, 7, 8], + [5, 5, 7, 0, 1] + ], + [ + [1, 1.33333, 0.16667, 0.5, 0.83333], + [0, 1, 2.1875, 2.8125, 0.4375], + [0, 0, 1, 1.56, -4.28003], + [0, 0, 0, 1, -3.3595], + [0, 0, 0, 0, 1] + ] + ], + [ + [ + [1, 3, 5], + [6, 8, 2], + [5, 6, 8], + [7, 9, 9], + [5, 0, 6] + ], + [ + [1, 3, 5], + [0, 1, 2.8], + [0, 0, 1], + [0, 0, 0], + [0, 0, 0] + ] + ], + [ + [ + [0, 7, 8, 1, 3, 5], + [0, 6, 4, 6, 8, 2], + [0, 7, 3, 5, 6, 8], + [6, 8, 1, 0, 0, 4], + [3, 3, 5, 7, 3, 1], + [1, 2, 1, 0, 9, 7], + [8, 8, 0, 2, 3, 1] + ], + [ + [1, 1.33333, 0.16667, 0, 0, 0.66667], + [0, 1, 0.66667, 1, 1.33333, 0.33333], + [0, 0, 1, 1.2, 1.99999, -3.4], + [0, 0, 0, 1, 1.3, -1.4], + [0, 0, 0, 0, 1, -2.32854], + [0, 0, 0, 0, 0, 1], + [0, 0, 0, 0, 0, 0] + ] + ] + ])('Should return the matrix in row echelon form.', (matrix, expected) => { + for (let i = 0; i < matrix.length; i++) { + for (let j = 0; j < matrix[i].length; j++) { + expect(rowEchelon(matrix)[i][j]).toBeCloseTo(expected[i][j], tolerance) + } + } + }) + + test.each([ + [ + [ + [8, 1, 3, 5], + [4, 6, 8, 2, 7], + [3, 5, 6, 8] + ], + 'Input is not a valid 2D matrix.' + ] + ])('Should return the error message.', (matrix, expected) => { + expect(() => rowEchelon(matrix)).toThrowError(expected) + }) +}) From ca761d87b6f507560305c27ba7dd0f1168f6ded7 Mon Sep 17 00:00:00 2001 From: Nay Zaw Min Naing Date: Wed, 11 Oct 2023 12:35:09 +0630 Subject: [PATCH 043/122] feat: add MergeTwoSortedLinkedLIsts algorithms (#1442) * feat: add mergeTwoSortedLinkedLIsts algorithms * remove class and unnecessary function change the function params and return value from Node to LinkedList. --- .../Linked-List/MergeTwoSortedLinkedLists.js | 45 +++++++++++++++++++ .../test/MergeTwoSortedLinkedLists.test.js | 39 ++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 Data-Structures/Linked-List/MergeTwoSortedLinkedLists.js create mode 100644 Data-Structures/Linked-List/test/MergeTwoSortedLinkedLists.test.js diff --git a/Data-Structures/Linked-List/MergeTwoSortedLinkedLists.js b/Data-Structures/Linked-List/MergeTwoSortedLinkedLists.js new file mode 100644 index 0000000000..df11c0ac2c --- /dev/null +++ b/Data-Structures/Linked-List/MergeTwoSortedLinkedLists.js @@ -0,0 +1,45 @@ +import { LinkedList } from './SinglyLinkedList.js' +/** + * A LinkedList-based solution for merging two sorted linked lists into one sorted list. + * + * @param {LinkedList} list1 - The the first sorted linked list. + * @param {LinkedList} list2 - The second sorted linked list. + * @returns {LinkedList} - The merged sorted linked list. + * + * @example + * const list1 = new LinkedList([1,2,4]); + * + * const list2 = new LinkedList([1,3,4]); + * + * const result = mergeLinkedLists(list1, list2); + * // Returns the merged linked list representing 1 -> 1 -> 2 -> 3 -> 4 -> 4 + */ + +function mergeLinkedLists(list1, list2) { + const mergedList = new LinkedList() + + let current1 = list1.headNode + let current2 = list2.headNode + + while (current1 || current2) { + if (!current1) { + mergedList.addLast(current2.data) + current2 = current2.next + } else if (!current2) { + mergedList.addLast(current1.data) + current1 = current1.next + } else { + if (current1.data < current2.data) { + mergedList.addLast(current1.data) + current1 = current1.next + } else { + mergedList.addLast(current2.data) + current2 = current2.next + } + } + } + + return mergedList +} + +export { mergeLinkedLists } diff --git a/Data-Structures/Linked-List/test/MergeTwoSortedLinkedLists.test.js b/Data-Structures/Linked-List/test/MergeTwoSortedLinkedLists.test.js new file mode 100644 index 0000000000..bc5bea953e --- /dev/null +++ b/Data-Structures/Linked-List/test/MergeTwoSortedLinkedLists.test.js @@ -0,0 +1,39 @@ +import { expect } from 'vitest' +import { mergeLinkedLists } from '../MergeTwoSortedLinkedLists.js' +import { LinkedList } from '../SinglyLinkedList.js' + +describe('MergeTwoSortedLinkedLists', () => { + it('Merges two sorted linked lists', () => { + const list1 = new LinkedList([1, 2, 4]) + + const list2 = new LinkedList([1, 3, 4]) + + const expectedResult = new LinkedList([1, 1, 2, 3, 4, 4]) + + const result = mergeLinkedLists(list1, list2) + + expect(result).toEqual(expectedResult) + }) + + it('Merges two empty linked lists', () => { + const list1 = new LinkedList() + const list2 = new LinkedList() + + const expectedResult = new LinkedList() + + const result = mergeLinkedLists(list1, list2) + + expect(result).toEqual(expectedResult) + }) + + it('Merges one empty linked list with a non-empty one', () => { + const list1 = new LinkedList() + const list2 = new LinkedList([1]) + + const expectedResult = new LinkedList([1]) + + const result = mergeLinkedLists(list1, list2) + + expect(result).toEqual(expectedResult) + }) +}) From ce86248b1e1d747866d74b0fbf518c81de55f40d Mon Sep 17 00:00:00 2001 From: Piyush Katyal <109459034+piyushk77@users.noreply.github.com> Date: Wed, 11 Oct 2023 11:45:47 +0530 Subject: [PATCH 044/122] feat: add RGB to HSL color format conversion algorithm (#1475) * feat: add RGB to HSL color format conversion algorithm * test: add self-tests for rgb to hsl conversion algorithm * fix: change function code to concise format * fix: use throw and segregate the test cases * chore: clean up the test format * chore: use correct styling --- Conversions/RgbHslConversion.js | 85 +++++++++++++++++++++++ Conversions/test/RgbHslConversion.test.js | 43 ++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 Conversions/RgbHslConversion.js create mode 100644 Conversions/test/RgbHslConversion.test.js diff --git a/Conversions/RgbHslConversion.js b/Conversions/RgbHslConversion.js new file mode 100644 index 0000000000..7e014f1318 --- /dev/null +++ b/Conversions/RgbHslConversion.js @@ -0,0 +1,85 @@ +/** + * Given a color in RGB format, convert it to HSL format. + * + * For more info: https://www.niwa.nu/2013/05/math-behind-colorspace-conversions-rgb-hsl/ + * + * @param {number[]} colorRgb - One dimensional array of integers (RGB color format). + * @returns {number[]} - One dimensional array of integers (HSL color format). + * + * @example + * const colorRgb = [24, 98, 118] + * + * const result = rgbToHsl(colorRgb) + * + * // The function returns the corresponding color in HSL format: + * // result = [193, 66, 28] + */ + +const checkRgbFormat = (colorRgb) => colorRgb.every((c) => c >= 0 && c <= 255) + +const rgbToHsl = (colorRgb) => { + if (!checkRgbFormat(colorRgb)) { + throw new Error('Input is not a valid RGB color.') + } + + let colorHsl = colorRgb + + let red = Math.round(colorRgb[0]) + let green = Math.round(colorRgb[1]) + let blue = Math.round(colorRgb[2]) + + const limit = 255 + + colorHsl[0] = red / limit + colorHsl[1] = green / limit + colorHsl[2] = blue / limit + + let minValue = Math.min(...colorHsl) + let maxValue = Math.max(...colorHsl) + + let channel = 0 + + if (maxValue === colorHsl[1]) { + channel = 1 + } else if (maxValue === colorHsl[2]) { + channel = 2 + } + + let luminance = (minValue + maxValue) / 2 + + let saturation = 0 + + if (minValue !== maxValue) { + if (luminance <= 0.5) { + saturation = (maxValue - minValue) / (maxValue + minValue) + } else { + saturation = (maxValue - minValue) / (2 - maxValue - minValue) + } + } + + let hue = 0 + + if (saturation !== 0) { + if (channel === 0) { + hue = (colorHsl[1] - colorHsl[2]) / (maxValue - minValue) + } else if (channel === 1) { + hue = 2 + (colorHsl[2] - colorHsl[0]) / (maxValue - minValue) + } else { + hue = 4 + (colorHsl[0] - colorHsl[1]) / (maxValue - minValue) + } + } + + hue *= 60 + + if (hue < 0) { + hue += 360 + } + + colorHsl[0] = Math.round(hue) + colorHsl[1] = Math.round(saturation * 100) + colorHsl[2] = Math.round(luminance * 100) + + return colorHsl +} + +export { rgbToHsl } diff --git a/Conversions/test/RgbHslConversion.test.js b/Conversions/test/RgbHslConversion.test.js new file mode 100644 index 0000000000..5dec4835cd --- /dev/null +++ b/Conversions/test/RgbHslConversion.test.js @@ -0,0 +1,43 @@ +import { rgbToHsl } from '../RgbHslConversion' +describe('RgbHslConversion', () => { + test.each([ + [ + [215, 19, 180], + [311, 84, 46] + ], + [ + [21, 190, 18], + [119, 83, 41] + ], + [ + [80, 100, 160], + [225, 33, 47] + ], + [ + [80, 1, 16], + [349, 98, 16] + ], + [ + [8, 20, 0], + [96, 100, 4] + ], + [ + [0, 0, 0], + [0, 0, 0] + ], + [ + [255, 255, 255], + [0, 0, 100] + ] + ])('Should return the color in HSL format.', (colorRgb, expected) => { + expect(rgbToHsl(colorRgb)).toEqual(expected) + }) + + test.each([ + [[256, 180, 9], 'Input is not a valid RGB color.'], + [[-90, 46, 8], 'Input is not a valid RGB color.'], + [[1, 39, 900], 'Input is not a valid RGB color.'] + ])('Should return the error message.', (colorRgb, expected) => { + expect(() => rgbToHsl(colorRgb)).toThrowError(expected) + }) +}) From 05e32481fabed70a4d068a73d6af306b8a9abb1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20M=C3=BCller?= <34514239+appgurueu@users.noreply.github.com> Date: Thu, 12 Oct 2023 08:32:18 +0200 Subject: [PATCH 045/122] chore: format code (#1515) * chore: format code * Updated Documentation in README.md --------- Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> --- DIRECTORY.md | 9 ++++- Data-Structures/Heap/test/BinaryHeap.test.js | 2 +- Data-Structures/Stack/EvaluateExpression.js | 40 +++++++++---------- .../Stack/test/EvaluateExpression.test.js | 29 +++++++------- Maths/test/Determinant.test.js | 9 ++--- 5 files changed, 45 insertions(+), 44 deletions(-) diff --git a/DIRECTORY.md b/DIRECTORY.md index a7e5fe2c6c..aea7b1548f 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -9,6 +9,7 @@ * [SumOfSubset](Backtracking/SumOfSubset.js) * **Bit-Manipulation** * [BinaryCountSetBits](Bit-Manipulation/BinaryCountSetBits.js) + * [GrayCodes](Bit-Manipulation/GrayCodes.js) * [IsPowerofFour](Bit-Manipulation/IsPowerofFour.js) * [IsPowerOfTwo](Bit-Manipulation/IsPowerOfTwo.js) * [LogTwo](Bit-Manipulation/LogTwo.js) @@ -55,6 +56,7 @@ * [OctToDecimal](Conversions/OctToDecimal.js) * [OuncesToKilograms](Conversions/OuncesToKilograms.js) * [RailwayTimeConversion](Conversions/RailwayTimeConversion.js) + * [RgbHslConversion](Conversions/RgbHslConversion.js) * [RgbHsvConversion](Conversions/RgbHsvConversion.js) * [RGBToHex](Conversions/RGBToHex.js) * [RomanToDecimal](Conversions/RomanToDecimal.js) @@ -72,14 +74,14 @@ * [Graph2](Data-Structures/Graph/Graph2.js) * [Graph3](Data-Structures/Graph/Graph3.js) * **Heap** + * [BinaryHeap](Data-Structures/Heap/BinaryHeap.js) * [KeyPriorityQueue](Data-Structures/Heap/KeyPriorityQueue.js) - * [MaxHeap](Data-Structures/Heap/MaxHeap.js) - * [MinHeap](Data-Structures/Heap/MinHeap.js) * [MinPriorityQueue](Data-Structures/Heap/MinPriorityQueue.js) * **Linked-List** * [AddTwoNumbers](Data-Structures/Linked-List/AddTwoNumbers.js) * [CycleDetection](Data-Structures/Linked-List/CycleDetection.js) * [DoublyLinkedList](Data-Structures/Linked-List/DoublyLinkedList.js) + * [MergeTwoSortedLinkedLists](Data-Structures/Linked-List/MergeTwoSortedLinkedLists.js) * [ReverseSinglyLinkedList](Data-Structures/Linked-List/ReverseSinglyLinkedList.js) * [SinglyCircularLinkedList](Data-Structures/Linked-List/SinglyCircularLinkedList.js) * [SinglyLinkedList](Data-Structures/Linked-List/SinglyLinkedList.js) @@ -88,6 +90,7 @@ * [Queue](Data-Structures/Queue/Queue.js) * [QueueUsing2Stacks](Data-Structures/Queue/QueueUsing2Stacks.js) * **Stack** + * [EvaluateExpression](Data-Structures/Stack/EvaluateExpression.js) * [Stack](Data-Structures/Stack/Stack.js) * [StackES6](Data-Structures/Stack/StackES6.js) * **Tree** @@ -179,6 +182,7 @@ * [DecimalExpansion](Maths/DecimalExpansion.js) * [DecimalIsolate](Maths/DecimalIsolate.js) * [DegreeToRadian](Maths/DegreeToRadian.js) + * [Determinant](Maths/Determinant.js) * [EuclideanDistance](Maths/EuclideanDistance.js) * [EulerMethod](Maths/EulerMethod.js) * [EulersTotient](Maths/EulersTotient.js) @@ -239,6 +243,7 @@ * [RadianToDegree](Maths/RadianToDegree.js) * [ReverseNumber](Maths/ReverseNumber.js) * [ReversePolishNotation](Maths/ReversePolishNotation.js) + * [RowEchelon](Maths/RowEchelon.js) * [ShorsAlgorithm](Maths/ShorsAlgorithm.js) * [SieveOfEratosthenes](Maths/SieveOfEratosthenes.js) * [SieveOfEratosthenesIntArray](Maths/SieveOfEratosthenesIntArray.js) diff --git a/Data-Structures/Heap/test/BinaryHeap.test.js b/Data-Structures/Heap/test/BinaryHeap.test.js index 56aef11e02..aef538d9fa 100644 --- a/Data-Structures/Heap/test/BinaryHeap.test.js +++ b/Data-Structures/Heap/test/BinaryHeap.test.js @@ -36,7 +36,7 @@ describe('BinaryHeap', () => { it('should handle insertion of duplicate values', () => { // Check if the heap handles duplicate values correctly minHeap.insert(2) - console.log(minHeap.heap); + console.log(minHeap.heap) expect(minHeap.heap).toEqual([1, 3, 2, 4, 8, 6, 2]) }) diff --git a/Data-Structures/Stack/EvaluateExpression.js b/Data-Structures/Stack/EvaluateExpression.js index e59a4a37c0..f8e976e16e 100644 --- a/Data-Structures/Stack/EvaluateExpression.js +++ b/Data-Structures/Stack/EvaluateExpression.js @@ -6,53 +6,53 @@ * @returns {number|null} - Result of the expression evaluation, or null if the expression is invalid. */ function evaluatePostfixExpression(expression) { - const stack = []; + const stack = [] // Helper function to perform an operation and push the result to the stack. Returns success. function performOperation(operator) { - const rightOp = stack.pop(); // Right operand is the top of the stack - const leftOp = stack.pop(); // Left operand is the next item on the stack + const rightOp = stack.pop() // Right operand is the top of the stack + const leftOp = stack.pop() // Left operand is the next item on the stack if (leftOp === undefined || rightOp === undefined) { - return false; // Invalid expression + return false // Invalid expression } switch (operator) { case '+': - stack.push(leftOp + rightOp); - break; + stack.push(leftOp + rightOp) + break case '-': - stack.push(leftOp - rightOp); - break; + stack.push(leftOp - rightOp) + break case '*': - stack.push(leftOp * rightOp); - break; + stack.push(leftOp * rightOp) + break case '/': if (rightOp === 0) { - return false; + return false } - stack.push(leftOp / rightOp); - break; + stack.push(leftOp / rightOp) + break default: - return false; // Unknown operator + return false // Unknown operator } - return true; + return true } - const tokens = expression.split(/\s+/); + const tokens = expression.split(/\s+/) for (const token of tokens) { if (!isNaN(parseFloat(token))) { // If the token is a number, push it to the stack - stack.push(parseFloat(token)); + stack.push(parseFloat(token)) } else { // If the token is an operator, perform the operation if (!performOperation(token)) { - return null; // Invalid expression + return null // Invalid expression } } } - return (stack.length === 1) ? stack[0] : null; + return stack.length === 1 ? stack[0] : null } -export { evaluatePostfixExpression }; +export { evaluatePostfixExpression } diff --git a/Data-Structures/Stack/test/EvaluateExpression.test.js b/Data-Structures/Stack/test/EvaluateExpression.test.js index eea764cac2..69a2e16365 100644 --- a/Data-Structures/Stack/test/EvaluateExpression.test.js +++ b/Data-Structures/Stack/test/EvaluateExpression.test.js @@ -1,22 +1,21 @@ -import { evaluatePostfixExpression } from '../EvaluateExpression.js'; +import { evaluatePostfixExpression } from '../EvaluateExpression.js' describe('evaluatePostfixExpression', () => { it('should evaluate a valid expression', () => { - const expression = '3 4 * 2 / 5 +'; // (3 * 4) / 2 + 5 = 11 - const result = evaluatePostfixExpression(expression); - expect(result).toBe(11); - }); + const expression = '3 4 * 2 / 5 +' // (3 * 4) / 2 + 5 = 11 + const result = evaluatePostfixExpression(expression) + expect(result).toBe(11) + }) it('should handle division by zero', () => { - const expression = '3 0 /'; // Division by zero - const result = evaluatePostfixExpression(expression); - expect(result).toBe(null); - }); + const expression = '3 0 /' // Division by zero + const result = evaluatePostfixExpression(expression) + expect(result).toBe(null) + }) it('should handle an invalid expression', () => { - const expression = '3 * 4 2 / +'; // Invalid expression - const result = evaluatePostfixExpression(expression); - expect(result).toBe(null); - }); - -}); + const expression = '3 * 4 2 / +' // Invalid expression + const result = evaluatePostfixExpression(expression) + expect(result).toBe(null) + }) +}) diff --git a/Maths/test/Determinant.test.js b/Maths/test/Determinant.test.js index df9d34df83..f6cba8241c 100644 --- a/Maths/test/Determinant.test.js +++ b/Maths/test/Determinant.test.js @@ -54,10 +54,7 @@ describe('Determinant', () => { 'Square matrix is required.' ], [[1, 3, 2, [5, 8, 6], 3], 'Input is not a valid 2D matrix.'] - ])( - 'Should return the error message.', - (matrix, expected) => { - expect(() => determinant(matrix)).toThrowError(expected) - } - ) + ])('Should return the error message.', (matrix, expected) => { + expect(() => determinant(matrix)).toThrowError(expected) + }) }) From 410009157d66a058bead4590ddd50c0c6c06ab7d Mon Sep 17 00:00:00 2001 From: Pratik Tripathy <117454569+SilverDragonOfR@users.noreply.github.com> Date: Fri, 13 Oct 2023 00:23:40 +0530 Subject: [PATCH 046/122] feat: add Automorphic Numbers and tests in Math (#1496) * feat: add automorphic number and tests * fix: add spaces * fix: merge tests with test.each --- Maths/AutomorphicNumber.js | 40 ++++++++++++++++++++++++++++ Maths/test/AutomorphicNumber.test.js | 28 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 Maths/AutomorphicNumber.js create mode 100644 Maths/test/AutomorphicNumber.test.js diff --git a/Maths/AutomorphicNumber.js b/Maths/AutomorphicNumber.js new file mode 100644 index 0000000000..d1b6608316 --- /dev/null +++ b/Maths/AutomorphicNumber.js @@ -0,0 +1,40 @@ +/** + * @function isAutomorphic + * @author [SilverDragonOfR] (https://github.com/SilverDragonOfR) + * + * @see [Automorphic] (https://en.wikipedia.org/wiki/Automorphic_number) + * @description This script will check whether a number is Automorphic or not + * @description A number n is said to be a Automorphic number if the square of n ends in the same digits as n itself. + * + * @param {Integer} n - the n for nth Catalan Number + * @return {Integer} - the nth Catalan Number + * @complexity Time: O(log10(n)) , Space: O(1) + * + * @convention We define Automorphic only for whole number integers. For negetive integer we return False. For float or String we show error. + * @examples 0, 1, 5, 6, 25, 76, 376, 625, 9376 are some Automorphic numbers + */ + +// n is the number to be checked +export const isAutomorphic = (n) => { + if (typeof n !== 'number') { + throw new Error('Type of n must be number') + } + if (!Number.isInteger(n)) { + throw new Error('n cannot be a floating point number') + } + if (n < 0) { + return false + } + + // now n is a whole number integer >= 0 + let n_sq = n * n + while (n > 0) { + if (n % 10 !== n_sq % 10) { + return false + } + n = Math.floor(n / 10) + n_sq = Math.floor(n_sq / 10) + } + + return true +} diff --git a/Maths/test/AutomorphicNumber.test.js b/Maths/test/AutomorphicNumber.test.js new file mode 100644 index 0000000000..19b963388c --- /dev/null +++ b/Maths/test/AutomorphicNumber.test.js @@ -0,0 +1,28 @@ +import { isAutomorphic } from '../AutomorphicNumber' + +describe('AutomorphicNumber', () => { + it('should throw Error when n is String', () => { + expect(() => isAutomorphic('qwerty')).toThrow() + }) + it('should throw Error when n is floating point', () => { + expect(() => isAutomorphic(13.6)).toThrow() + }) + + test.each([ + { n: -3 , expected: false }, + { n: -25 , expected: false }, + ])('should return false when n is negetive', ({ n, expected }) => { + expect(isAutomorphic(n)).toBe(false) + }) + + test.each([ + { n: 7 , expected: false }, + { n: 83 , expected: false }, + { n: 0 , expected: true }, + { n: 1 , expected: true }, + { n: 376 , expected: true }, + { n: 90625 , expected: true }, + ])('should return $expected when n is $n', ({ n, expected }) => { + expect(isAutomorphic(n)).toBe(expected) + }) +}) From f77a970c7892fc092a25f11cd635e8bd43a1330b Mon Sep 17 00:00:00 2001 From: maruf hasan Date: Fri, 13 Oct 2023 20:10:29 +0600 Subject: [PATCH 047/122] updated BinaryHeap.test.js (#1520) there was a console.log, which is not necessary for test cases. --- Data-Structures/Heap/test/BinaryHeap.test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/Data-Structures/Heap/test/BinaryHeap.test.js b/Data-Structures/Heap/test/BinaryHeap.test.js index aef538d9fa..ee9d5a0570 100644 --- a/Data-Structures/Heap/test/BinaryHeap.test.js +++ b/Data-Structures/Heap/test/BinaryHeap.test.js @@ -36,7 +36,6 @@ describe('BinaryHeap', () => { it('should handle insertion of duplicate values', () => { // Check if the heap handles duplicate values correctly minHeap.insert(2) - console.log(minHeap.heap) expect(minHeap.heap).toEqual([1, 3, 2, 4, 8, 6, 2]) }) From 628c5aeb5c795ca0b54ad9a1f39a7f79fc7680af Mon Sep 17 00:00:00 2001 From: Omar Ferreiro <27824673+IcarusTheFly@users.noreply.github.com> Date: Sat, 14 Oct 2023 18:53:23 +0200 Subject: [PATCH 048/122] chore: remove unnecessary code (#1531) Co-authored-by: IcarusTheFly --- Search/InterpolationSearch.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Search/InterpolationSearch.js b/Search/InterpolationSearch.js index 1064268d30..e6deae496f 100644 --- a/Search/InterpolationSearch.js +++ b/Search/InterpolationSearch.js @@ -36,11 +36,4 @@ export function interpolationSearch(arr, key) { } return -1 -} - -// const arr = [2, 6, 8, 10, 12, 14, 16, 18, 20, 22, 26, 34, 39] - -// interpolationSearch(arr, 2) -// interpolationSearch(arr, 12) -// interpolationSearch(arr, 1000) -// interpolationSearch(arr, 39) +} \ No newline at end of file From 46362e3d473c52fabe12231df5a0eb28ccf18ab1 Mon Sep 17 00:00:00 2001 From: Rahul Bhandari <90493221+imrahulkb@users.noreply.github.com> Date: Sat, 14 Oct 2023 22:24:11 +0530 Subject: [PATCH 049/122] chore: count set bits using bitwise ops (#1532) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update BinaryCountSetBits.js * Use `let` instead of `var` --------- Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --- Bit-Manipulation/BinaryCountSetBits.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Bit-Manipulation/BinaryCountSetBits.js b/Bit-Manipulation/BinaryCountSetBits.js index e0a6d9414c..b879f3bd67 100644 --- a/Bit-Manipulation/BinaryCountSetBits.js +++ b/Bit-Manipulation/BinaryCountSetBits.js @@ -14,8 +14,13 @@ function BinaryCountSetBits(a) { if (!Number.isInteger(a)) throw new TypeError('Argument not an Integer') - // convert number into binary representation and return number of set bits in binary representation - return a.toString(2).split('1').length - 1 + let count = 0 + while (a) { + a &= (a - 1) + count++ + } + + return count } export { BinaryCountSetBits } From ad0bde6ddb46fed08e96b94b14f57e12557e23de Mon Sep 17 00:00:00 2001 From: Rahul Bhandari <90493221+imrahulkb@users.noreply.github.com> Date: Sun, 15 Oct 2023 20:42:09 +0530 Subject: [PATCH 050/122] Update Problem006.js (#1537) --- Project-Euler/Problem006.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Project-Euler/Problem006.js b/Project-Euler/Problem006.js index 58f5e2fbc1..474de2ae96 100644 --- a/Project-Euler/Problem006.js +++ b/Project-Euler/Problem006.js @@ -1,11 +1,8 @@ // https://projecteuler.net/problem=6 export const squareDifference = (num = 100) => { - let sumOfSquares = 0 - let sums = 0 - for (let i = 1; i <= num; i++) { - sumOfSquares += i ** 2 // add squares to the sum of squares - sums += i // add number to sum to square later - } + let sumOfSquares = (num)*(num+1)*(2*num+1)/6 + let sums = (num*(num+1))/2 + return sums ** 2 - sumOfSquares // difference of square of the total sum and sum of squares } From 0315c8a5387a26fdb54ad5809927a47f24d54c0b Mon Sep 17 00:00:00 2001 From: Manpreet Singh <63737630+ManpreetSingh2004@users.noreply.github.com> Date: Sun, 15 Oct 2023 22:31:55 +0530 Subject: [PATCH 051/122] docs: fix typo in rotateRight's docstring (#1527) --- Hashes/SHA256.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Hashes/SHA256.js b/Hashes/SHA256.js index d046b9966e..25e1a865c9 100644 --- a/Hashes/SHA256.js +++ b/Hashes/SHA256.js @@ -59,14 +59,14 @@ function chunkify(str, size) { } /** - * Rotates string representation of bits to th left + * Rotates string representation of bits to the right * * @param {string} bits - string representation of bits * @param {int} turns - number of rotations to make * @return {string} - string representation of bits after rotation * * @example - * rotateLeft("1011", 3); // "1101" + * rotateRight("1011", 3); // "1101" */ function rotateRight(bits, turns) { return bits.substr(bits.length - turns) + bits.substr(0, bits.length - turns) From 60443c7effe51b6a677d8383a7e4896eff14aa3b Mon Sep 17 00:00:00 2001 From: malpotra <56645001+malpotra@users.noreply.github.com> Date: Sun, 22 Oct 2023 23:10:53 +0530 Subject: [PATCH 052/122] test: add tests for Binary Equivalent Algorithm (#1560) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test: add tests for Binary Equivalent Algorithm * test: Refactored tests using .each() * Update BinaryEquivalent.test.js --------- Co-authored-by: {Harshit Malpotra} <{malpotra.harshit@gmail.com}> Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --- Recursive/test/BinaryEquivalent.test.js | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Recursive/test/BinaryEquivalent.test.js diff --git a/Recursive/test/BinaryEquivalent.test.js b/Recursive/test/BinaryEquivalent.test.js new file mode 100644 index 0000000000..b79a455eed --- /dev/null +++ b/Recursive/test/BinaryEquivalent.test.js @@ -0,0 +1,29 @@ +import { binaryEquivalent } from "../BinaryEquivalent"; + +const tests = [ + { + test: 2, + expectedValue: "10" + }, + { + test: 0, + expectedValue: "0" + }, + { + test: 543, + expectedValue: "1000011111" + }, + { + test: 4697621023, + expectedValue: "100011000000000000000001000011111" + } +] + +describe("Binary Equivalent", () => { + test.each(tests)( + "of $test should be $expectedValue", + ({test, expectedValue}) => { + expect(binaryEquivalent(test)).toBe(expectedValue); + } + ) +}) From 7d7f109e6fe36e901aff06750d89788ee7be5f3a Mon Sep 17 00:00:00 2001 From: Hardik Pawar <97388607+Hardvan@users.noreply.github.com> Date: Tue, 24 Oct 2023 12:18:13 +0530 Subject: [PATCH 053/122] Enhance readability of KnightTour (#1572) --- Backtracking/KnightTour.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Backtracking/KnightTour.js b/Backtracking/KnightTour.js index 36f400160d..5f81ca345a 100644 --- a/Backtracking/KnightTour.js +++ b/Backtracking/KnightTour.js @@ -2,12 +2,13 @@ class OpenKnightTour { constructor(size) { + // Constructor to initialize the chessboard and size this.board = new Array(size).fill(0).map(() => new Array(size).fill(0)) this.size = size } getMoves([i, j]) { - // helper function to get the valid moves of the knight from the current position + // Helper function to get the valid moves of the knight from the current position const moves = [ [i + 2, j - 1], [i + 2, j + 1], @@ -19,18 +20,19 @@ class OpenKnightTour { [i - 1, j + 2] ] + // Filter out moves that are within the board boundaries return moves.filter( ([y, x]) => y >= 0 && y < this.size && x >= 0 && x < this.size ) } isComplete() { - // helper function to check if the board is complete + // Helper function to check if the board is complete return !this.board.map((row) => row.includes(0)).includes(true) } solve() { - // function to find the solution for the given board + // Function to find the solution for the given board for (let i = 0; i < this.size; i++) { for (let j = 0; j < this.size; j++) { if (this.solveHelper([i, j], 0)) return true @@ -40,14 +42,15 @@ class OpenKnightTour { } solveHelper([i, j], curr) { - // helper function for the main computation + // Helper function for the main computation if (this.isComplete()) return true + // Iterate through possible moves and attempt to fill the board for (const [y, x] of this.getMoves([i, j])) { if (this.board[y][x] === 0) { this.board[y][x] = curr + 1 if (this.solveHelper([y, x], curr + 1)) return true - // backtracking + // Backtracking: If the solution is not found, reset the cell to 0 this.board[y][x] = 0 } } @@ -55,7 +58,7 @@ class OpenKnightTour { } printBoard(output = (value) => console.log(value)) { - // utility function to display the board + // Utility function to display the board for (const row of this.board) { let string = '' for (const elem of row) { From fb134b10b0521d01ade8da215803d34d9fafd8e8 Mon Sep 17 00:00:00 2001 From: Vedas Dixit <111585043+vedas-dixit@users.noreply.github.com> Date: Tue, 24 Oct 2023 12:18:59 +0530 Subject: [PATCH 054/122] Implemented M Coloring Problem (#1562) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Implemented M Coloring Problem * Implemented M Coloring Problem * Switch to a functional approach instead of class-based. Use proper JSDoc comments. Refine the comments and remove redundancies. * Updated Documentation in README.md * Proper JSDoc comment --------- Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --- Backtracking/MColoringProblem.js | 49 +++++++++++++++++++++ Backtracking/tests/MColoringProblem.test.js | 23 ++++++++++ DIRECTORY.md | 2 + 3 files changed, 74 insertions(+) create mode 100644 Backtracking/MColoringProblem.js create mode 100644 Backtracking/tests/MColoringProblem.test.js diff --git a/Backtracking/MColoringProblem.js b/Backtracking/MColoringProblem.js new file mode 100644 index 0000000000..c89f30e043 --- /dev/null +++ b/Backtracking/MColoringProblem.js @@ -0,0 +1,49 @@ +/** + * Colors a graph using up to m colors such that no two adjacent vertices share the same color. + * @param {number[][]} graph - Adjacency matrix of the graph, using 0 for no edge. + * @param {number} m - The number of colors to use. + * @returns {?Array.} A valid M-coloring of the graph using colors 1 to m, or null if none exists. + * @see https://en.wikipedia.org/wiki/Graph_coloring + */ +function mColoring(graph, m) { + const colors = new Array(graph.length).fill(0); + + // Check if it's safe to color a vertex with a given color. + function isSafe(vertex, color) { + for (let i = 0; i < graph.length; i++) { + if (graph[vertex][i] && colors[i] === color) { + return false; + } + } + return true; + } + + // Use backtracking to try and color the graph. + function solveColoring(vertex = 0) { + if (vertex === graph.length) { + return true; + } + + for (let color = 1; color <= m; color++) { + if (isSafe(vertex, color)) { + colors[vertex] = color; + + if (solveColoring(vertex + 1)) { + return true; + } + + // If no solution, backtrack. + colors[vertex] = 0; + } + } + return false; + } + + // If coloring is possible, return the colors. + if (solveColoring()) { + return colors; + } + return null; +} + +export { mColoring }; diff --git a/Backtracking/tests/MColoringProblem.test.js b/Backtracking/tests/MColoringProblem.test.js new file mode 100644 index 0000000000..d98134b62a --- /dev/null +++ b/Backtracking/tests/MColoringProblem.test.js @@ -0,0 +1,23 @@ +import { mColoring } from '../MColoringProblem'; + +describe('MColoringProblem', () => { + it('should color a triangle with 3 colors', () => { + const graph = [ + [0, 1, 1], + [1, 0, 1], + [1, 1, 0] + ]; + const solution = mColoring(graph, 3); + expect(solution).not.toBeNull(); + }); + + it('should not color a triangle with 2 colors', () => { + const graph = [ + [0, 1, 1], + [1, 0, 1], + [1, 1, 0] + ]; + const solution = mColoring(graph, 2); + expect(solution).toBeNull(); + }); +}); diff --git a/DIRECTORY.md b/DIRECTORY.md index aea7b1548f..61fa501119 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -3,6 +3,7 @@ * [generateParentheses](Backtracking/generateParentheses.js) * [GeneratePermutations](Backtracking/GeneratePermutations.js) * [KnightTour](Backtracking/KnightTour.js) + * [MColoringProblem](Backtracking/MColoringProblem.js) * [NQueens](Backtracking/NQueens.js) * [RatInAMaze](Backtracking/RatInAMaze.js) * [Sudoku](Backtracking/Sudoku.js) @@ -166,6 +167,7 @@ * [Area](Maths/Area.js) * [ArithmeticGeometricMean](Maths/ArithmeticGeometricMean.js) * [ArmstrongNumber](Maths/ArmstrongNumber.js) + * [AutomorphicNumber](Maths/AutomorphicNumber.js) * [AverageMean](Maths/AverageMean.js) * [AverageMedian](Maths/AverageMedian.js) * [BinaryConvert](Maths/BinaryConvert.js) From 9a875264cc526a874defd09544a8bcfd7d3f6212 Mon Sep 17 00:00:00 2001 From: Omkarnath Parida Date: Tue, 24 Oct 2023 22:49:37 +0530 Subject: [PATCH 055/122] prettier fixes & added test cases for Project Euler problem 4 (#1566) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 📦 NEW: Added solution for ProjectEuler-007 * 🐛 FIX: Spelling mistake fixes * 👌 IMPROVE: changed variable name from `inc` to `candidateValue` and thrown error in case of invalid input * 👌 IMPROVE: Modified the code * 👌 IMPROVE: Added test case for ProjectEuler Problem001 * 👌 IMPROVE: Added test cases for Project Euler Problem 4 * 👌 IMPROVE: auto prettier fixes --------- Co-authored-by: Omkarnath Parida --- Bit-Manipulation/BinaryCountSetBits.js | 2 +- Maths/AutomorphicNumber.js | 2 +- Maths/test/AutomorphicNumber.test.js | 16 ++++----- Project-Euler/Problem006.js | 6 ++-- Project-Euler/test/Problem004.test.js | 11 ++++++ Recursive/test/BinaryEquivalent.test.js | 48 ++++++++++++------------- Search/InterpolationSearch.js | 2 +- 7 files changed, 49 insertions(+), 38 deletions(-) create mode 100644 Project-Euler/test/Problem004.test.js diff --git a/Bit-Manipulation/BinaryCountSetBits.js b/Bit-Manipulation/BinaryCountSetBits.js index b879f3bd67..b959caf062 100644 --- a/Bit-Manipulation/BinaryCountSetBits.js +++ b/Bit-Manipulation/BinaryCountSetBits.js @@ -16,7 +16,7 @@ function BinaryCountSetBits(a) { let count = 0 while (a) { - a &= (a - 1) + a &= a - 1 count++ } diff --git a/Maths/AutomorphicNumber.js b/Maths/AutomorphicNumber.js index d1b6608316..ba008271fc 100644 --- a/Maths/AutomorphicNumber.js +++ b/Maths/AutomorphicNumber.js @@ -35,6 +35,6 @@ export const isAutomorphic = (n) => { n = Math.floor(n / 10) n_sq = Math.floor(n_sq / 10) } - + return true } diff --git a/Maths/test/AutomorphicNumber.test.js b/Maths/test/AutomorphicNumber.test.js index 19b963388c..57f40d27ee 100644 --- a/Maths/test/AutomorphicNumber.test.js +++ b/Maths/test/AutomorphicNumber.test.js @@ -9,19 +9,19 @@ describe('AutomorphicNumber', () => { }) test.each([ - { n: -3 , expected: false }, - { n: -25 , expected: false }, + { n: -3, expected: false }, + { n: -25, expected: false } ])('should return false when n is negetive', ({ n, expected }) => { expect(isAutomorphic(n)).toBe(false) }) test.each([ - { n: 7 , expected: false }, - { n: 83 , expected: false }, - { n: 0 , expected: true }, - { n: 1 , expected: true }, - { n: 376 , expected: true }, - { n: 90625 , expected: true }, + { n: 7, expected: false }, + { n: 83, expected: false }, + { n: 0, expected: true }, + { n: 1, expected: true }, + { n: 376, expected: true }, + { n: 90625, expected: true } ])('should return $expected when n is $n', ({ n, expected }) => { expect(isAutomorphic(n)).toBe(expected) }) diff --git a/Project-Euler/Problem006.js b/Project-Euler/Problem006.js index 474de2ae96..804b165558 100644 --- a/Project-Euler/Problem006.js +++ b/Project-Euler/Problem006.js @@ -1,8 +1,8 @@ // https://projecteuler.net/problem=6 export const squareDifference = (num = 100) => { - let sumOfSquares = (num)*(num+1)*(2*num+1)/6 - let sums = (num*(num+1))/2 - + let sumOfSquares = (num * (num + 1) * (2 * num + 1)) / 6 + let sums = (num * (num + 1)) / 2 + return sums ** 2 - sumOfSquares // difference of square of the total sum and sum of squares } diff --git a/Project-Euler/test/Problem004.test.js b/Project-Euler/test/Problem004.test.js new file mode 100644 index 0000000000..cd6a55ac98 --- /dev/null +++ b/Project-Euler/test/Problem004.test.js @@ -0,0 +1,11 @@ +import { largestPalindromic } from '../Problem004.js' + +describe('Largest Palindromic Number', () => { + test('if digit is 2', () => { + expect(largestPalindromic(2)).toBe(9009) + }) + // Project Euler Condition Check + test('if digit is 3', () => { + expect(largestPalindromic(3)).toBe(906609) + }) +}) diff --git a/Recursive/test/BinaryEquivalent.test.js b/Recursive/test/BinaryEquivalent.test.js index b79a455eed..ddabb7d477 100644 --- a/Recursive/test/BinaryEquivalent.test.js +++ b/Recursive/test/BinaryEquivalent.test.js @@ -1,29 +1,29 @@ -import { binaryEquivalent } from "../BinaryEquivalent"; +import { binaryEquivalent } from '../BinaryEquivalent' const tests = [ - { - test: 2, - expectedValue: "10" - }, - { - test: 0, - expectedValue: "0" - }, - { - test: 543, - expectedValue: "1000011111" - }, - { - test: 4697621023, - expectedValue: "100011000000000000000001000011111" - } + { + test: 2, + expectedValue: '10' + }, + { + test: 0, + expectedValue: '0' + }, + { + test: 543, + expectedValue: '1000011111' + }, + { + test: 4697621023, + expectedValue: '100011000000000000000001000011111' + } ] -describe("Binary Equivalent", () => { - test.each(tests)( - "of $test should be $expectedValue", - ({test, expectedValue}) => { - expect(binaryEquivalent(test)).toBe(expectedValue); - } - ) +describe('Binary Equivalent', () => { + test.each(tests)( + 'of $test should be $expectedValue', + ({ test, expectedValue }) => { + expect(binaryEquivalent(test)).toBe(expectedValue) + } + ) }) diff --git a/Search/InterpolationSearch.js b/Search/InterpolationSearch.js index e6deae496f..93f3b78b0e 100644 --- a/Search/InterpolationSearch.js +++ b/Search/InterpolationSearch.js @@ -36,4 +36,4 @@ export function interpolationSearch(arr, key) { } return -1 -} \ No newline at end of file +} From 9c07bb110758aae6316385c966b42add948b0586 Mon Sep 17 00:00:00 2001 From: Omkarnath Parida Date: Thu, 26 Oct 2023 19:04:20 +0530 Subject: [PATCH 056/122] Test cases project euler 9 (#1571) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 📦 NEW: Added solution for ProjectEuler-007 * 🐛 FIX: Spelling mistake fixes * 👌 IMPROVE: changed variable name from `inc` to `candidateValue` and thrown error in case of invalid input * 👌 IMPROVE: Modified the code * 👌 IMPROVE: Added test case for ProjectEuler Problem001 * 👌 IMPROVE: Added test cases for Project Euler Problem 4 * 👌 IMPROVE: auto prettier fixes * 👌 IMPROVE: Added test cases for project euler problem 9 * Updated Documentation in README.md * Updated Documentation in README.md --------- Co-authored-by: Omkarnath Parida Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> --- Project-Euler/test/Problem009.test.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Project-Euler/test/Problem009.test.js diff --git a/Project-Euler/test/Problem009.test.js b/Project-Euler/test/Problem009.test.js new file mode 100644 index 0000000000..3919fa2833 --- /dev/null +++ b/Project-Euler/test/Problem009.test.js @@ -0,0 +1,8 @@ +import { findSpecialPythagoreanTriplet } from '../Problem009.js' + +describe('Pythagorean Triplet', () => { + // Project Euler Condition Check + test('the multiplication of the pythagorean triplet where a + b + c = 1000', () => { + expect(findSpecialPythagoreanTriplet()).toBe(31875000) + }) +}) From f67cdc3cad62924de6c29083b7d2776f90655cbe Mon Sep 17 00:00:00 2001 From: Omkarnath Parida Date: Thu, 26 Oct 2023 19:05:34 +0530 Subject: [PATCH 057/122] Test cases project euler 6 (#1570) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 📦 NEW: Added solution for ProjectEuler-007 * 🐛 FIX: Spelling mistake fixes * 👌 IMPROVE: changed variable name from `inc` to `candidateValue` and thrown error in case of invalid input * 👌 IMPROVE: Modified the code * 👌 IMPROVE: Added test case for ProjectEuler Problem001 * 👌 IMPROVE: Added test cases for Project Euler Problem 4 * 👌 IMPROVE: auto prettier fixes * 👌 IMPROVE: added test cases for project euler problem 6 * Updated Documentation in README.md * Updated Documentation in README.md --------- Co-authored-by: Omkarnath Parida Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> --- Project-Euler/test/Problem006.test.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Project-Euler/test/Problem006.test.js diff --git a/Project-Euler/test/Problem006.test.js b/Project-Euler/test/Problem006.test.js new file mode 100644 index 0000000000..1323a34ac2 --- /dev/null +++ b/Project-Euler/test/Problem006.test.js @@ -0,0 +1,11 @@ +import { squareDifference } from '../Problem006.js' + +describe('Square Difference', () => { + test('difference between the sum of the squares of the first ten natural numbers and the square of the sum', () => { + expect(squareDifference(10)).toBe(2640) + }) + // Project Euler Condition Check + test('difference between the sum of the squares of the first one hundred natural numbers and the square of the sum', () => { + expect(squareDifference()).toBe(25164150) + }) +}) From d671327ebe63832434285ef96cabf255e11bf2cd Mon Sep 17 00:00:00 2001 From: Nikunj Bisht <52692588+Nikunj-bisht@users.noreply.github.com> Date: Thu, 26 Oct 2023 19:08:19 +0530 Subject: [PATCH 058/122] feat: added find subsets algorithm using bitmanipulation (#1514) * feat: added find subsets algorithm using bitmanipulation * file name fix * test file name fix * fix: codespell fix * error handled * added test cases for error --- Bit-Manipulation/GenerateSubSets.js | 34 ++++++++++++++++++ Bit-Manipulation/test/GenerateSubSets.test.js | 36 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 Bit-Manipulation/GenerateSubSets.js create mode 100644 Bit-Manipulation/test/GenerateSubSets.test.js diff --git a/Bit-Manipulation/GenerateSubSets.js b/Bit-Manipulation/GenerateSubSets.js new file mode 100644 index 0000000000..9ee131d757 --- /dev/null +++ b/Bit-Manipulation/GenerateSubSets.js @@ -0,0 +1,34 @@ +/** + * @function generateSubSets + * @param {Array} inputArray + * @returns {Array} + * @example [1,2] -> [[],[1],[2],[1,2]] + */ + +// The time complexity of this algorithm is BigO(2^n) where n is the length of array +function generateSubSets(inputArray) { + if (!Array.isArray(inputArray)) { + throw new Error('Provided input is not an array') + } + if (inputArray.length > 32) { + throw new RangeError('Error size should be less than equal to 32') + } + let arrayLength = inputArray.length + let subSets = [] + // loop till (2^n) - 1 + for (let i = 0; i < 1 << arrayLength; i++) { + let subSet = [] + for (let j = 0; j < arrayLength; j++) { + // 1 << j it shifts binary digit 1 by j positions and then we perform + // and by AND operation we are checking whetheer jth bit + // in i is set to 1 if result is non zero just add into set + if (i & (1 << j)) { + subSet.push(inputArray[j]) + } + } + subSets.push(subSet) + } + return subSets +} + +export { generateSubSets } diff --git a/Bit-Manipulation/test/GenerateSubSets.test.js b/Bit-Manipulation/test/GenerateSubSets.test.js new file mode 100644 index 0000000000..2e3b90ba71 --- /dev/null +++ b/Bit-Manipulation/test/GenerateSubSets.test.js @@ -0,0 +1,36 @@ +import { generateSubSets } from '../GenerateSubSets' + +describe('subSets', () => { + it('find the subsets', () => { + expect(generateSubSets([1, 2, 3])).toEqual([ + [], + [1], + [2], + [1, 2], + [3], + [1, 3], + [2, 3], + [1, 2, 3] + ]) + expect(generateSubSets([1, 2])).toEqual([[], [1], [2], [1, 2]]) + expect(generateSubSets([1, 2, 3])).toEqual([ + [], + [1], + [2], + [1, 2], + [3], + [1, 3], + [2, 3], + [1, 2, 3] + ]) + expect(() => generateSubSets('invalid')).toThrow( + 'Provided input is not an array' + ) + expect(() => + generateSubSets([ + 1, 2, 2, 1, 2, 3, 4, 3, 2, 3, 4, 3, 2, 2, 2, 3, 12, 11, 4, 2, 2, 2, 2, + 1, 2, 3, 5, 6, 7, 7, 8, 6, 5, 6, 7, 8, 9, 8, 0, 6 + ]) + ).toThrow('Error size should be less than equal to 32') + }) +}) From 0b9fad86ba60b4f76e4d68a27fa222e55ca65fdb Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Sat, 28 Oct 2023 00:50:16 +0200 Subject: [PATCH 059/122] fix: CI code style checking --- .github/workflows/Ci.yml | 2 +- package.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Ci.yml b/.github/workflows/Ci.yml index e08dcdb446..12093c2738 100644 --- a/.github/workflows/Ci.yml +++ b/.github/workflows/Ci.yml @@ -25,7 +25,7 @@ jobs: run: npm run test - name: 💄 Code style - run: npm run style + run: npm run check-style codespell: name: Check for spelling errors diff --git a/package.json b/package.json index 2dd45beac9..9ce6f3cb0f 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "test": "vitest run", "test-watch": "vitest", "style": "npx prettier . --write", + "check-style": "npx prettier . --check", "prepare": "husky install" }, "author": "TheAlgorithms", From 28c27d9474043b7fb9b6b3b4aa3cca015db2a090 Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Sat, 28 Oct 2023 00:56:39 +0200 Subject: [PATCH 060/122] chore: format using prettier --- Backtracking/MColoringProblem.js | 24 ++++++++++----------- Backtracking/tests/MColoringProblem.test.js | 20 ++++++++--------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Backtracking/MColoringProblem.js b/Backtracking/MColoringProblem.js index c89f30e043..d625b34a45 100644 --- a/Backtracking/MColoringProblem.js +++ b/Backtracking/MColoringProblem.js @@ -6,44 +6,44 @@ * @see https://en.wikipedia.org/wiki/Graph_coloring */ function mColoring(graph, m) { - const colors = new Array(graph.length).fill(0); + const colors = new Array(graph.length).fill(0) // Check if it's safe to color a vertex with a given color. function isSafe(vertex, color) { for (let i = 0; i < graph.length; i++) { if (graph[vertex][i] && colors[i] === color) { - return false; + return false } } - return true; + return true } // Use backtracking to try and color the graph. function solveColoring(vertex = 0) { if (vertex === graph.length) { - return true; + return true } for (let color = 1; color <= m; color++) { if (isSafe(vertex, color)) { - colors[vertex] = color; - + colors[vertex] = color + if (solveColoring(vertex + 1)) { - return true; + return true } // If no solution, backtrack. - colors[vertex] = 0; + colors[vertex] = 0 } } - return false; + return false } // If coloring is possible, return the colors. if (solveColoring()) { - return colors; + return colors } - return null; + return null } -export { mColoring }; +export { mColoring } diff --git a/Backtracking/tests/MColoringProblem.test.js b/Backtracking/tests/MColoringProblem.test.js index d98134b62a..759a328aae 100644 --- a/Backtracking/tests/MColoringProblem.test.js +++ b/Backtracking/tests/MColoringProblem.test.js @@ -1,4 +1,4 @@ -import { mColoring } from '../MColoringProblem'; +import { mColoring } from '../MColoringProblem' describe('MColoringProblem', () => { it('should color a triangle with 3 colors', () => { @@ -6,18 +6,18 @@ describe('MColoringProblem', () => { [0, 1, 1], [1, 0, 1], [1, 1, 0] - ]; - const solution = mColoring(graph, 3); - expect(solution).not.toBeNull(); - }); + ] + const solution = mColoring(graph, 3) + expect(solution).not.toBeNull() + }) it('should not color a triangle with 2 colors', () => { const graph = [ [0, 1, 1], [1, 0, 1], [1, 1, 0] - ]; - const solution = mColoring(graph, 2); - expect(solution).toBeNull(); - }); -}); + ] + const solution = mColoring(graph, 2) + expect(solution).toBeNull() + }) +}) From aebd52f39f80a46c4f698fae16a553496f5ec4e8 Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Fri, 27 Oct 2023 22:57:25 +0000 Subject: [PATCH 061/122] chore: update readme --- DIRECTORY.md | 1 + 1 file changed, 1 insertion(+) diff --git a/DIRECTORY.md b/DIRECTORY.md index 61fa501119..730df9cdf9 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -10,6 +10,7 @@ * [SumOfSubset](Backtracking/SumOfSubset.js) * **Bit-Manipulation** * [BinaryCountSetBits](Bit-Manipulation/BinaryCountSetBits.js) + * [GenerateSubSets](Bit-Manipulation/GenerateSubSets.js) * [GrayCodes](Bit-Manipulation/GrayCodes.js) * [IsPowerofFour](Bit-Manipulation/IsPowerofFour.js) * [IsPowerOfTwo](Bit-Manipulation/IsPowerOfTwo.js) From 889d9c361df169e9a01d32295cb02f8eb0372a08 Mon Sep 17 00:00:00 2001 From: Manpreet Singh <63737630+ManpreetSingh2004@users.noreply.github.com> Date: Mon, 30 Oct 2023 10:54:35 +0530 Subject: [PATCH 062/122] feat: Added MD5 hashing algorithm (#1519) * feat: Added MD5 hashing algorithm * Added wiki link * Remove spam? * Fix extend towards end * Return Uint32Array in MD5 function * Preprocess function now works on uint arrays * chunkify U32Array instead of string * Remove all string related functions * Replace typed arrays with named variables * Fix "Replace typed arrays with named variables" * Return Uint8 Array in MD5 function The MD5 function now returns a uint8 array with the correct endianness. * Add tests * Fix docstrings * Introduce hexMD5 function * Change test string * Format test file --- Hashes/MD5.js | 205 +++++++++++++++++++++++++++++++++++++++ Hashes/tests/MD5.test.js | 38 ++++++++ 2 files changed, 243 insertions(+) create mode 100644 Hashes/MD5.js create mode 100644 Hashes/tests/MD5.test.js diff --git a/Hashes/MD5.js b/Hashes/MD5.js new file mode 100644 index 0000000000..42bef45cc5 --- /dev/null +++ b/Hashes/MD5.js @@ -0,0 +1,205 @@ +// Module that replicates the MD5 Cryptographic Hash +// function in Javascript. + +// main variables +const S = [ + 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, + 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, + 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, + 21 +] + +const K = [ + 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, 0xf57c0faf, 0x4787c62a, + 0xa8304613, 0xfd469501, 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, + 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, 0xf61e2562, 0xc040b340, + 0x265e5a51, 0xe9b6c7aa, 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, + 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, 0xa9e3e905, 0xfcefa3f8, + 0x676f02d9, 0x8d2a4c8a, 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, + 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, 0x289b7ec6, 0xeaa127fa, + 0xd4ef3085, 0x04881d05, 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, + 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, 0x655b59c3, 0x8f0ccc92, + 0xffeff47d, 0x85845dd1, 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, + 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 +] + +/** + * Separates an array into equal sized chunks + * + * @param {Array|string} array - array or string to separate into chunks + * @param {number} size - number of elements wanted in each chunk + * @return {Array} - array of original array split into chunks + * + * @example + * chunkify("this is a test", 2) + */ +function chunkify(array, size) { + const chunks = [] + for (let i = 0; i < array.length; i += size) { + chunks.push(array.slice(i, i + size)) + } + return chunks +} + +/** + * Rotates the bits to the left + * + * @param {number} bits - 32 bit number + * @param {number} turns - number of rotations to make + * @return {number} - number after bits rotation + * + * @example + * rotateLeft(0b1011, 3); // 0b1011000 + */ +function rotateLeft(bits, turns) { + return (bits << turns) | (bits >>> (32 - turns)) +} + +/** + * Converts Uint8Array to Uint32Array + * + * @param {Uint8Array} u8Array Uint8Array to convert + * @returns {Uint32Array} - Required Uint32Array + */ +function u8ToU32(u8Array) { + const uint32Array = new Uint32Array(u8Array.length / 4) + + for (let i = 0; i < u8Array.length; i += 4) { + uint32Array[i / 4] = + (u8Array[i] | + (u8Array[i + 1] << 8) | + (u8Array[i + 2] << 16) | + (u8Array[i + 3] << 24)) >>> + 0 + } + + return uint32Array +} + +/** + * Converts Uint32Array to Uint8Array + * + * @param {Uint32Array} u32Array Uint32Array to convert + * @returns {Uint8Array} - Required Uint8Array + */ +function u32ToU8(u32Array) { + const uint8Array = new Uint8Array(u32Array.length * 4) + + for (let i = 0; i < u32Array.length; i++) { + uint8Array[i * 4] = u32Array[i] & 0xff + uint8Array[i * 4 + 1] = (u32Array[i] >> 8) & 0xff + uint8Array[i * 4 + 2] = (u32Array[i] >> 16) & 0xff + uint8Array[i * 4 + 3] = (u32Array[i] >> 24) & 0xff + } + + return uint8Array +} + +/** + * Adds padding to the end of the given array + * + * @param {Uint8Array} u8Array Array to pad + * @param {number} size Resulting size of the array + */ +function padEnd(u8Array, size) { + const result = new Uint8Array(size) + result.set(u8Array) + result.fill(0, u8Array.length) + + return result +} + +/** + * Pre-processes message to feed the algorithm loop + * + * @param {Uint8Array} message - message to pre-process + * @return {Uint32Array} - processed message + */ +function preProcess(message) { + // Extend message by adding '0' + // + // message.length + 1 is for adding '1' bit + // 56 - (length % 64) is for padding with '0's + // 8 is for appending 64 bit message length + let m = padEnd( + message, + message.length + 1 + (56 - ((message.length + 1) % 64)) + 8 + ) + + // Add '1' bit at the end of the message + m[message.length] = 1 << 7 + + // convert message to 32 bit uint array + m = u8ToU32(m) + + // Append the length of the message to the end + // (ml / 0x100000000) | 0 is equivalent to (ml >> 32) & 0xffffffff) in other languages + let ml = message.length * 8 + m[m.length - 2] = ml & 0xffffffff + m[m.length - 1] = (ml / 0x100000000) | 0 + + return m +} + +/** + * Hashes message using MD5 Cryptographic Hash Function + * + * @see + * For more info: https://en.wikipedia.org/wiki/MD5 + * + * @param {Uint8Array} message - message to hash + * @return {Uint8Array} - message digest (hash value) + */ +function MD5(message) { + // Initialize variables: + let [a0, b0, c0, d0] = [ + 0x67452301 >>> 0, + 0xefcdab89 >>> 0, + 0x98badcfe >>> 0, + 0x10325476 >>> 0 + ] + + // pre-process message and split into 512 bit chunks + const words = Array.from(preProcess(message)) + const chunks = chunkify(words, 16) + + chunks.forEach(function (chunk, _) { + // initialize variables for this chunk + let [A, B, C, D] = [a0, b0, c0, d0] + + for (let i = 0; i < 64; i++) { + let [F, g] = [0, 0] + + if (i <= 15) { + F = (B & C) | (~B & D) + g = i + } else if (i <= 31) { + F = (D & B) | (~D & C) + g = (5 * i + 1) % 16 + } else if (i <= 47) { + F = B ^ C ^ D + g = (3 * i + 5) % 16 + } else { + F = C ^ (B | ~D) + g = (7 * i) % 16 + } + + F = (F + A + K[i] + chunk[g]) >>> 0 + A = D + D = C + C = B + B = ((B + rotateLeft(F, S[i])) & 0xffffffff) >>> 0 + } + + // add values for this chunk to main hash variables (unsigned) + a0 = (a0 + A) >>> 0 + b0 = (b0 + B) >>> 0 + c0 = (c0 + C) >>> 0 + d0 = (d0 + D) >>> 0 + }) + + return u32ToU8([a0, b0, c0, d0]) +} + +// export MD5 function +export { MD5 } diff --git a/Hashes/tests/MD5.test.js b/Hashes/tests/MD5.test.js new file mode 100644 index 0000000000..5c44c7a57c --- /dev/null +++ b/Hashes/tests/MD5.test.js @@ -0,0 +1,38 @@ +import { MD5 } from '../MD5' + +/** + * Returns the MD5 hash of the given message as a hexadecimal string + * + * @param {Uint8Array} message - message to hash + * @return {string} - hash as a hexadecimal string + */ +function hexMD5(message) { + return Array.from(MD5(message), (byte) => + byte.toString(16).padStart(2, '0') + ).join('') +} + +describe('Testing MD5 function', () => { + it('should return the correct hash for "The quick brown fox jumps over the lazy dog"', () => { + const input = new TextEncoder().encode( + 'The quick brown fox jumps over the lazy dog' + ) + const hash = hexMD5(input) + + expect(hash).toBe('9e107d9d372bb6826bd81d3542a419d6') + }) + + it('should return the correct hash for "JavaScript!"', () => { + const input = new TextEncoder().encode('JavaScript!') + const hash = hexMD5(input) + + expect(hash).toBe('209eddd6b61af0643907a8e069a08fb8') + }) + + it('should correctly hash an empty string', () => { + const input = new TextEncoder().encode('') + const hash = hexMD5(input) + + expect(hash).toBe('d41d8cd98f00b204e9800998ecf8427e') + }) +}) From d74f242ac4f8cedb4c5de106f2e571d94daeefe7 Mon Sep 17 00:00:00 2001 From: Mahfoudh Arous Date: Mon, 30 Oct 2023 06:30:31 +0100 Subject: [PATCH 063/122] Rabin Karp Search Algorithm (#1545) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Search: Rabin-Karp algorithm * Prettier Style * Search: Rabin-Karp adding reference * Search: Rabin-Karp styling and remove unecessary logging * Search: Rabin-Karp review notes * Simplify return * Updated Documentation in README.md --------- Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> --- DIRECTORY.md | 1 + Search/RabinKarp.js | 64 +++++++++++++++++++++++++++++++++++ Search/test/RabinKarp.test.js | 30 ++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 Search/RabinKarp.js create mode 100644 Search/test/RabinKarp.test.js diff --git a/DIRECTORY.md b/DIRECTORY.md index 730df9cdf9..1b2c40b3c8 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -311,6 +311,7 @@ * [LinearSearch](Search/LinearSearch.js) * [Minesweeper](Search/Minesweeper.js) * [QuickSelectSearch](Search/QuickSelectSearch.js) + * [RabinKarp](Search/RabinKarp.js) * [SlidingWindow](Search/SlidingWindow.js) * [StringSearch](Search/StringSearch.js) * [TernarySearch](Search/TernarySearch.js) diff --git a/Search/RabinKarp.js b/Search/RabinKarp.js new file mode 100644 index 0000000000..e6d6394ede --- /dev/null +++ b/Search/RabinKarp.js @@ -0,0 +1,64 @@ +/* + * Implements the Rabin-Karp algorithm for pattern searching. + * + * The Rabin-Karp algorithm is a string searching algorithm that uses hashing to find patterns in strings. + * It is faster than naive string matching algorithms because it avoids comparing every character in the text. + * + * This implementation uses a rolling hash function to efficiently compute the hash values of substrings. + * It also uses a modulo operator to reduce the size of the hash values, which helps to prevent hash collisions. + * + * The algorithm returns an array of indices where the pattern is found in the text. If the pattern is not + * found, the algorithm returns an empty array. + * + * [Reference](https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm) + */ + +const BASE = 256 // The number of characters in the alphabet +const MOD = 997 // A prime number used for the hash function + +function rabinKarpSearch(text, pattern) { + const patternLength = pattern.length + const textLength = text.length + const hashPattern = hash(pattern, patternLength) + const hashText = [] + const indices = [] + + // Calculate the hash of the first substring in the text + hashText[0] = hash(text, patternLength) + + // Precompute BASE^(patternLength-1) % MOD + const basePow = Math.pow(BASE, patternLength - 1) % MOD + + for (let i = 1; i <= textLength - patternLength + 1; i++) { + // Update the rolling hash by removing the first character + // and adding the next character in the text + hashText[i] = + (BASE * (hashText[i - 1] - text.charCodeAt(i - 1) * basePow) + + text.charCodeAt(i + patternLength - 1)) % + MOD + + // In case of hash collision, check character by character + if (hashText[i] < 0) { + hashText[i] += MOD + } + + // Check if the hashes match and perform a character-wise comparison + if (hashText[i] === hashPattern) { + if (text.substring(i, i + patternLength) === pattern) { + indices.push(i) // Store the index where the pattern is found + } + } + } + + return indices +} + +function hash(str, length) { + let hashValue = 0 + for (let i = 0; i < length; i++) { + hashValue = (hashValue * BASE + str.charCodeAt(i)) % MOD + } + return hashValue +} + +export { rabinKarpSearch } diff --git a/Search/test/RabinKarp.test.js b/Search/test/RabinKarp.test.js new file mode 100644 index 0000000000..3d10097509 --- /dev/null +++ b/Search/test/RabinKarp.test.js @@ -0,0 +1,30 @@ +import { rabinKarpSearch } from '../RabinKarp' + +describe('Rabin-Karp Search', function () { + it('should find the pattern in the text', function () { + const text = 'ABABDABACDABABCABAB' + const pattern = 'DAB' + const expected = [4, 9] + + const result = rabinKarpSearch(text, pattern) + expect(result).to.deep.equal(expected) + }) + + it('should handle multiple occurrences of the pattern', function () { + const text = 'ABABABABABAB' + const pattern = 'ABAB' + const expected = [2, 4, 6, 8] + + const result = rabinKarpSearch(text, pattern) + expect(result).to.deep.equal(expected) + }) + + it('should handle pattern not found', function () { + const text = 'ABCD' + const pattern = 'XYZ' + const expected = [] + + const result = rabinKarpSearch(text, pattern) + expect(result).to.deep.equal(expected) + }) +}) From e5af4c24b4156279827f6a6cc4349f70247a53f2 Mon Sep 17 00:00:00 2001 From: Hardik Pawar <97388607+Hardvan@users.noreply.github.com> Date: Mon, 30 Oct 2023 11:04:06 +0530 Subject: [PATCH 064/122] Enhance readability of ZeroOneKnapsack.js (#1574) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Enhance readability of ZeroOneKnapsack.js * Update ZeroOneKnapsack.js --------- Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --- Dynamic-Programming/ZeroOneKnapsack.js | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/Dynamic-Programming/ZeroOneKnapsack.js b/Dynamic-Programming/ZeroOneKnapsack.js index 3913d016b3..52a06aa130 100644 --- a/Dynamic-Programming/ZeroOneKnapsack.js +++ b/Dynamic-Programming/ZeroOneKnapsack.js @@ -1,26 +1,34 @@ /** * A Dynamic Programming based solution for calculating Zero One Knapsack * https://en.wikipedia.org/wiki/Knapsack_problem + * + * Time and Space Complexity: O(n*cap) */ - const zeroOneKnapsack = (arr, n, cap, cache) => { + // Base Case: No capacity or no items if (cap === 0 || n === 0) { cache[n][cap] = 0 return cache[n][cap] } + + // Lookup (value already calculated) if (cache[n][cap] !== -1) { return cache[n][cap] } + + // Profit when excluding the nth item + let notPick = zeroOneKnapsack(arr, n - 1, cap, cache) + + // Profit when including the nth item + let pick = 0 if (arr[n - 1][0] <= cap) { - cache[n][cap] = Math.max( - arr[n - 1][1] + zeroOneKnapsack(arr, n - 1, cap - arr[n - 1][0], cache), - zeroOneKnapsack(arr, n - 1, cap, cache) - ) - return cache[n][cap] - } else { - cache[n][cap] = zeroOneKnapsack(arr, n - 1, cap, cache) - return cache[n][cap] + // If weight of the nth item is within the capacity + pick = + arr[n - 1][1] + zeroOneKnapsack(arr, n - 1, cap - arr[n - 1][0], cache) } + + cache[n][cap] = Math.max(pick, notPick) // maximize profit + return cache[n][cap] } const example = () => { From 1cc5e61ff04c4db06f2775fdabde5231b0e0f521 Mon Sep 17 00:00:00 2001 From: Rahul Bhandari <90493221+imrahulkb@users.noreply.github.com> Date: Mon, 30 Oct 2023 11:09:26 +0530 Subject: [PATCH 065/122] Update Problem001.js (#1536) * Update Problem001.js * Update Problem001.js * Update Problem001.js * Update Problem001.js * Update Problem001.js --- Project-Euler/Problem001.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Project-Euler/Problem001.js b/Project-Euler/Problem001.js index c47c10bd1c..a88f912603 100644 --- a/Project-Euler/Problem001.js +++ b/Project-Euler/Problem001.js @@ -1,20 +1,23 @@ // https://projecteuler.net/problem=1 -/* Multiples of 3 and 5 - If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. +/* Multiples of 3 and 5 +If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6, and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below the provided parameter value number. */ +// This method uses the nSum function to add the nSum for 3 and 5. However, it needs to subtract the nSum for 15 once to avoid double counting. const multiplesThreeAndFive = (num) => { if (num < 1) throw new Error('No natural numbers exist below 1') + num -= 1 + let sum = 0 - let total = 0 - // total for calculating the sum - for (let i = 1; i < num; i++) { - if (i % 3 === 0 || i % 5 === 0) { - total += i - } - } - return total + // The nSum function calculates the sum of the first n numbers in the sequence with a common difference of num. + // Here, n is denoted as frequency. + const nSum = (num, frequency) => (frequency * (frequency + 1) * num) >> 1 + + sum += nSum(3, Math.floor(num / 3)) + sum += nSum(5, Math.floor(num / 5)) + sum -= nSum(15, Math.floor(num / 15)) + return sum } export { multiplesThreeAndFive } From cafb3433e816bafc8115315a5771a7a01d5a174a Mon Sep 17 00:00:00 2001 From: Rahul Bhandari <90493221+imrahulkb@users.noreply.github.com> Date: Mon, 30 Oct 2023 11:10:02 +0530 Subject: [PATCH 066/122] Update AllCombinationsOfSizeK.js (#1530) * Update AllCombinationsOfSizeK.js * Update AllCombinationsOfSizeK.js * Update AllCombinationsOfSizeK.test.js Changes made it the type of testing. Instead of testing the class now the program will test the function * Update AllCombinationsOfSizeK.js * Update AllCombinationsOfSizeK.js * Update AllCombinationsOfSizeK.js * Update AllCombinationsOfSizeK.test.js * Update AllCombinationsOfSizeK.test.js --- Backtracking/AllCombinationsOfSizeK.js | 64 +++++++------------ .../tests/AllCombinationsOfSizeK.test.js | 10 +-- 2 files changed, 28 insertions(+), 46 deletions(-) diff --git a/Backtracking/AllCombinationsOfSizeK.js b/Backtracking/AllCombinationsOfSizeK.js index 264acb1f19..bbe4e7fd5b 100644 --- a/Backtracking/AllCombinationsOfSizeK.js +++ b/Backtracking/AllCombinationsOfSizeK.js @@ -1,46 +1,28 @@ -/* - Problem: Given two numbers, n and k, make all unique combinations of k numbers from 1 to n and in sorted order - - What is combinations? - - Combinations is selecting items from a collections without considering the order of selection - - Example: - - We have an apple, a banana, and a jackfruit - - We have three objects, and need to choose two items, then combinations will be - - 1. Apple & Banana - 2. Apple & Jackfruit - 3. Banana & Jackfruit - - To read more about combinations, you can visit the following link: - - https://betterexplained.com/articles/easy-permutations-and-combinations/ - - Solution: - - We will be using backtracking to solve this questions - - Take one element, and make all them combinations for k-1 elements - - Once we get all combinations of that element, pop it and do same for next element -*/ - -class Combinations { - constructor(n, k) { - this.n = n - this.k = k - this.current = [] // will be used for storing current combination - this.combinations = [] - } - - findCombinations(high = this.n, total = this.k, low = 1) { - if (total === 0) { - this.combinations.push([...this.current]) - return this.combinations +function generateCombinations(n, k) { + let currentCombination = [] + let allCombinations = [] // will be used for storing all combinations + let currentValue = 1 + + function findCombinations() { + if (currentCombination.length === k) { + // Add the array of size k to the allCombinations array + allCombinations.push([...currentCombination]) + return } - for (let i = low; i <= high; i++) { - this.current.push(i) - this.findCombinations(high, total - 1, i + 1) - this.current.pop() + if (currentValue > n) { + // Check for exceeding the range + return } - return this.combinations + currentCombination.push(currentValue++) + findCombinations() + currentCombination.pop() + findCombinations() + currentValue-- } + + findCombinations() + + return allCombinations } -export { Combinations } +export { generateCombinations } diff --git a/Backtracking/tests/AllCombinationsOfSizeK.test.js b/Backtracking/tests/AllCombinationsOfSizeK.test.js index a2135e54bf..29b656a2c4 100644 --- a/Backtracking/tests/AllCombinationsOfSizeK.test.js +++ b/Backtracking/tests/AllCombinationsOfSizeK.test.js @@ -1,9 +1,9 @@ -import { Combinations } from '../AllCombinationsOfSizeK' +import { generateCombinations } from '../AllCombinationsOfSizeK' describe('AllCombinationsOfSizeK', () => { it('should return 3x2 matrix solution for n = 3 and k = 2', () => { - const test1 = new Combinations(3, 2) - expect(test1.findCombinations()).toEqual([ + const res = generateCombinations(3, 2) + expect(res).toEqual([ [1, 2], [1, 3], [2, 3] @@ -11,8 +11,8 @@ describe('AllCombinationsOfSizeK', () => { }) it('should return 6x2 matrix solution for n = 4 and k = 2', () => { - const test2 = new Combinations(4, 2) - expect(test2.findCombinations()).toEqual([ + const res = generateCombinations(4, 2) + expect(res).toEqual([ [1, 2], [1, 3], [1, 4], From a044c574016ba0116d426fbe3bb0228f095ff821 Mon Sep 17 00:00:00 2001 From: Elias Afara Date: Wed, 8 Nov 2023 04:46:52 +0100 Subject: [PATCH 067/122] docs: Update script usage in CONTRIBUTING.md (#1587) --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 289f9acd34..83f0624254 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -125,7 +125,7 @@ npm test -- koch You can also start Vitest in "watch" mode: ```bash -npm test-watch +npm run test-watch ``` This will run all tests and watch source and test files for changes. When a change is made, the tests will run again. From e9e3ea4684332263fa7afbdd0e18780158888e7d Mon Sep 17 00:00:00 2001 From: Vedas Dixit <111585043+vedas-dixit@users.noreply.github.com> Date: Wed, 15 Nov 2023 19:22:57 +0530 Subject: [PATCH 068/122] Implemented Partition Problem, Recursive problem (#1582) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add Tug of War solution using backtracking * Updated Documentation in README.md * Added Tug of war problem link * Updated Documentation in README.md * Updated Documentation in README.md * Refactor tugOfWar: remove unused vars, optimize initialization, and remove redundant checks * Added Function Export Statment * Updated Documentation in README.md * Resolved Code Style --Prettier * Rename "backtrack" to "recurse" * Fix test case: The difference needs to be exactly 1. * Code Modification: subsets should have sizes as close to n/2 as possible * Updated test-case of TugOfWar * Changed TugOfWar problem to Partition * Modified partition problem * Updated Documentation in README.md * fixed code style --------- Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --- DIRECTORY.md | 2 ++ Recursive/Partition.js | 39 ++++++++++++++++++++++++++++++++ Recursive/test/Partition.test.js | 24 ++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 Recursive/Partition.js create mode 100644 Recursive/test/Partition.test.js diff --git a/DIRECTORY.md b/DIRECTORY.md index 1b2c40b3c8..2ede552665 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -160,6 +160,7 @@ * [NumberOfIslands](Graphs/NumberOfIslands.js) * [PrimMST](Graphs/PrimMST.js) * **Hashes** + * [MD5](Hashes/MD5.js) * [SHA1](Hashes/SHA1.js) * [SHA256](Hashes/SHA256.js) * **Maths** @@ -300,6 +301,7 @@ * [KochSnowflake](Recursive/KochSnowflake.js) * [LetterCombination](Recursive/LetterCombination.js) * [Palindrome](Recursive/Palindrome.js) + * [Partition](Recursive/Partition.js) * [SubsequenceRecursive](Recursive/SubsequenceRecursive.js) * [TowerOfHanoi](Recursive/TowerOfHanoi.js) * **Search** diff --git a/Recursive/Partition.js b/Recursive/Partition.js new file mode 100644 index 0000000000..51465f8e93 --- /dev/null +++ b/Recursive/Partition.js @@ -0,0 +1,39 @@ +/** + * @function canPartition + * @description Check whether it is possible to partition the given array into two equal sum subsets using recursion. + * @param {number[]} nums - The input array of numbers. + * @param {number} index - The current index in the array being considered. + * @param {number} target - The target sum for each subset. + * @return {boolean}. + * @see [Partition Problem](https://en.wikipedia.org/wiki/Partition_problem) + */ + +const canPartition = (nums, index = 0, target = 0) => { + if (!Array.isArray(nums)) { + throw new TypeError('Invalid Input') + } + + const sum = nums.reduce((acc, num) => acc + num, 0) + + if (sum % 2 !== 0) { + return false + } + + if (target === sum / 2) { + return true + } + + if (index >= nums.length || target > sum / 2) { + return false + } + + // Include the current number in the first subset and check if a solution is possible. + const withCurrent = canPartition(nums, index + 1, target + nums[index]) + + // Exclude the current number from the first subset and check if a solution is possible. + const withoutCurrent = canPartition(nums, index + 1, target) + + return withCurrent || withoutCurrent +} + +export { canPartition } diff --git a/Recursive/test/Partition.test.js b/Recursive/test/Partition.test.js new file mode 100644 index 0000000000..929519999a --- /dev/null +++ b/Recursive/test/Partition.test.js @@ -0,0 +1,24 @@ +import { canPartition } from '../Partition' + +describe('Partition (Recursive)', () => { + it('expects to return true for an array that can be partitioned', () => { + const result = canPartition([1, 5, 11, 5]) + expect(result).toBe(true) + }) + + it('expects to return false for an array that cannot be partitioned', () => { + const result = canPartition([1, 2, 3, 5]) + expect(result).toBe(false) + }) + + it('expects to return true for an empty array (0 elements)', () => { + const result = canPartition([]) + expect(result).toBe(true) + }) + + it('Throw Error for Invalid Input', () => { + expect(() => canPartition(123)).toThrow('Invalid Input') + expect(() => canPartition(null)).toThrow('Invalid Input') + expect(() => canPartition(undefined)).toThrow('Invalid Input') + }) +}) From 39d01138ecf6077cc1ecde0a06b22cfe3cda595b Mon Sep 17 00:00:00 2001 From: Rob Simpson Date: Wed, 15 Nov 2023 08:55:30 -0500 Subject: [PATCH 069/122] Abbreviation (#1547) * Abbreviation * Updates from code review --- Dynamic-Programming/Abbreviation.js | 47 +++++++++++++++++++ .../tests/Abbreviation.test.js | 30 ++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 Dynamic-Programming/Abbreviation.js create mode 100644 Dynamic-Programming/tests/Abbreviation.test.js diff --git a/Dynamic-Programming/Abbreviation.js b/Dynamic-Programming/Abbreviation.js new file mode 100644 index 0000000000..06092216b8 --- /dev/null +++ b/Dynamic-Programming/Abbreviation.js @@ -0,0 +1,47 @@ +/** + * @description + * Given two strings, `source` and `target`, determine if it's possible to make `source` equal + * to `target` You can perform the following operations on the string `source`: + * 1. Capitalize zero or more of `source`'s lowercase letters. + * 2. Delete all the remaining lowercase letters in `source`. + * + * Time Complexity: (O(|source|*|target|)) where `|source|` => length of string `source` + * + * @param {String} source - The string to be transformed. + * @param {String} target - The string we want to transform `source` into. + * @returns {Boolean} - Whether the transformation is possible. + * @see https://www.hackerrank.com/challenges/abbr/problem - Related problem on HackerRank. + */ +export const isAbbreviation = (source, target) => { + const sourceLength = source.length + const targetLength = target.length + + // Initialize a table to keep track of possible abbreviations + let canAbbreviate = Array.from({ length: sourceLength + 1 }, () => + Array(targetLength + 1).fill(false) + ) + // Empty strings are trivially abbreviatable + canAbbreviate[0][0] = true + + for (let sourceIndex = 0; sourceIndex < sourceLength; sourceIndex++) { + for (let targetIndex = 0; targetIndex <= targetLength; targetIndex++) { + if (canAbbreviate[sourceIndex][targetIndex]) { + // If characters at the current position are equal, move to the next position in both strings. + if ( + targetIndex < targetLength && + source[sourceIndex].toUpperCase() === target[targetIndex] + ) { + canAbbreviate[sourceIndex + 1][targetIndex + 1] = true + } + // If the current character in `source` is lowercase, explore two possibilities: + // a) Capitalize it (which is akin to "using" it in `source` to match `target`), or + // b) Skip it (effectively deleting it from `source`). + if (source[sourceIndex] === source[sourceIndex].toLowerCase()) { + canAbbreviate[sourceIndex + 1][targetIndex] = true + } + } + } + } + + return canAbbreviate[sourceLength][targetLength] +} diff --git a/Dynamic-Programming/tests/Abbreviation.test.js b/Dynamic-Programming/tests/Abbreviation.test.js new file mode 100644 index 0000000000..86e0f97336 --- /dev/null +++ b/Dynamic-Programming/tests/Abbreviation.test.js @@ -0,0 +1,30 @@ +import { isAbbreviation } from '../Abbreviation.js' + +const expectPositive = (word, abbr) => + expect(isAbbreviation(word, abbr)).toBe(true) +const expectNegative = (word, abbr) => + expect(isAbbreviation(word, abbr)).toBe(false) + +describe('Abbreviation - Positive Tests', () => { + test('it should correctly abbreviate or transform the source string to match the target string', () => { + expectPositive('', '') + expectPositive('a', '') + expectPositive('a', 'A') + expectPositive('abcDE', 'ABCDE') + expectPositive('ABcDE', 'ABCDE') + expectPositive('abcde', 'ABCDE') + expectPositive('abcde', 'ABC') + expectPositive('abcXYdefghijKLmnopqrs', 'XYKL') + expectPositive('abc123', 'ABC') + expectPositive('abc123', 'ABC123') + expectPositive('abc!@#def', 'ABC') + }) +}) + +describe('Abbreviation - Negative Tests', () => { + test('it should fail to abbreviate or transform the source string when it is not possible to match the target string', () => { + expectNegative('', 'A') + expectNegative('a', 'ABC') + expectNegative('aBcXYdefghijKLmnOpqrs', 'XYKLOP') + }) +}) From 1b66d86bd743c48100a42cf0927d78d15ccca239 Mon Sep 17 00:00:00 2001 From: Nobert Patrick Ayesiga Date: Tue, 28 Nov 2023 07:28:32 +0300 Subject: [PATCH 070/122] Implemented Palindrome Partitioning using Backtracking algorithm (#1591) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Implemented Palindrome Partitioning using Backtracking algorithm * fix:Updated palindromePartition algorithm * code clean up * Rephrase doc comment & move to appropriate function --------- Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --- Recursive/PalindromePartitioning.js | 30 +++++++++++++++++++ Recursive/test/PalindromePartitioning.test.js | 12 ++++++++ 2 files changed, 42 insertions(+) create mode 100644 Recursive/PalindromePartitioning.js create mode 100644 Recursive/test/PalindromePartitioning.test.js diff --git a/Recursive/PalindromePartitioning.js b/Recursive/PalindromePartitioning.js new file mode 100644 index 0000000000..9a5150f65d --- /dev/null +++ b/Recursive/PalindromePartitioning.js @@ -0,0 +1,30 @@ +import { palindrome } from './Palindrome' + +/* + * Given a string s, return all possible palindrome partitionings of s. + * A palindrome partitioning partitions a string into palindromic substrings. + * @see https://www.cs.columbia.edu/~sedwards/classes/2021/4995-fall/proposals/Palindrome.pdf + */ +const partitionPalindrome = (s) => { + const result = [] + backtrack(s, [], result) + return result +} + +const backtrack = (s, path, result) => { + if (s.length === 0) { + result.push([...path]) + return + } + + for (let i = 0; i < s.length; i++) { + const prefix = s.substring(0, i + 1) + if (palindrome(prefix)) { + path.push(prefix) + backtrack(s.substring(i + 1), path, result) + path.pop() + } + } +} + +export default partitionPalindrome diff --git a/Recursive/test/PalindromePartitioning.test.js b/Recursive/test/PalindromePartitioning.test.js new file mode 100644 index 0000000000..1bb218cdd4 --- /dev/null +++ b/Recursive/test/PalindromePartitioning.test.js @@ -0,0 +1,12 @@ +import partitionPalindrome from '../PalindromePartitioning' + +describe('Palindrome Partitioning', () => { + it('should return all possible palindrome partitioning of s', () => { + expect(partitionPalindrome('aab')).toEqual([ + ['a', 'a', 'b'], + ['aa', 'b'] + ]) + expect(partitionPalindrome('a')).toEqual([['a']]) + expect(partitionPalindrome('ab')).toEqual([['a', 'b']]) + }) +}) From 5a7e8d1325dc441180c5e05685a1f5590683ff2c Mon Sep 17 00:00:00 2001 From: Akshay Chavan <118964099+Akshay73c@users.noreply.github.com> Date: Thu, 4 Jan 2024 18:19:13 +0530 Subject: [PATCH 071/122] implemented CycleDetectionII code in LinkedList (#1482) * implemented CycleTectionII code * changes made per review by appgurueu * made the changes per review by appgurueu * changes made per review by appgurueu * did some changes * fixed the test file with prettier * Simplify code, renames for clarity --------- Co-authored-by: Lars Mueller --- DIRECTORY.md | 1 + .../Linked-List/CycleDetectionII.js | 57 +++++++++++++++++++ .../Linked-List/test/CycleDetectionII.test.js | 39 +++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 Data-Structures/Linked-List/CycleDetectionII.js create mode 100644 Data-Structures/Linked-List/test/CycleDetectionII.test.js diff --git a/DIRECTORY.md b/DIRECTORY.md index 2ede552665..457b166a22 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -82,6 +82,7 @@ * **Linked-List** * [AddTwoNumbers](Data-Structures/Linked-List/AddTwoNumbers.js) * [CycleDetection](Data-Structures/Linked-List/CycleDetection.js) + * [CycleDetectionII](Data-Structures/Linked-List/CycleDetectionII.js) * [DoublyLinkedList](Data-Structures/Linked-List/DoublyLinkedList.js) * [MergeTwoSortedLinkedLists](Data-Structures/Linked-List/MergeTwoSortedLinkedLists.js) * [ReverseSinglyLinkedList](Data-Structures/Linked-List/ReverseSinglyLinkedList.js) diff --git a/Data-Structures/Linked-List/CycleDetectionII.js b/Data-Structures/Linked-List/CycleDetectionII.js new file mode 100644 index 0000000000..478586e6eb --- /dev/null +++ b/Data-Structures/Linked-List/CycleDetectionII.js @@ -0,0 +1,57 @@ +/** + * A LinkedList based solution for finding the starting node of the cycle in a list. + * @returns the node where cycle begins in the linked list. If there is no cycle present, returns null. + * @see https://en.wikipedia.org/wiki/Cycle_detection + * @see https://leetcode.com/problems/linked-list-cycle-ii/ + */ + +function findCycleStart(head) { + let length = 0 + let fast = head + let slow = head + + while (fast !== null && fast.next !== null) { + fast = fast.next.next + slow = slow.next + if (fast === slow) { + length = cycleLength(slow) + break + } + } + + if (length === 0) { + // If there is no cycle, return null. + return null + } + + let ahead = head + let behind = head + // Move slow pointer ahead 'length' of cycle times + while (length > 0) { + ahead = ahead.next + length-- + } + + // Now move both pointers until they meet - this will be the start of cycle + while (ahead !== behind) { + ahead = ahead.next + behind = behind.next + } + + // return the meeting node + return ahead +} + +// head is a node on a cycle +function cycleLength(head) { + // How long until we visit head again? + let cur = head + let len = 0 + do { + cur = cur.next + len++ + } while (cur != head) + return len +} + +export { findCycleStart } diff --git a/Data-Structures/Linked-List/test/CycleDetectionII.test.js b/Data-Structures/Linked-List/test/CycleDetectionII.test.js new file mode 100644 index 0000000000..f741c53622 --- /dev/null +++ b/Data-Structures/Linked-List/test/CycleDetectionII.test.js @@ -0,0 +1,39 @@ +import { findCycleStart } from '../CycleDetectionII' +import { Node } from '../SinglyLinkedList' + +describe('Detect Cycle', () => { + it('no cycle', () => { + const head = new Node(1) + head.next = new Node(2) + + expect(findCycleStart(head)).toBeNull() + }) + + it('simple cycle', () => { + const head = new Node(1) + head.next = new Node(2) + head.next.next = new Node(3) + head.next.next.next = head.next // Creates a cycle + + expect(findCycleStart(head)).toBe(head.next) + }) + + it('long list with cycle', () => { + const head = new Node(1) + head.next = new Node(2) + head.next.next = new Node(3) + head.next.next.next = new Node(4) + head.next.next.next.next = new Node(5) + head.next.next.next.next.next = head.next.next // Cycle + + expect(findCycleStart(head)).toBe(head.next.next) + }) + + it('cycle on last node', () => { + const head = new Node(1) + head.next = new Node(2) + head.next.next = head + + expect(findCycleStart(head)).toBe(head) + }) +}) From 203b7a0aa88d1b2c0f3459432d9ac1aa839c7756 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Sat, 13 Jan 2024 16:25:28 +0100 Subject: [PATCH 072/122] Properly evaluate `GITHUB_ACTOR` (#1594) * fix: use `GITHUB_ACTOR` in `git config` * Updated Documentation in README.md --------- Co-authored-by: vil02 --- .github/workflows/UpdateDirectory.yml | 4 ++-- DIRECTORY.md | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/UpdateDirectory.yml b/.github/workflows/UpdateDirectory.yml index 624047758a..17ba375fb7 100644 --- a/.github/workflows/UpdateDirectory.yml +++ b/.github/workflows/UpdateDirectory.yml @@ -25,8 +25,8 @@ jobs: - name: Configure Github Action run: | - git config --global user.name github-actions - git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com' + git config --global user.name "$GITHUB_ACTOR" + git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" - name: 🤓 Commit & push new Directory (if needed) run: | diff --git a/DIRECTORY.md b/DIRECTORY.md index 457b166a22..8b51ce3bf7 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -104,6 +104,7 @@ * **Vectors** * [Vector2](Data-Structures/Vectors/Vector2.js) * **Dynamic-Programming** + * [Abbreviation](Dynamic-Programming/Abbreviation.js) * [CatalanNumbers](Dynamic-Programming/CatalanNumbers.js) * [ClimbingStairs](Dynamic-Programming/ClimbingStairs.js) * [CoinChange](Dynamic-Programming/CoinChange.js) @@ -302,6 +303,7 @@ * [KochSnowflake](Recursive/KochSnowflake.js) * [LetterCombination](Recursive/LetterCombination.js) * [Palindrome](Recursive/Palindrome.js) + * [PalindromePartitioning](Recursive/PalindromePartitioning.js) * [Partition](Recursive/Partition.js) * [SubsequenceRecursive](Recursive/SubsequenceRecursive.js) * [TowerOfHanoi](Recursive/TowerOfHanoi.js) From f0cfa8557f473a672d29ed4b5cfa1d6e095e72c8 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Mon, 15 Jan 2024 19:59:36 +0100 Subject: [PATCH 073/122] chore: update `actions/setup-node` to `v4` (#1596) --- .github/workflows/Ci.yml | 2 +- .github/workflows/UpdateDirectory.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Ci.yml b/.github/workflows/Ci.yml index 12093c2738..9ea6fc558a 100644 --- a/.github/workflows/Ci.yml +++ b/.github/workflows/Ci.yml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 20 cache: npm diff --git a/.github/workflows/UpdateDirectory.yml b/.github/workflows/UpdateDirectory.yml index 17ba375fb7..d6d6c11973 100644 --- a/.github/workflows/UpdateDirectory.yml +++ b/.github/workflows/UpdateDirectory.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 20 cache: npm From 83eb73b26f4d6eab860e2cd14cb32adcace35a21 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Mon, 15 Jan 2024 19:59:53 +0100 Subject: [PATCH 074/122] chore: update `actions/checkout` to `v4` (#1595) --- .github/workflows/Ci.yml | 4 ++-- .github/workflows/UpdateDirectory.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Ci.yml b/.github/workflows/Ci.yml index 9ea6fc558a..571b8a0fa8 100644 --- a/.github/workflows/Ci.yml +++ b/.github/workflows/Ci.yml @@ -11,7 +11,7 @@ jobs: name: Code style and tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: @@ -31,7 +31,7 @@ jobs: name: Check for spelling errors runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: codespell-project/actions-codespell@master with: # file types to ignore diff --git a/.github/workflows/UpdateDirectory.yml b/.github/workflows/UpdateDirectory.yml index d6d6c11973..cb649e1c8b 100644 --- a/.github/workflows/UpdateDirectory.yml +++ b/.github/workflows/UpdateDirectory.yml @@ -10,7 +10,7 @@ jobs: updateDirectory: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: From 069803f2718b379b8c1b67c5da6e74820bd57cce Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Tue, 16 Jan 2024 08:00:39 +0100 Subject: [PATCH 075/122] style: remove trailing spaces (#1597) --- .github/ISSUE_TEMPLATE/bug_report.yml | 6 +++--- .github/stale.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index a6b7e0da16..6a4de4e591 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -33,9 +33,9 @@ body: label: Steps to reproduce (if applicable) description: List steps to reproduce the behavior. placeholder: | - 1. - 2. - 3. + 1. + 2. + 3. 4. validations: required: false diff --git a/.github/stale.yml b/.github/stale.yml index 1f3872c524..9692a0a677 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -16,5 +16,5 @@ markComment: > for your contributions. # Comment to post when closing a stale issue. Set to `false` to disable closeComment: > - Please reopen this issue once you commit the changes requested or + Please reopen this issue once you commit the changes requested or make improvements on the code. Thank you for your contributions. From 0e5cf5e843fd3509553f1f53e296bd21881f950d Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Sat, 27 Jan 2024 17:57:40 +0100 Subject: [PATCH 076/122] tests: add missing test for `KnightTour` (#1598) --- Backtracking/tests/KnightTour.test.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Backtracking/tests/KnightTour.test.js b/Backtracking/tests/KnightTour.test.js index a3af01a095..f7dc511df9 100644 --- a/Backtracking/tests/KnightTour.test.js +++ b/Backtracking/tests/KnightTour.test.js @@ -11,7 +11,7 @@ describe('OpenKnightTour', () => { [0, 0, 0, 0, 0] ]) - KT.solve() + expect(KT.solve()).toBe(true) expect(KT.board).toEqual([ [19, 4, 15, 10, 25], [14, 9, 18, 5, 16], @@ -20,4 +20,18 @@ describe('OpenKnightTour', () => { [21, 2, 7, 12, 23] ]) }) + + it('OpenKnightTour(2)', () => { + const KT = new OpenKnightTour(2) + expect(KT.board).toEqual([ + [0, 0], + [0, 0] + ]) + + expect(KT.solve()).toBe(false) + expect(KT.board).toEqual([ + [0, 0], + [0, 0] + ]) + }) }) From 1d6340086728355189c194ff8ddb22b337f18535 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Sat, 27 Jan 2024 17:58:12 +0100 Subject: [PATCH 077/122] chore: add `UploadCoverageReport.yml` (#1599) --- .github/workflows/UploadCoverageReport.yml | 33 + .gitignore | 2 + package-lock.json | 2325 ++++++++------------ package.json | 3 +- vitest.config.ts | 5 +- 5 files changed, 901 insertions(+), 1467 deletions(-) create mode 100644 .github/workflows/UploadCoverageReport.yml diff --git a/.github/workflows/UploadCoverageReport.yml b/.github/workflows/UploadCoverageReport.yml new file mode 100644 index 0000000000..4dcad584bf --- /dev/null +++ b/.github/workflows/UploadCoverageReport.yml @@ -0,0 +1,33 @@ +--- +name: UploadCoverageReport + +'on': + workflow_dispatch: + push: + branches: + - master + pull_request: + +jobs: + UploadCoverageReport: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Generate coverage report + run: npm test -- --coverage + + - name: Upload coverage to codecov + uses: codecov/codecov-action@v3 + with: + files: "coverage/coverage-final.json" + fail_ci_if_error: true +... diff --git a/.gitignore b/.gitignore index 1714facbfa..1cc076e7bb 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ yarn-error.log* # intelliJ workspace folder .idea + +/coverage diff --git a/package-lock.json b/package-lock.json index 7a282547ae..a4efa09c1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,7 +1,7 @@ { "name": "javascript", "version": "1.0.0", - "lockfileVersion": 2, + "lockfileVersion": 3, "requires": true, "packages": { "": { @@ -9,135 +9,80 @@ "version": "1.0.0", "license": "GPL-3.0", "devDependencies": { + "@vitest/coverage-v8": "^1.2.1", "globby": "^13.2.2", "husky": "^8.0.3", "prettier": "^3.0.3", - "vitest": "^0.34.6" + "vitest": "^1.2.1" }, "engines": { "node": ">=20.6.0" } }, - "node_modules/@esbuild/android-arm": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", - "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", - "cpu": [ - "arm" - ], + "node_modules/@ampproject/remapping": { + "version": "2.2.1", "dev": true, - "optional": true, - "os": [ - "android" - ], + "license": "Apache-2.0", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + }, "engines": { - "node": ">=12" + "node": ">=6.0.0" } }, - "node_modules/@esbuild/android-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", - "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", - "cpu": [ - "arm64" - ], + "node_modules/@babel/helper-string-parser": { + "version": "7.23.4", "dev": true, - "optional": true, - "os": [ - "android" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=6.9.0" } }, - "node_modules/@esbuild/android-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", - "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", - "cpu": [ - "x64" - ], + "node_modules/@babel/helper-validator-identifier": { + "version": "7.22.20", "dev": true, - "optional": true, - "os": [ - "android" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=6.9.0" } }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", - "integrity": "sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==", - "cpu": [ - "arm64" - ], + "node_modules/@babel/parser": { + "version": "7.23.6", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "license": "MIT", + "bin": { + "parser": "bin/babel-parser.js" + }, "engines": { - "node": ">=12" + "node": ">=6.0.0" } }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", - "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", - "cpu": [ - "x64" - ], + "node_modules/@babel/types": { + "version": "7.23.6", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.23.4", + "@babel/helper-validator-identifier": "^7.22.20", + "to-fast-properties": "^2.0.0" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" } }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", - "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", - "cpu": [ - "arm64" - ], + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } + "license": "MIT" }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", - "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", + "node_modules/@esbuild/linux-x64": { + "version": "0.19.12", "cpu": [ "x64" ], "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", - "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", - "cpu": [ - "arm" - ], - "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -146,318 +91,166 @@ "node": ">=12" } }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", - "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", - "cpu": [ - "arm64" - ], + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=8" } }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", - "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", - "cpu": [ - "ia32" - ], + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, "engines": { - "node": ">=12" + "node": ">=6.0.0" } }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", - "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", - "cpu": [ - "loong64" - ], + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.1", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=6.0.0" } }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", - "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", - "cpu": [ - "mips64el" - ], + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=6.0.0" } }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", - "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", - "cpu": [ - "ppc64" - ], + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } + "license": "MIT" }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", - "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", - "cpu": [ - "riscv64" - ], + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.22", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", - "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", - "cpu": [ - "s390x" - ], + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, "engines": { - "node": ">=12" + "node": ">= 8" } }, - "node_modules/@esbuild/linux-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", - "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", - "cpu": [ - "x64" - ], + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">= 8" } }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", - "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", - "cpu": [ - "x64" - ], + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", "dev": true, - "optional": true, - "os": [ - "netbsd" - ], + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, "engines": { - "node": ">=12" + "node": ">= 8" } }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", - "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.9.6", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } + "linux" + ] }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", - "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.9.6", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } + "linux" + ] }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", - "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", - "cpu": [ - "arm64" - ], + "node_modules/@types/estree": { + "version": "1.0.5", "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } + "license": "MIT" }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", - "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", - "cpu": [ - "ia32" - ], + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.6", "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } + "license": "MIT" }, - "node_modules/@esbuild/win32-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", - "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", - "cpu": [ - "x64" - ], + "node_modules/@types/node": { + "version": "20.11.6", "dev": true, + "license": "MIT", "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@jest/schemas": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", - "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", - "dev": true, + "peer": true, "dependencies": { - "@sinclair/typebox": "^0.27.8" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "undici-types": "~5.26.4" } }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true - }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "node_modules/@vitest/coverage-v8": { + "version": "1.2.1", "dev": true, + "license": "MIT", "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" + "@ampproject/remapping": "^2.2.1", + "@bcoe/v8-coverage": "^0.2.3", + "debug": "^4.3.4", + "istanbul-lib-coverage": "^3.2.2", + "istanbul-lib-report": "^3.0.1", + "istanbul-lib-source-maps": "^4.0.1", + "istanbul-reports": "^3.1.6", + "magic-string": "^0.30.5", + "magicast": "^0.3.3", + "picocolors": "^1.0.0", + "std-env": "^3.5.0", + "test-exclude": "^6.0.0", + "v8-to-istanbul": "^9.2.0" }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" + "funding": { + "url": "https://opencollective.com/vitest" }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@sinclair/typebox": { - "version": "0.27.8", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", - "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", - "dev": true - }, - "node_modules/@types/chai": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.6.tgz", - "integrity": "sha512-VOVRLM1mBxIRxydiViqPcKn6MIxZytrbMpd6RJLIWKxUNr3zux8no0Oc7kJx0WAPIitgZ0gkrDS+btlqQpubpw==", - "dev": true - }, - "node_modules/@types/chai-subset": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz", - "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==", - "dev": true, - "dependencies": { - "@types/chai": "*" + "peerDependencies": { + "vitest": "^1.0.0" } }, - "node_modules/@types/node": { - "version": "18.11.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.0.tgz", - "integrity": "sha512-IOXCvVRToe7e0ny7HpT/X9Rb2RYtElG1a+VshjwT00HxrM2dWBApHQoqsI6WiY7Q03vdf2bCrIGzVrkF/5t10w==", - "dev": true - }, "node_modules/@vitest/expect": { - "version": "0.34.6", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.34.6.tgz", - "integrity": "sha512-QUzKpUQRc1qC7qdGo7rMK3AkETI7w18gTCUrsNnyjjJKYiuUB9+TQK3QnR1unhCnWRC0AbKv2omLGQDF/mIjOw==", + "version": "1.2.1", "dev": true, + "license": "MIT", "dependencies": { - "@vitest/spy": "0.34.6", - "@vitest/utils": "0.34.6", + "@vitest/spy": "1.2.1", + "@vitest/utils": "1.2.1", "chai": "^4.3.10" }, "funding": { @@ -465,13 +258,12 @@ } }, "node_modules/@vitest/runner": { - "version": "0.34.6", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-0.34.6.tgz", - "integrity": "sha512-1CUQgtJSLF47NnhN+F9X2ycxUP0kLHQ/JWvNHbeBfwW8CzEGgeskzNnHDyv1ieKTltuR6sdIHV+nmR6kPxQqzQ==", + "version": "1.2.1", "dev": true, + "license": "MIT", "dependencies": { - "@vitest/utils": "0.34.6", - "p-limit": "^4.0.0", + "@vitest/utils": "1.2.1", + "p-limit": "^5.0.0", "pathe": "^1.1.1" }, "funding": { @@ -479,15 +271,14 @@ } }, "node_modules/@vitest/runner/node_modules/p-limit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "version": "5.0.0", "dev": true, + "license": "MIT", "dependencies": { "yocto-queue": "^1.0.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -495,9 +286,8 @@ }, "node_modules/@vitest/runner/node_modules/yocto-queue": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", - "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", "dev": true, + "license": "MIT", "engines": { "node": ">=12.20" }, @@ -506,80 +296,176 @@ } }, "node_modules/@vitest/snapshot": { - "version": "0.34.6", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-0.34.6.tgz", - "integrity": "sha512-B3OZqYn6k4VaN011D+ve+AA4whM4QkcwcrwaKwAbyyvS/NB1hCWjFIBQxAQQSQir9/RtyAAGuq+4RJmbn2dH4w==", + "version": "1.2.1", "dev": true, + "license": "MIT", "dependencies": { - "magic-string": "^0.30.1", + "magic-string": "^0.30.5", "pathe": "^1.1.1", - "pretty-format": "^29.5.0" + "pretty-format": "^29.7.0" }, "funding": { "url": "https://opencollective.com/vitest" } }, - "node_modules/@vitest/spy": { - "version": "0.34.6", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-0.34.6.tgz", - "integrity": "sha512-xaCvneSaeBw/cz8ySmF7ZwGvL0lBjfvqc1LpQ/vcdHEvpLn3Ff1vAvjw+CoGn0802l++5L/pxb7whwcWAw+DUQ==", + "node_modules/@vitest/snapshot/node_modules/@jest/schemas": { + "version": "29.6.3", "dev": true, + "license": "MIT", "dependencies": { - "tinyspy": "^2.1.1" + "@sinclair/typebox": "^0.27.8" }, - "funding": { - "url": "https://opencollective.com/vitest" + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@vitest/utils": { - "version": "0.34.6", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-0.34.6.tgz", - "integrity": "sha512-IG5aDD8S6zlvloDsnzHw0Ut5xczlF+kv2BOTo+iXfPr54Yhi5qbVOgGB1hZaVq4iJ4C/MZ2J0y15IlsV/ZcI0A==", + "node_modules/@vitest/snapshot/node_modules/@sinclair/typebox": { + "version": "0.27.8", "dev": true, - "dependencies": { - "diff-sequences": "^29.4.3", - "loupe": "^2.3.6", - "pretty-format": "^29.5.0" + "license": "MIT" + }, + "node_modules/@vitest/snapshot/node_modules/ansi-styles": { + "version": "5.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" }, "funding": { - "url": "https://opencollective.com/vitest" + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/acorn": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "node_modules/@vitest/snapshot/node_modules/pretty-format": { + "version": "29.7.0", "dev": true, - "bin": { - "acorn": "bin/acorn" + "license": "MIT", + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@vitest/spy": { + "version": "1.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyspy": "^2.2.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "1.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "diff-sequences": "^29.6.3", + "estree-walker": "^3.0.3", + "loupe": "^2.3.7", + "pretty-format": "^29.7.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils/node_modules/@jest/schemas": { + "version": "29.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@vitest/utils/node_modules/@sinclair/typebox": { + "version": "0.27.8", + "dev": true, + "license": "MIT" + }, + "node_modules/@vitest/utils/node_modules/ansi-styles": { + "version": "5.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@vitest/utils/node_modules/diff-sequences": { + "version": "29.6.3", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@vitest/utils/node_modules/pretty-format": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/acorn": { + "version": "8.11.3", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" }, "engines": { "node": ">=0.4.0" } }, "node_modules/acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "version": "8.3.2", "dev": true, + "license": "MIT", "engines": { "node": ">=0.4.0" } }, "node_modules/assertion-error": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true, + "license": "MIT", "engines": { "node": "*" } }, + "node_modules/balanced-match": { + "version": "1.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "node_modules/braces": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "dev": true, + "license": "MIT", "dependencies": { "fill-range": "^7.0.1" }, @@ -589,18 +475,16 @@ }, "node_modules/cac": { "version": "6.7.14", - "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", - "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/chai": { - "version": "4.3.10", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.10.tgz", - "integrity": "sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==", + "version": "4.4.1", "dev": true, + "license": "MIT", "dependencies": { "assertion-error": "^1.1.0", "check-error": "^1.0.3", @@ -616,9 +500,8 @@ }, "node_modules/check-error": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", - "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", "dev": true, + "license": "MIT", "dependencies": { "get-func-name": "^2.0.2" }, @@ -626,11 +509,28 @@ "node": "*" } }, + "node_modules/concat-map": { + "version": "0.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/debug": { "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, + "license": "MIT", "dependencies": { "ms": "2.1.2" }, @@ -645,9 +545,8 @@ }, "node_modules/deep-eql": { "version": "4.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", - "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", "dev": true, + "license": "MIT", "dependencies": { "type-detect": "^4.0.0" }, @@ -655,20 +554,10 @@ "node": ">=6" } }, - "node_modules/diff-sequences": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", - "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", - "dev": true, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, "node_modules/dir-glob": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", "dev": true, + "license": "MIT", "dependencies": { "path-type": "^4.0.0" }, @@ -677,11 +566,10 @@ } }, "node_modules/esbuild": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", - "integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==", + "version": "0.19.12", "dev": true, "hasInstallScript": true, + "license": "MIT", "bin": { "esbuild": "bin/esbuild" }, @@ -689,35 +577,43 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/android-arm": "0.18.20", - "@esbuild/android-arm64": "0.18.20", - "@esbuild/android-x64": "0.18.20", - "@esbuild/darwin-arm64": "0.18.20", - "@esbuild/darwin-x64": "0.18.20", - "@esbuild/freebsd-arm64": "0.18.20", - "@esbuild/freebsd-x64": "0.18.20", - "@esbuild/linux-arm": "0.18.20", - "@esbuild/linux-arm64": "0.18.20", - "@esbuild/linux-ia32": "0.18.20", - "@esbuild/linux-loong64": "0.18.20", - "@esbuild/linux-mips64el": "0.18.20", - "@esbuild/linux-ppc64": "0.18.20", - "@esbuild/linux-riscv64": "0.18.20", - "@esbuild/linux-s390x": "0.18.20", - "@esbuild/linux-x64": "0.18.20", - "@esbuild/netbsd-x64": "0.18.20", - "@esbuild/openbsd-x64": "0.18.20", - "@esbuild/sunos-x64": "0.18.20", - "@esbuild/win32-arm64": "0.18.20", - "@esbuild/win32-ia32": "0.18.20", - "@esbuild/win32-x64": "0.18.20" + "@esbuild/aix-ppc64": "0.19.12", + "@esbuild/android-arm": "0.19.12", + "@esbuild/android-arm64": "0.19.12", + "@esbuild/android-x64": "0.19.12", + "@esbuild/darwin-arm64": "0.19.12", + "@esbuild/darwin-x64": "0.19.12", + "@esbuild/freebsd-arm64": "0.19.12", + "@esbuild/freebsd-x64": "0.19.12", + "@esbuild/linux-arm": "0.19.12", + "@esbuild/linux-arm64": "0.19.12", + "@esbuild/linux-ia32": "0.19.12", + "@esbuild/linux-loong64": "0.19.12", + "@esbuild/linux-mips64el": "0.19.12", + "@esbuild/linux-ppc64": "0.19.12", + "@esbuild/linux-riscv64": "0.19.12", + "@esbuild/linux-s390x": "0.19.12", + "@esbuild/linux-x64": "0.19.12", + "@esbuild/netbsd-x64": "0.19.12", + "@esbuild/openbsd-x64": "0.19.12", + "@esbuild/sunos-x64": "0.19.12", + "@esbuild/win32-arm64": "0.19.12", + "@esbuild/win32-ia32": "0.19.12", + "@esbuild/win32-x64": "0.19.12" + } + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" } }, "node_modules/fast-glob": { "version": "3.3.1", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", - "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", "dev": true, + "license": "MIT", "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -731,18 +627,16 @@ }, "node_modules/fastq": { "version": "1.13.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", - "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", "dev": true, + "license": "ISC", "dependencies": { "reusify": "^1.0.4" } }, "node_modules/fill-range": { "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "dev": true, + "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" }, @@ -750,34 +644,42 @@ "node": ">=8" } }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "node_modules/fs.realpath": { + "version": "1.0.0", "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } + "license": "ISC" }, "node_modules/get-func-name": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", - "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, "engines": { "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/glob-parent": { "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, + "license": "ISC", "dependencies": { "is-glob": "^4.0.1" }, @@ -787,9 +689,8 @@ }, "node_modules/globby": { "version": "13.2.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", - "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", "dev": true, + "license": "MIT", "dependencies": { "dir-glob": "^3.0.1", "fast-glob": "^3.3.0", @@ -806,9 +707,8 @@ }, "node_modules/globby/node_modules/slash": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", - "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -816,11 +716,23 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "dev": true, + "license": "MIT" + }, "node_modules/husky": { "version": "8.0.3", - "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", - "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", "dev": true, + "license": "MIT", "bin": { "husky": "lib/bin.js" }, @@ -833,27 +745,38 @@ }, "node_modules/ignore": { "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", - "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", "dev": true, + "license": "MIT", "engines": { "node": ">= 4" } }, + "node_modules/inflight": { + "version": "1.0.6", + "dev": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "dev": true, + "license": "ISC" + }, "node_modules/is-extglob": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/is-glob": { "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, + "license": "MIT", "dependencies": { "is-extglob": "^2.1.1" }, @@ -863,24 +786,76 @@ }, "node_modules/is-number": { "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.12.0" } }, + "node_modules/isexe": { + "version": "2.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.6", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/jsonc-parser": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", - "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", - "dev": true + "version": "3.2.1", + "dev": true, + "license": "MIT" }, "node_modules/local-pkg": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.3.tgz", - "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==", + "version": "0.5.0", "dev": true, + "license": "MIT", + "dependencies": { + "mlly": "^1.4.2", + "pkg-types": "^1.0.3" + }, "engines": { "node": ">=14" }, @@ -889,19 +864,17 @@ } }, "node_modules/loupe": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", - "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", + "version": "2.3.7", "dev": true, + "license": "MIT", "dependencies": { - "get-func-name": "^2.0.0" + "get-func-name": "^2.0.1" } }, "node_modules/magic-string": { - "version": "0.30.4", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.4.tgz", - "integrity": "sha512-Q/TKtsC5BPm0kGqgBIF9oXAs/xEf2vRKiIB4wCRQTJOQIByZ1d+NnUOotvJOvNpi5RNIgVOMC3pOuaP1ZTDlVg==", + "version": "0.30.5", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.15" }, @@ -909,20 +882,77 @@ "node": ">=12" } }, + "node_modules/magicast": { + "version": "0.3.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.23.6", + "@babel/types": "^7.23.6", + "source-map-js": "^1.0.2" + } + }, + "node_modules/make-dir": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/lru-cache": { + "version": "6.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "7.5.4", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/make-dir/node_modules/yallist": { + "version": "4.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "dev": true, + "license": "MIT" + }, "node_modules/merge2": { "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true, + "license": "MIT", "engines": { "node": ">= 8" } }, "node_modules/micromatch": { "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", "dev": true, + "license": "MIT", "dependencies": { "braces": "^3.0.2", "picomatch": "^2.3.1" @@ -931,28 +961,35 @@ "node": ">=8.6" } }, + "node_modules/minimatch": { + "version": "3.1.2", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/mlly": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.4.2.tgz", - "integrity": "sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==", + "version": "1.5.0", "dev": true, + "license": "MIT", "dependencies": { - "acorn": "^8.10.0", - "pathe": "^1.1.1", + "acorn": "^8.11.3", + "pathe": "^1.1.2", "pkg-types": "^1.0.3", - "ufo": "^1.3.0" + "ufo": "^1.3.2" } }, "node_modules/ms": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/nanoid": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", - "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "version": "3.3.7", "dev": true, "funding": [ { @@ -960,6 +997,7 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -967,41 +1005,60 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/once": { + "version": "1.4.0", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/path-type": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/pathe": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.1.tgz", - "integrity": "sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==", - "dev": true + "version": "1.1.2", + "dev": true, + "license": "MIT" }, "node_modules/pathval": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", "dev": true, + "license": "MIT", "engines": { "node": "*" } }, "node_modules/picocolors": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/picomatch": { "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, + "license": "MIT", "engines": { "node": ">=8.6" }, @@ -1011,9 +1068,8 @@ }, "node_modules/pkg-types": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.3.tgz", - "integrity": "sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==", "dev": true, + "license": "MIT", "dependencies": { "jsonc-parser": "^3.2.0", "mlly": "^1.2.0", @@ -1021,9 +1077,7 @@ } }, "node_modules/postcss": { - "version": "8.4.31", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", - "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", + "version": "8.4.33", "dev": true, "funding": [ { @@ -1039,8 +1093,9 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { - "nanoid": "^3.3.6", + "nanoid": "^3.3.7", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" }, @@ -1050,9 +1105,8 @@ }, "node_modules/prettier": { "version": "3.0.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", - "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", "dev": true, + "license": "MIT", "bin": { "prettier": "bin/prettier.cjs" }, @@ -1063,36 +1117,8 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, - "node_modules/pretty-format": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", - "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", - "dev": true, - "dependencies": { - "@jest/schemas": "^29.6.3", - "ansi-styles": "^5.0.0", - "react-is": "^18.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/pretty-format/node_modules/ansi-styles": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", - "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/queue-microtask": { "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true, "funding": [ { @@ -1107,44 +1133,56 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/react-is": { "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/reusify": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", "dev": true, + "license": "MIT", "engines": { "iojs": ">=1.0.0", "node": ">=0.10.0" } }, "node_modules/rollup": { - "version": "3.29.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", - "integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==", + "version": "4.9.6", "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.5" + }, "bin": { "rollup": "dist/bin/rollup" }, "engines": { - "node": ">=14.18.0", + "node": ">=18.0.0", "npm": ">=8.0.0" }, "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.9.6", + "@rollup/rollup-android-arm64": "4.9.6", + "@rollup/rollup-darwin-arm64": "4.9.6", + "@rollup/rollup-darwin-x64": "4.9.6", + "@rollup/rollup-linux-arm-gnueabihf": "4.9.6", + "@rollup/rollup-linux-arm64-gnu": "4.9.6", + "@rollup/rollup-linux-arm64-musl": "4.9.6", + "@rollup/rollup-linux-riscv64-gnu": "4.9.6", + "@rollup/rollup-linux-x64-gnu": "4.9.6", + "@rollup/rollup-linux-x64-musl": "4.9.6", + "@rollup/rollup-win32-arm64-msvc": "4.9.6", + "@rollup/rollup-win32-ia32-msvc": "4.9.6", + "@rollup/rollup-win32-x64-msvc": "4.9.6", "fsevents": "~2.3.2" } }, "node_modules/run-parallel": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", "dev": true, "funding": [ { @@ -1160,42 +1198,65 @@ "url": "https://feross.org/support" } ], + "license": "MIT", "dependencies": { "queue-microtask": "^1.2.2" } }, - "node_modules/siginfo": { + "node_modules/shebang-command": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", - "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", - "dev": true + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } }, - "node_modules/source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "node_modules/shebang-regex": { + "version": "3.0.0", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=8" + } + }, + "node_modules/siginfo": { + "version": "2.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" } }, "node_modules/stackback": { "version": "0.0.2", - "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", - "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/std-env": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.4.3.tgz", - "integrity": "sha512-f9aPhy8fYBuMN+sNfakZV18U39PbalgjXG3lLB9WkaYTxijru61wb57V9wxxNthXM5Sd88ETBWi29qLAsHO52Q==", - "dev": true + "version": "3.7.0", + "dev": true, + "license": "MIT" }, "node_modules/strip-literal": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.3.0.tgz", - "integrity": "sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==", "dev": true, + "license": "MIT", "dependencies": { "acorn": "^8.10.0" }, @@ -1203,35 +1264,63 @@ "url": "https://github.com/sponsors/antfu" } }, + "node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/tinybench": { "version": "2.5.1", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.5.1.tgz", - "integrity": "sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/tinypool": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.7.0.tgz", - "integrity": "sha512-zSYNUlYSMhJ6Zdou4cJwo/p7w5nmAH17GRfU/ui3ctvjXFErXXkruT4MWW6poDeXgCaIBlGLrfU6TbTXxyGMww==", + "version": "0.8.2", "dev": true, + "license": "MIT", "engines": { "node": ">=14.0.0" } }, "node_modules/tinyspy": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.1.1.tgz", - "integrity": "sha512-XPJL2uSzcOyBMky6OFrusqWlzfFrXtE0hPuMgW8A2HmaqrPo4ZQHRN/V0QXN3FSjKxpsbRrFc5LI7KOwBsT1/w==", + "version": "2.2.0", "dev": true, + "license": "MIT", "engines": { "node": ">=14.0.0" } }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, + "license": "MIT", "dependencies": { "is-number": "^7.0.0" }, @@ -1241,43 +1330,65 @@ }, "node_modules/type-detect": { "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true, + "license": "MIT", "engines": { "node": ">=4" } }, "node_modules/ufo": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.3.1.tgz", - "integrity": "sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==", - "dev": true + "version": "1.3.2", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "5.26.5", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true + }, + "node_modules/v8-to-istanbul": { + "version": "9.2.0", + "dev": true, + "license": "ISC", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/v8-to-istanbul/node_modules/convert-source-map": { + "version": "2.0.0", + "dev": true, + "license": "MIT" }, "node_modules/vite": { - "version": "4.4.9", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", - "integrity": "sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==", + "version": "5.0.12", "dev": true, + "license": "MIT", "dependencies": { - "esbuild": "^0.18.10", - "postcss": "^8.4.27", - "rollup": "^3.27.1" + "esbuild": "^0.19.3", + "postcss": "^8.4.32", + "rollup": "^4.2.0" }, "bin": { "vite": "bin/vite.js" }, "engines": { - "node": "^14.18.0 || >=16.0.0" + "node": "^18.0.0 || >=20.0.0" }, "funding": { "url": "https://github.com/vitejs/vite?sponsor=1" }, "optionalDependencies": { - "fsevents": "~2.3.2" + "fsevents": "~2.3.3" }, "peerDependencies": { - "@types/node": ">= 14", + "@types/node": "^18.0.0 || >=20.0.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", @@ -1310,82 +1421,77 @@ } }, "node_modules/vite-node": { - "version": "0.34.6", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-0.34.6.tgz", - "integrity": "sha512-nlBMJ9x6n7/Amaz6F3zJ97EBwR2FkzhBRxF5e+jE6LA3yi6Wtc2lyTij1OnDMIr34v5g/tVQtsVAzhT0jc5ygA==", + "version": "1.2.1", "dev": true, + "license": "MIT", "dependencies": { "cac": "^6.7.14", "debug": "^4.3.4", - "mlly": "^1.4.0", "pathe": "^1.1.1", "picocolors": "^1.0.0", - "vite": "^3.0.0 || ^4.0.0 || ^5.0.0-0" + "vite": "^5.0.0" }, "bin": { "vite-node": "vite-node.mjs" }, "engines": { - "node": ">=v14.18.0" + "node": "^18.0.0 || >=20.0.0" }, "funding": { "url": "https://opencollective.com/vitest" } }, "node_modules/vitest": { - "version": "0.34.6", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.34.6.tgz", - "integrity": "sha512-+5CALsOvbNKnS+ZHMXtuUC7nL8/7F1F2DnHGjSsszX8zCjWSSviphCb/NuS9Nzf4Q03KyyDRBAXhF/8lffME4Q==", - "dev": true, - "dependencies": { - "@types/chai": "^4.3.5", - "@types/chai-subset": "^1.3.3", - "@types/node": "*", - "@vitest/expect": "0.34.6", - "@vitest/runner": "0.34.6", - "@vitest/snapshot": "0.34.6", - "@vitest/spy": "0.34.6", - "@vitest/utils": "0.34.6", - "acorn": "^8.9.0", - "acorn-walk": "^8.2.0", + "version": "1.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/expect": "1.2.1", + "@vitest/runner": "1.2.1", + "@vitest/snapshot": "1.2.1", + "@vitest/spy": "1.2.1", + "@vitest/utils": "1.2.1", + "acorn-walk": "^8.3.2", "cac": "^6.7.14", "chai": "^4.3.10", "debug": "^4.3.4", - "local-pkg": "^0.4.3", - "magic-string": "^0.30.1", + "execa": "^8.0.1", + "local-pkg": "^0.5.0", + "magic-string": "^0.30.5", "pathe": "^1.1.1", "picocolors": "^1.0.0", - "std-env": "^3.3.3", - "strip-literal": "^1.0.1", - "tinybench": "^2.5.0", - "tinypool": "^0.7.0", - "vite": "^3.1.0 || ^4.0.0 || ^5.0.0-0", - "vite-node": "0.34.6", + "std-env": "^3.5.0", + "strip-literal": "^1.3.0", + "tinybench": "^2.5.1", + "tinypool": "^0.8.1", + "vite": "^5.0.0", + "vite-node": "1.2.1", "why-is-node-running": "^2.2.2" }, "bin": { "vitest": "vitest.mjs" }, "engines": { - "node": ">=v14.18.0" + "node": "^18.0.0 || >=20.0.0" }, "funding": { "url": "https://opencollective.com/vitest" }, "peerDependencies": { "@edge-runtime/vm": "*", - "@vitest/browser": "*", - "@vitest/ui": "*", + "@types/node": "^18.0.0 || >=20.0.0", + "@vitest/browser": "^1.0.0", + "@vitest/ui": "^1.0.0", "happy-dom": "*", - "jsdom": "*", - "playwright": "*", - "safaridriver": "*", - "webdriverio": "*" + "jsdom": "*" }, "peerDependenciesMeta": { "@edge-runtime/vm": { "optional": true }, + "@types/node": { + "optional": true + }, "@vitest/browser": { "optional": true }, @@ -1397,877 +1503,166 @@ }, "jsdom": { "optional": true - }, - "playwright": { - "optional": true - }, - "safaridriver": { - "optional": true - }, - "webdriverio": { - "optional": true } } }, - "node_modules/why-is-node-running": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", - "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", + "node_modules/vitest/node_modules/execa": { + "version": "8.0.1", "dev": true, + "license": "MIT", "dependencies": { - "siginfo": "^2.0.0", - "stackback": "0.0.2" - }, - "bin": { - "why-is-node-running": "cli.js" + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" }, "engines": { - "node": ">=8" - } - } - }, - "dependencies": { - "@esbuild/android-arm": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", - "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", - "dev": true, - "optional": true - }, - "@esbuild/android-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", - "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", - "dev": true, - "optional": true - }, - "@esbuild/android-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", - "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", - "dev": true, - "optional": true - }, - "@esbuild/darwin-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", - "integrity": "sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==", - "dev": true, - "optional": true - }, - "@esbuild/darwin-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", - "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", - "dev": true, - "optional": true - }, - "@esbuild/freebsd-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", - "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", - "dev": true, - "optional": true - }, - "@esbuild/freebsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", - "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", - "dev": true, - "optional": true - }, - "@esbuild/linux-arm": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", - "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", - "dev": true, - "optional": true - }, - "@esbuild/linux-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", - "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", - "dev": true, - "optional": true - }, - "@esbuild/linux-ia32": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", - "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", - "dev": true, - "optional": true - }, - "@esbuild/linux-loong64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", - "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", - "dev": true, - "optional": true - }, - "@esbuild/linux-mips64el": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", - "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", - "dev": true, - "optional": true - }, - "@esbuild/linux-ppc64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", - "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", - "dev": true, - "optional": true - }, - "@esbuild/linux-riscv64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", - "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", - "dev": true, - "optional": true - }, - "@esbuild/linux-s390x": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", - "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", - "dev": true, - "optional": true - }, - "@esbuild/linux-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", - "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", - "dev": true, - "optional": true - }, - "@esbuild/netbsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", - "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", - "dev": true, - "optional": true - }, - "@esbuild/openbsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", - "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", - "dev": true, - "optional": true - }, - "@esbuild/sunos-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", - "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", - "dev": true, - "optional": true - }, - "@esbuild/win32-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", - "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", - "dev": true, - "optional": true - }, - "@esbuild/win32-ia32": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", - "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", - "dev": true, - "optional": true - }, - "@esbuild/win32-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", - "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", - "dev": true, - "optional": true - }, - "@jest/schemas": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", - "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", - "dev": true, - "requires": { - "@sinclair/typebox": "^0.27.8" - } - }, - "@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true - }, - "@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - } - }, - "@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true - }, - "@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "requires": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - } - }, - "@sinclair/typebox": { - "version": "0.27.8", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", - "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", - "dev": true - }, - "@types/chai": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.6.tgz", - "integrity": "sha512-VOVRLM1mBxIRxydiViqPcKn6MIxZytrbMpd6RJLIWKxUNr3zux8no0Oc7kJx0WAPIitgZ0gkrDS+btlqQpubpw==", - "dev": true - }, - "@types/chai-subset": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz", - "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==", - "dev": true, - "requires": { - "@types/chai": "*" - } - }, - "@types/node": { - "version": "18.11.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.0.tgz", - "integrity": "sha512-IOXCvVRToe7e0ny7HpT/X9Rb2RYtElG1a+VshjwT00HxrM2dWBApHQoqsI6WiY7Q03vdf2bCrIGzVrkF/5t10w==", - "dev": true - }, - "@vitest/expect": { - "version": "0.34.6", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.34.6.tgz", - "integrity": "sha512-QUzKpUQRc1qC7qdGo7rMK3AkETI7w18gTCUrsNnyjjJKYiuUB9+TQK3QnR1unhCnWRC0AbKv2omLGQDF/mIjOw==", - "dev": true, - "requires": { - "@vitest/spy": "0.34.6", - "@vitest/utils": "0.34.6", - "chai": "^4.3.10" - } - }, - "@vitest/runner": { - "version": "0.34.6", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-0.34.6.tgz", - "integrity": "sha512-1CUQgtJSLF47NnhN+F9X2ycxUP0kLHQ/JWvNHbeBfwW8CzEGgeskzNnHDyv1ieKTltuR6sdIHV+nmR6kPxQqzQ==", - "dev": true, - "requires": { - "@vitest/utils": "0.34.6", - "p-limit": "^4.0.0", - "pathe": "^1.1.1" + "node": ">=16.17" }, - "dependencies": { - "p-limit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", - "dev": true, - "requires": { - "yocto-queue": "^1.0.0" - } - }, - "yocto-queue": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", - "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", - "dev": true - } - } - }, - "@vitest/snapshot": { - "version": "0.34.6", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-0.34.6.tgz", - "integrity": "sha512-B3OZqYn6k4VaN011D+ve+AA4whM4QkcwcrwaKwAbyyvS/NB1hCWjFIBQxAQQSQir9/RtyAAGuq+4RJmbn2dH4w==", - "dev": true, - "requires": { - "magic-string": "^0.30.1", - "pathe": "^1.1.1", - "pretty-format": "^29.5.0" - } - }, - "@vitest/spy": { - "version": "0.34.6", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-0.34.6.tgz", - "integrity": "sha512-xaCvneSaeBw/cz8ySmF7ZwGvL0lBjfvqc1LpQ/vcdHEvpLn3Ff1vAvjw+CoGn0802l++5L/pxb7whwcWAw+DUQ==", - "dev": true, - "requires": { - "tinyspy": "^2.1.1" - } - }, - "@vitest/utils": { - "version": "0.34.6", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-0.34.6.tgz", - "integrity": "sha512-IG5aDD8S6zlvloDsnzHw0Ut5xczlF+kv2BOTo+iXfPr54Yhi5qbVOgGB1hZaVq4iJ4C/MZ2J0y15IlsV/ZcI0A==", - "dev": true, - "requires": { - "diff-sequences": "^29.4.3", - "loupe": "^2.3.6", - "pretty-format": "^29.5.0" - } - }, - "acorn": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", - "dev": true - }, - "acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true - }, - "assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "cac": { - "version": "6.7.14", - "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", - "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", - "dev": true - }, - "chai": { - "version": "4.3.10", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.10.tgz", - "integrity": "sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==", - "dev": true, - "requires": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.3", - "deep-eql": "^4.1.3", - "get-func-name": "^2.0.2", - "loupe": "^2.3.6", - "pathval": "^1.1.1", - "type-detect": "^4.0.8" - } - }, - "check-error": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", - "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", - "dev": true, - "requires": { - "get-func-name": "^2.0.2" - } - }, - "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "deep-eql": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", - "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", - "dev": true, - "requires": { - "type-detect": "^4.0.0" - } - }, - "diff-sequences": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", - "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", - "dev": true - }, - "dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "requires": { - "path-type": "^4.0.0" - } - }, - "esbuild": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", - "integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==", - "dev": true, - "requires": { - "@esbuild/android-arm": "0.18.20", - "@esbuild/android-arm64": "0.18.20", - "@esbuild/android-x64": "0.18.20", - "@esbuild/darwin-arm64": "0.18.20", - "@esbuild/darwin-x64": "0.18.20", - "@esbuild/freebsd-arm64": "0.18.20", - "@esbuild/freebsd-x64": "0.18.20", - "@esbuild/linux-arm": "0.18.20", - "@esbuild/linux-arm64": "0.18.20", - "@esbuild/linux-ia32": "0.18.20", - "@esbuild/linux-loong64": "0.18.20", - "@esbuild/linux-mips64el": "0.18.20", - "@esbuild/linux-ppc64": "0.18.20", - "@esbuild/linux-riscv64": "0.18.20", - "@esbuild/linux-s390x": "0.18.20", - "@esbuild/linux-x64": "0.18.20", - "@esbuild/netbsd-x64": "0.18.20", - "@esbuild/openbsd-x64": "0.18.20", - "@esbuild/sunos-x64": "0.18.20", - "@esbuild/win32-arm64": "0.18.20", - "@esbuild/win32-ia32": "0.18.20", - "@esbuild/win32-x64": "0.18.20" - } - }, - "fast-glob": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", - "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - } - }, - "fastq": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", - "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", - "dev": true, - "requires": { - "reusify": "^1.0.4" - } - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "optional": true - }, - "get-func-name": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", - "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", - "dev": true - }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, - "globby": { - "version": "13.2.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", - "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", + "node_modules/vitest/node_modules/get-stream": { + "version": "8.0.1", "dev": true, - "requires": { - "dir-glob": "^3.0.1", - "fast-glob": "^3.3.0", - "ignore": "^5.2.4", - "merge2": "^1.4.1", - "slash": "^4.0.0" + "license": "MIT", + "engines": { + "node": ">=16" }, - "dependencies": { - "slash": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", - "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", - "dev": true - } - } - }, - "husky": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", - "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", - "dev": true - }, - "ignore": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", - "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", - "dev": true - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true - }, - "is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "jsonc-parser": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", - "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", - "dev": true - }, - "local-pkg": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.3.tgz", - "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==", - "dev": true - }, - "loupe": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", - "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", - "dev": true, - "requires": { - "get-func-name": "^2.0.0" - } - }, - "magic-string": { - "version": "0.30.4", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.4.tgz", - "integrity": "sha512-Q/TKtsC5BPm0kGqgBIF9oXAs/xEf2vRKiIB4wCRQTJOQIByZ1d+NnUOotvJOvNpi5RNIgVOMC3pOuaP1ZTDlVg==", - "dev": true, - "requires": { - "@jridgewell/sourcemap-codec": "^1.4.15" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true - }, - "micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "node_modules/vitest/node_modules/human-signals": { + "version": "5.0.0", "dev": true, - "requires": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" + "license": "Apache-2.0", + "engines": { + "node": ">=16.17.0" } }, - "mlly": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.4.2.tgz", - "integrity": "sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==", + "node_modules/vitest/node_modules/is-stream": { + "version": "3.0.0", "dev": true, - "requires": { - "acorn": "^8.10.0", - "pathe": "^1.1.1", - "pkg-types": "^1.0.3", - "ufo": "^1.3.0" + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "nanoid": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", - "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", - "dev": true - }, - "path-type": { + "node_modules/vitest/node_modules/mimic-fn": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true - }, - "pathe": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.1.tgz", - "integrity": "sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==", - "dev": true - }, - "pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", - "dev": true - }, - "picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true - }, - "picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true - }, - "pkg-types": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.3.tgz", - "integrity": "sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==", "dev": true, - "requires": { - "jsonc-parser": "^3.2.0", - "mlly": "^1.2.0", - "pathe": "^1.1.0" + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "postcss": { - "version": "8.4.31", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", - "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", + "node_modules/vitest/node_modules/npm-run-path": { + "version": "5.2.0", "dev": true, - "requires": { - "nanoid": "^3.3.6", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" + "license": "MIT", + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "prettier": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", - "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", - "dev": true - }, - "pretty-format": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", - "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "node_modules/vitest/node_modules/onetime": { + "version": "6.0.0", "dev": true, - "requires": { - "@jest/schemas": "^29.6.3", - "ansi-styles": "^5.0.0", - "react-is": "^18.0.0" - }, + "license": "MIT", "dependencies": { - "ansi-styles": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", - "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", - "dev": true - } + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true - }, - "react-is": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", - "dev": true - }, - "reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true - }, - "rollup": { - "version": "3.29.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", - "integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==", + "node_modules/vitest/node_modules/path-key": { + "version": "4.0.0", "dev": true, - "requires": { - "fsevents": "~2.3.2" + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "node_modules/vitest/node_modules/signal-exit": { + "version": "4.1.0", "dev": true, - "requires": { - "queue-microtask": "^1.2.2" + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "siginfo": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", - "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", - "dev": true - }, - "source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", - "dev": true - }, - "stackback": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", - "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", - "dev": true - }, - "std-env": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.4.3.tgz", - "integrity": "sha512-f9aPhy8fYBuMN+sNfakZV18U39PbalgjXG3lLB9WkaYTxijru61wb57V9wxxNthXM5Sd88ETBWi29qLAsHO52Q==", - "dev": true - }, - "strip-literal": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.3.0.tgz", - "integrity": "sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==", + "node_modules/vitest/node_modules/strip-final-newline": { + "version": "3.0.0", "dev": true, - "requires": { - "acorn": "^8.10.0" + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "tinybench": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.5.1.tgz", - "integrity": "sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg==", - "dev": true - }, - "tinypool": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.7.0.tgz", - "integrity": "sha512-zSYNUlYSMhJ6Zdou4cJwo/p7w5nmAH17GRfU/ui3ctvjXFErXXkruT4MWW6poDeXgCaIBlGLrfU6TbTXxyGMww==", - "dev": true - }, - "tinyspy": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.1.1.tgz", - "integrity": "sha512-XPJL2uSzcOyBMky6OFrusqWlzfFrXtE0hPuMgW8A2HmaqrPo4ZQHRN/V0QXN3FSjKxpsbRrFc5LI7KOwBsT1/w==", - "dev": true - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "node_modules/which": { + "version": "2.0.2", "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, - "type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true - }, - "ufo": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.3.1.tgz", - "integrity": "sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==", - "dev": true - }, - "vite": { - "version": "4.4.9", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", - "integrity": "sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==", - "dev": true, - "requires": { - "esbuild": "^0.18.10", - "fsevents": "~2.3.2", - "postcss": "^8.4.27", - "rollup": "^3.27.1" - } - }, - "vite-node": { - "version": "0.34.6", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-0.34.6.tgz", - "integrity": "sha512-nlBMJ9x6n7/Amaz6F3zJ97EBwR2FkzhBRxF5e+jE6LA3yi6Wtc2lyTij1OnDMIr34v5g/tVQtsVAzhT0jc5ygA==", - "dev": true, - "requires": { - "cac": "^6.7.14", - "debug": "^4.3.4", - "mlly": "^1.4.0", - "pathe": "^1.1.1", - "picocolors": "^1.0.0", - "vite": "^3.0.0 || ^4.0.0 || ^5.0.0-0" - } - }, - "vitest": { - "version": "0.34.6", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.34.6.tgz", - "integrity": "sha512-+5CALsOvbNKnS+ZHMXtuUC7nL8/7F1F2DnHGjSsszX8zCjWSSviphCb/NuS9Nzf4Q03KyyDRBAXhF/8lffME4Q==", - "dev": true, - "requires": { - "@types/chai": "^4.3.5", - "@types/chai-subset": "^1.3.3", - "@types/node": "*", - "@vitest/expect": "0.34.6", - "@vitest/runner": "0.34.6", - "@vitest/snapshot": "0.34.6", - "@vitest/spy": "0.34.6", - "@vitest/utils": "0.34.6", - "acorn": "^8.9.0", - "acorn-walk": "^8.2.0", - "cac": "^6.7.14", - "chai": "^4.3.10", - "debug": "^4.3.4", - "local-pkg": "^0.4.3", - "magic-string": "^0.30.1", - "pathe": "^1.1.1", - "picocolors": "^1.0.0", - "std-env": "^3.3.3", - "strip-literal": "^1.0.1", - "tinybench": "^2.5.0", - "tinypool": "^0.7.0", - "vite": "^3.1.0 || ^4.0.0 || ^5.0.0-0", - "vite-node": "0.34.6", - "why-is-node-running": "^2.2.2" + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" } }, - "why-is-node-running": { + "node_modules/why-is-node-running": { "version": "2.2.2", - "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", - "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", "dev": true, - "requires": { + "license": "MIT", + "dependencies": { "siginfo": "^2.0.0", "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "dev": true, + "license": "ISC" } } } diff --git a/package.json b/package.json index 9ce6f3cb0f..e667e1eea2 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "globby": "^13.2.2", "husky": "^8.0.3", "prettier": "^3.0.3", - "vitest": "^0.34.6" + "vitest": "^1.2.1", + "@vitest/coverage-v8": "^1.2.1" }, "engines": { "node": ">=20.6.0" diff --git a/vitest.config.ts b/vitest.config.ts index 5709b1addc..05f33b84f5 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -3,6 +3,9 @@ import { defineConfig } from 'vitest/config' export default defineConfig({ test: { globals: true, - restoreMocks: true + restoreMocks: true, + coverage: { + reporter: ['text', 'json', 'html'] + } } }) From cf0004190ab69c947d781f5cb8537b446beb8cbf Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Mon, 29 Jan 2024 06:30:44 +0100 Subject: [PATCH 078/122] docs: add codecov badge (#1600) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 65dfb501df..bd9582fe94 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ JavaScript Repository of TheAlgorithms, which implements various algorithms and [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/TheAlgorithms/JavaScript) [![Checks][checks]][actions] +[![codecov](https://codecov.io/gh/TheAlgorithms/JavaScript/graph/badge.svg?token=8VeZwL31KZ)](https://codecov.io/gh/TheAlgorithms/JavaScript) [![Contributions Welcome][welcome]](CONTRIBUTING.md) [![standard.js][standard-logo]][standard-js] [![Discord chat][chat]][discord-server] From 6aaa376500a7312d6980957c5ac2288282d0bed7 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Wed, 31 Jan 2024 07:07:54 +0100 Subject: [PATCH 079/122] tests: add tests for `SHA1` (#1602) * tests: add tests for `SHA1` * style: use `it.each` --------- Co-authored-by: appgurueu <34514239+appgurueu@users.noreply.github.com> --------- Co-authored-by: appgurueu <34514239+appgurueu@users.noreply.github.com> --- Hashes/tests/SHA1.test.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Hashes/tests/SHA1.test.js diff --git a/Hashes/tests/SHA1.test.js b/Hashes/tests/SHA1.test.js new file mode 100644 index 0000000000..8032e29908 --- /dev/null +++ b/Hashes/tests/SHA1.test.js @@ -0,0 +1,25 @@ +import { describe, test } from 'vitest' +import { SHA1 } from '../SHA1' + +describe('Testing SHA1 function', () => { + it.each([ + ['', 'da39a3ee5e6b4b0d3255bfef95601890afd80709'], + [ + 'The quick brown fox jumps over the lazy dog', + '2fd4e1c67a2d28fced849ee1bb76e7391b93eb12' + ], + [ + 'The quick brown fox jumps over the lazy cog', + 'de9f2c7fd25e1b3afad3e85a0bd17d9b100db4b3' + ], + ['a', '86f7e437faa5a7fce15d1ddcb9eaeaea377667b8'], + ['Today is 29.01.2024!', 'ae829b60d11fb5ab527d5db2501e06da3402718d'], + ['Have a nice day.', 'ed51dd3909281c25db5e1d8b1ce6fc701fda20ab'], + [ + '12345678901234567890123456789012345678901234567890123456789012345678901234567890', + '50abf5706a150990a08b2c5ea40fa0e585554732' + ] + ])('check with %j', (input, expected) => { + expect(SHA1(input)).toBe(expected) + }) +}) From f31349812ce25d2046b0e46688381adc942880c7 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Fri, 9 Feb 2024 18:00:47 +0100 Subject: [PATCH 080/122] tests: add tests for `SHA256` (#1604) --- Hashes/tests/SHA256.test.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Hashes/tests/SHA256.test.js diff --git a/Hashes/tests/SHA256.test.js b/Hashes/tests/SHA256.test.js new file mode 100644 index 0000000000..1ffb236cea --- /dev/null +++ b/Hashes/tests/SHA256.test.js @@ -0,0 +1,27 @@ +import { describe, test } from 'vitest' +import { SHA256 } from '../SHA256' + +describe('Testing SHA256 function', () => { + it.each([ + ['', 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'], + [ + 'The quick brown fox jumps over the lazy dog', + 'd7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592' + ], + [ + 'The quick brown fox jumps over the lazy cog', + 'e4c4d8f3bf76b692de791a173e05321150f7a345b46484fe427f6acc7ecc81be' + ], + [ + 'This was added by vil02 on 01.02.2024. Have a nice day!', + '476025d91db754ab6ac0c124367afd7c108d041b2f497006a214d5035769ed5d' + ], + [ + '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789', + '14582b3f153941891dca966b036a5b1de65fa3b7a2540095a31614da1de0feaf' + ], + ['a', 'ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb'] + ])('check with %j', (input, expected) => { + expect(SHA256(input)).toBe(expected) + }) +}) From 10febce31a1623eebc3c81a99b9de2225963d62b Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Fri, 9 Feb 2024 18:01:20 +0100 Subject: [PATCH 081/122] style: cleanup `PascalTriangle` (#1606) * tests: add missing tests for `PascalTriangle` * style: remove redundant branch in `generate` * tests: simplify tests of `PascalTriangle` --- Maths/PascalTriangle.js | 2 -- Maths/test/PascalTriangle.test.js | 24 ++++++++++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Maths/PascalTriangle.js b/Maths/PascalTriangle.js index 868e36fcac..71d782cd61 100644 --- a/Maths/PascalTriangle.js +++ b/Maths/PascalTriangle.js @@ -17,8 +17,6 @@ const generate = (numRows) => { return [] } else if (numRows === 1) { return [[1]] - } else if (numRows === 2) { - return [[1], [1, 1]] } else { for (let i = 2; i < numRows; i++) { addRow(triangle) diff --git a/Maths/test/PascalTriangle.test.js b/Maths/test/PascalTriangle.test.js index 314d0f3211..65c736f14f 100644 --- a/Maths/test/PascalTriangle.test.js +++ b/Maths/test/PascalTriangle.test.js @@ -1,20 +1,20 @@ +import { expect } from 'vitest' import { generate } from '../PascalTriangle' describe('Pascals Triangle', () => { - it('should have the the same length as the number', () => { - const pascalsTriangle = generate(5) - expect(pascalsTriangle.length).toEqual(5) - }) - it('should have same length as its index in the array', () => { - const pascalsTriangle = generate(5) + it.each([ + [0, []], + [1, [[1]]], + [2, [[1], [1, 1]]], + [3, [[1], [1, 1], [1, 2, 1]]], + [4, [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1]]], + [5, [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1]], [1, 4, 6, 4, 1]] + ])('check with %j', (input, expected) => { + const pascalsTriangle = generate(input) + expect(pascalsTriangle.length).toEqual(input) pascalsTriangle.forEach((arr, index) => { expect(arr.length).toEqual(index + 1) }) - }) - it('should return an array of arrays', () => { - const pascalsTriangle = generate(3) - expect(pascalsTriangle).toEqual( - expect.arrayContaining([[1], [1, 1], [1, 2, 1]]) - ) + expect(pascalsTriangle).toEqual(expect.arrayContaining(expected)) }) }) From 1ea7a5cd5e455011a26b07b7e43b9c5471e1e501 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Wed, 14 Feb 2024 16:43:38 +0100 Subject: [PATCH 082/122] test: add missing test for `SumOfGeometricProgression` (#1607) --- Maths/test/SumOfGeometricProgression.test.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Maths/test/SumOfGeometricProgression.test.js b/Maths/test/SumOfGeometricProgression.test.js index f459835232..0edf2b9f8e 100644 --- a/Maths/test/SumOfGeometricProgression.test.js +++ b/Maths/test/SumOfGeometricProgression.test.js @@ -8,4 +8,8 @@ describe('Sum Of Geometric Progression', () => { it('should return the sum of an infinite GP', () => { expect(sumOfGeometricProgression(2, 0.5, Infinity)).toBe(4) }) + + it('should throw when series diverges', () => { + expect(() => sumOfGeometricProgression(1, 1, Infinity)).toThrowError() + }) }) From fb0a99c15a39a222da960fc4ff0be12bdbae3517 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Mon, 19 Feb 2024 14:56:54 +0100 Subject: [PATCH 083/122] fix: throw error and add tests for `ReverseNumber` (#1608) --- Maths/ReverseNumber.js | 2 +- Maths/test/ReverseNumber.test.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 Maths/test/ReverseNumber.test.js diff --git a/Maths/ReverseNumber.js b/Maths/ReverseNumber.js index 2f29903c93..4874cb3a86 100644 --- a/Maths/ReverseNumber.js +++ b/Maths/ReverseNumber.js @@ -10,7 +10,7 @@ const ReverseNumber = (number) => { // firstly, check that input is a number or not. if (typeof number !== 'number') { - return new TypeError('Argument is not a number.') + throw new TypeError('Argument is not a number.') } // A variable for storing the reversed number. let reverseNumber = 0 diff --git a/Maths/test/ReverseNumber.test.js b/Maths/test/ReverseNumber.test.js new file mode 100644 index 0000000000..64593cbe14 --- /dev/null +++ b/Maths/test/ReverseNumber.test.js @@ -0,0 +1,16 @@ +import { ReverseNumber } from '../ReverseNumber' + +describe('ReverseNumber', () => { + it.each([ + [0, 0], + [10, 1], + [123, 321], + [100001, 100001] + ])('check with %j', (input, expected) => { + expect(expected).toEqual(ReverseNumber(input)) + }) + + it('should throw when input is not a number', () => { + expect(() => ReverseNumber('100')).toThrowError() + }) +}) From 0e0cf98ce7cc976ea31349bd4db17afef76456c4 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Tue, 27 Feb 2024 09:54:29 +0100 Subject: [PATCH 084/122] fix: cleanup `CoPrimeCheck` (#1609) --- Maths/CoPrimeCheck.js | 4 ++-- Maths/test/CoPrimeCheck.test.js | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 Maths/test/CoPrimeCheck.test.js diff --git a/Maths/CoPrimeCheck.js b/Maths/CoPrimeCheck.js index 3d9a0a3993..bade446771 100644 --- a/Maths/CoPrimeCheck.js +++ b/Maths/CoPrimeCheck.js @@ -28,13 +28,13 @@ const GetEuclidGCD = (arg1, arg2) => { const CoPrimeCheck = (firstNumber, secondNumber) => { // firstly, check that input is a number or not. if (typeof firstNumber !== 'number' || typeof secondNumber !== 'number') { - return new TypeError('Argument is not a number.') + throw new TypeError('Argument is not a number.') } /* This is the most efficient algorithm for checking co-primes if the GCD of both the numbers is 1 that means they are co-primes. */ - return GetEuclidGCD(firstNumber, secondNumber) === 1 + return GetEuclidGCD(Math.abs(firstNumber), Math.abs(secondNumber)) === 1 } export { CoPrimeCheck } diff --git a/Maths/test/CoPrimeCheck.test.js b/Maths/test/CoPrimeCheck.test.js new file mode 100644 index 0000000000..2276f055d3 --- /dev/null +++ b/Maths/test/CoPrimeCheck.test.js @@ -0,0 +1,29 @@ +import { CoPrimeCheck } from '../CoPrimeCheck' + +describe('CoPrimeCheck', () => { + it.each([ + [1, 1], + [1, 2], + [1, 3], + [1, 7], + [20, 21], + [5, 7], + [-5, -7] + ])('returns true for %j and %i', (inputA, inputB) => { + expect(CoPrimeCheck(inputA, inputB)).toBe(true) + expect(CoPrimeCheck(inputB, inputA)).toBe(true) + }) + + it.each([ + [5, 15], + [13 * 17 * 19, 17 * 23 * 29] + ])('returns false for %j and %i', (inputA, inputB) => { + expect(CoPrimeCheck(inputA, inputB)).toBe(false) + expect(CoPrimeCheck(inputB, inputA)).toBe(false) + }) + + it('should throw when any of the inputs is not a number', () => { + expect(() => CoPrimeCheck('1', 2)).toThrowError() + expect(() => CoPrimeCheck(1, '2')).toThrowError() + }) +}) From c067a34faeedeec4c2411d17548c230833230d71 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Wed, 28 Feb 2024 07:17:22 +0100 Subject: [PATCH 085/122] fix: `GetEuclidGCD(0, 0)` is `0` (#1621) --- Maths/GetEuclidGCD.js | 1 - Maths/test/GetEuclidGCD.test.js | 26 ++++++++++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Maths/GetEuclidGCD.js b/Maths/GetEuclidGCD.js index 5499057d78..31eeab42ec 100644 --- a/Maths/GetEuclidGCD.js +++ b/Maths/GetEuclidGCD.js @@ -8,7 +8,6 @@ export function GetEuclidGCD(a, b) { if (typeof a !== 'number' || typeof b !== 'number') { throw new TypeError('Arguments must be numbers') } - if (a === 0 && b === 0) return undefined // infinitely many numbers divide 0 a = Math.abs(a) b = Math.abs(b) while (b !== 0) { diff --git a/Maths/test/GetEuclidGCD.test.js b/Maths/test/GetEuclidGCD.test.js index 1639d9cb7f..a6c7cb22e6 100644 --- a/Maths/test/GetEuclidGCD.test.js +++ b/Maths/test/GetEuclidGCD.test.js @@ -1,12 +1,22 @@ import { GetEuclidGCD } from '../GetEuclidGCD' -function testEuclidGCD(n, m, expected) { - test('Testing on ' + n + ' and ' + m + '!', () => { - expect(GetEuclidGCD(n, m)).toBe(expected) +describe('GetEuclidGCD', () => { + it.each([ + [5, 20, 5], + [109, 902, 1], + [290, 780, 10], + [104, 156, 52], + [0, 100, 100], + [-5, 50, 5], + [0, 0, 0], + [1, 1234567, 1] + ])('returns correct result for %i and %j', (inputA, inputB, expected) => { + expect(GetEuclidGCD(inputA, inputB)).toBe(expected) + expect(GetEuclidGCD(inputB, inputA)).toBe(expected) }) -} -testEuclidGCD(5, 20, 5) -testEuclidGCD(109, 902, 1) -testEuclidGCD(290, 780, 10) -testEuclidGCD(104, 156, 52) + it('should throw when any of the inputs is not a number', () => { + expect(() => GetEuclidGCD('1', 2)).toThrowError() + expect(() => GetEuclidGCD(1, '2')).toThrowError() + }) +}) From a5945e37c257553bb77cbce95cb6f753ce6d1ab5 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Thu, 29 Feb 2024 05:55:11 +0100 Subject: [PATCH 086/122] fix: throw error instead of returning it (#1624) --- String/CheckFlatCase.js | 2 +- String/CheckKebabCase.js | 2 +- String/CheckPascalCase.js | 2 +- String/test/CheckCamelCase.test.js | 4 ++++ String/test/CheckFlatCase.test.js | 4 ++++ String/test/CheckKebabCase.test.js | 4 ++++ String/test/CheckPascalCase.test.js | 4 ++++ 7 files changed, 19 insertions(+), 3 deletions(-) diff --git a/String/CheckFlatCase.js b/String/CheckFlatCase.js index 709825edd1..5f8a332999 100644 --- a/String/CheckFlatCase.js +++ b/String/CheckFlatCase.js @@ -12,7 +12,7 @@ const checkFlatCase = (varname) => { // firstly, check that input is a string or not. if (typeof varname !== 'string') { - return new TypeError('Argument is not a string.') + throw new TypeError('Argument is not a string.') } const pat = /^[a-z]*$/ diff --git a/String/CheckKebabCase.js b/String/CheckKebabCase.js index 6e79ba6a5e..52d322f921 100644 --- a/String/CheckKebabCase.js +++ b/String/CheckKebabCase.js @@ -10,7 +10,7 @@ const CheckKebabCase = (varName) => { // firstly, check that input is a string or not. if (typeof varName !== 'string') { - return new TypeError('Argument is not a string.') + throw new TypeError('Argument is not a string.') } const pat = /(\w+)-(\w)([\w-]*)/ diff --git a/String/CheckPascalCase.js b/String/CheckPascalCase.js index 2e4c1ff3fa..71aaa26770 100644 --- a/String/CheckPascalCase.js +++ b/String/CheckPascalCase.js @@ -10,7 +10,7 @@ const CheckPascalCase = (VarName) => { // firstly, check that input is a string or not. if (typeof VarName !== 'string') { - return new TypeError('Argument is not a string.') + throw new TypeError('Argument is not a string.') } const pat = /^[A-Z][A-Za-z]*$/ diff --git a/String/test/CheckCamelCase.test.js b/String/test/CheckCamelCase.test.js index c1e2d83005..5875e0cd10 100644 --- a/String/test/CheckCamelCase.test.js +++ b/String/test/CheckCamelCase.test.js @@ -15,4 +15,8 @@ describe('checkCamelCase', () => { const result = checkCamelCase(value) expect(result).toBe(false) }) + + it('should throw when input is not a string', () => { + expect(() => checkCamelCase(100)).toThrowError() + }) }) diff --git a/String/test/CheckFlatCase.test.js b/String/test/CheckFlatCase.test.js index 0277f7c0e1..ccac811bf6 100644 --- a/String/test/CheckFlatCase.test.js +++ b/String/test/CheckFlatCase.test.js @@ -15,4 +15,8 @@ describe('checkFlatCase function', () => { const actual = checkFlatCase('abcdefghijklmnopqrstuvwxyz') expect(actual).toBe(true) }) + + it('should throw when input is not a string', () => { + expect(() => checkFlatCase(100)).toThrowError() + }) }) diff --git a/String/test/CheckKebabCase.test.js b/String/test/CheckKebabCase.test.js index 45bc5f2d52..239d91674e 100644 --- a/String/test/CheckKebabCase.test.js +++ b/String/test/CheckKebabCase.test.js @@ -11,3 +11,7 @@ test('CheckKebabCase(The Algorithms) -> false', () => { const res = CheckKebabCase(word) expect(res).toBeFalsy() }) + +test('CheckKebabCase throws when input is not a string', () => { + expect(() => CheckKebabCase(100)).toThrowError() +}) diff --git a/String/test/CheckPascalCase.test.js b/String/test/CheckPascalCase.test.js index 2587023f79..139b66844b 100644 --- a/String/test/CheckPascalCase.test.js +++ b/String/test/CheckPascalCase.test.js @@ -17,3 +17,7 @@ test('CheckPascalCase(The Algorithms) -> false', () => { const res = CheckPascalCase(word) expect(res).toBeFalsy() }) + +test('CheckPascalCase throws when input is not a string', () => { + expect(() => CheckPascalCase(100)).toThrowError() +}) From 8734dfccf90b835b4ca9e09579af4528934a130d Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Thu, 29 Feb 2024 06:06:08 +0100 Subject: [PATCH 087/122] fix: handle zeros in `CoPrimeCheck` (#1622) --- Maths/CoPrimeCheck.js | 15 ++------------- Maths/test/CoPrimeCheck.test.js | 8 ++++++-- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Maths/CoPrimeCheck.js b/Maths/CoPrimeCheck.js index bade446771..6f0437eaac 100644 --- a/Maths/CoPrimeCheck.js +++ b/Maths/CoPrimeCheck.js @@ -9,14 +9,7 @@ is coprime with b. */ -// Here we use a GetEuclidGCD method as a utility. -const GetEuclidGCD = (arg1, arg2) => { - let less = arg1 > arg2 ? arg2 : arg1 - for (less; less >= 2; less--) { - if (arg1 % less === 0 && arg2 % less === 0) return less - } - return less -} +import { GetEuclidGCD } from './GetEuclidGCD' // CoPrimeCheck function return the boolean in respect of the given number is co-prime or not. /** @@ -26,15 +19,11 @@ const GetEuclidGCD = (arg1, arg2) => { * @returns return correspond boolean value, if both number are co-prime return `true`, else return `false`. */ const CoPrimeCheck = (firstNumber, secondNumber) => { - // firstly, check that input is a number or not. - if (typeof firstNumber !== 'number' || typeof secondNumber !== 'number') { - throw new TypeError('Argument is not a number.') - } /* This is the most efficient algorithm for checking co-primes if the GCD of both the numbers is 1 that means they are co-primes. */ - return GetEuclidGCD(Math.abs(firstNumber), Math.abs(secondNumber)) === 1 + return GetEuclidGCD(firstNumber, secondNumber) === 1 } export { CoPrimeCheck } diff --git a/Maths/test/CoPrimeCheck.test.js b/Maths/test/CoPrimeCheck.test.js index 2276f055d3..7a46bcf6cf 100644 --- a/Maths/test/CoPrimeCheck.test.js +++ b/Maths/test/CoPrimeCheck.test.js @@ -8,7 +8,9 @@ describe('CoPrimeCheck', () => { [1, 7], [20, 21], [5, 7], - [-5, -7] + [-5, -7], + [1, 0], + [-1, 0] ])('returns true for %j and %i', (inputA, inputB) => { expect(CoPrimeCheck(inputA, inputB)).toBe(true) expect(CoPrimeCheck(inputB, inputA)).toBe(true) @@ -16,7 +18,9 @@ describe('CoPrimeCheck', () => { it.each([ [5, 15], - [13 * 17 * 19, 17 * 23 * 29] + [13 * 17 * 19, 17 * 23 * 29], + [2, 0], + [0, 0] ])('returns false for %j and %i', (inputA, inputB) => { expect(CoPrimeCheck(inputA, inputB)).toBe(false) expect(CoPrimeCheck(inputB, inputA)).toBe(false) From 894a46ca67ed25ba52297d72dbc37d2698ac4763 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Sat, 2 Mar 2024 08:54:46 +0100 Subject: [PATCH 088/122] fix: throw error instead of returning it `RailwayTimeConversion` (#1625) --- Conversions/RailwayTimeConversion.js | 2 +- Conversions/test/RailwayTimeConversion.test.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Conversions/RailwayTimeConversion.js b/Conversions/RailwayTimeConversion.js index fd4f9a5dad..15f837b0da 100644 --- a/Conversions/RailwayTimeConversion.js +++ b/Conversions/RailwayTimeConversion.js @@ -18,7 +18,7 @@ const RailwayTimeConversion = (timeString) => { // firstly, check that input is a string or not. if (typeof timeString !== 'string') { - return new TypeError('Argument is not a string.') + throw new TypeError('Argument is not a string.') } // split the string by ':' character. const [hour, minute, secondWithShift] = timeString.split(':') diff --git a/Conversions/test/RailwayTimeConversion.test.js b/Conversions/test/RailwayTimeConversion.test.js index 0e49af3b7f..6579420049 100644 --- a/Conversions/test/RailwayTimeConversion.test.js +++ b/Conversions/test/RailwayTimeConversion.test.js @@ -19,3 +19,7 @@ test('The RailwayTimeConversion of 11:20:00PM is 23:20:00', () => { const res = RailwayTimeConversion('11:20:00PM') expect(res).toEqual('23:20:00') }) + +test('The RailwayTimeConversion throws when input is not a string', () => { + expect(() => RailwayTimeConversion(1120)).toThrowError() +}) From 83b4dd82909badb19ad0a10e658ace64d69cd4da Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Sat, 2 Mar 2024 08:55:14 +0100 Subject: [PATCH 089/122] fix: cleanup `CheckKishnamurthyNumber` (#1626) --- Maths/CheckKishnamurthyNumber.js | 5 ++++- Maths/test/CheckKishnamurthyNumber.test.js | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 Maths/test/CheckKishnamurthyNumber.test.js diff --git a/Maths/CheckKishnamurthyNumber.js b/Maths/CheckKishnamurthyNumber.js index 7a0cc9a0cc..5098b0fa7f 100644 --- a/Maths/CheckKishnamurthyNumber.js +++ b/Maths/CheckKishnamurthyNumber.js @@ -24,7 +24,10 @@ const factorial = (n) => { const CheckKishnamurthyNumber = (number) => { // firstly, check that input is a number or not. if (typeof number !== 'number') { - return new TypeError('Argument is not a number.') + throw new TypeError('Argument is not a number.') + } + if (number === 0) { + return false } // create a variable to store the sum of all digits factorial. let sumOfAllDigitFactorial = 0 diff --git a/Maths/test/CheckKishnamurthyNumber.test.js b/Maths/test/CheckKishnamurthyNumber.test.js new file mode 100644 index 0000000000..4f2e0db952 --- /dev/null +++ b/Maths/test/CheckKishnamurthyNumber.test.js @@ -0,0 +1,18 @@ +import { CheckKishnamurthyNumber } from '../CheckKishnamurthyNumber' + +describe('CheckKishnamurthyNumber', () => { + it.each([1, 2, 145, 40585])('returns true for %i', (num) => { + expect(CheckKishnamurthyNumber(num)).toBe(true) + }) + + it.each([0, 3, 4, 5, 100, 146, 1019823, -1])( + 'returns false for %i', + (num) => { + expect(CheckKishnamurthyNumber(num)).toBe(false) + } + ) + + it('should throw when input is not a number', () => { + expect(() => CheckKishnamurthyNumber('2')).toThrowError() + }) +}) From 2fe0dfde23b1179a6fa5fdd7425a3f2bf303d538 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Mon, 4 Mar 2024 23:03:19 +0100 Subject: [PATCH 090/122] fix: `throw` form `DateToDay` (#1628) --- Conversions/DateToDay.js | 4 +-- Conversions/test/DateToDay.test.js | 53 +++++++++++++----------------- 2 files changed, 25 insertions(+), 32 deletions(-) diff --git a/Conversions/DateToDay.js b/Conversions/DateToDay.js index 378489e50e..f360c9c737 100644 --- a/Conversions/DateToDay.js +++ b/Conversions/DateToDay.js @@ -26,13 +26,13 @@ const daysNameArr = [ const DateToDay = (date) => { // firstly, check that input is a string or not. if (typeof date !== 'string') { - return new TypeError('Argument is not a string.') + throw new TypeError('Argument is not a string.') } // extract the date let [day, month, year] = date.split('/').map((x) => Number(x)) // check the data are valid or not. if (day < 1 || day > 31 || month > 12 || month < 1) { - return new TypeError('Date is not valid.') + throw new TypeError('Date is not valid.') } // In case of Jan and Feb: diff --git a/Conversions/test/DateToDay.test.js b/Conversions/test/DateToDay.test.js index f0809821db..38b63d33da 100644 --- a/Conversions/test/DateToDay.test.js +++ b/Conversions/test/DateToDay.test.js @@ -1,35 +1,28 @@ import { DateToDay } from '../DateToDay' -test('The date 18/02/2001 is Sunday', () => { - const res = DateToDay('18/02/2001') - expect(res).toBe('Sunday') -}) - -test('The date 18/12/2020 is Friday', () => { - const res = DateToDay('18/12/2020') - expect(res).toBe('Friday') -}) +describe('DateToDay', () => { + it.each([ + ['18/02/2001', 'Sunday'], + ['18/12/2020', 'Friday'], + ['12/12/2012', 'Wednesday'], + ['01/01/2001', 'Monday'], + ['1/1/2020', 'Wednesday'], + ['2/3/2014', 'Sunday'], + ['28/2/2017', 'Tuesday'], + ['02/03/2024', 'Saturday'], + ['29/02/2024', 'Thursday'] + ])('%s is %s', (date, day) => { + expect(DateToDay(date)).toBe(day) + }) -test('The date 12/12/2012 is Wednesday', () => { - const res = DateToDay('12/12/2012') - expect(res).toBe('Wednesday') -}) -test('The date 01/01/2001 is Monday', () => { - const res = DateToDay('01/01/2001') - expect(res).toBe('Monday') -}) - -test('The date 1/1/2020 is Wednesday', () => { - const res = DateToDay('1/1/2020') - expect(res).toBe('Wednesday') -}) - -test('The date 2/3/2014 is Sunday', () => { - const res = DateToDay('2/3/2014') - expect(res).toBe('Sunday') -}) + it('should throw when input is not a string', () => { + expect(() => DateToDay(100)).toThrowError() + }) -test('The date 28/2/2017 is Tuesday', () => { - const res = DateToDay('28/2/2017') - expect(res).toBe('Tuesday') + it.each(['32/01/2000', '00/01/2000', '15/00/2000', '15/13/2000'])( + 'should throw when input is not a correct date %s', + (wrongDate) => { + expect(() => DateToDay(wrongDate)).toThrowError() + } + ) }) From f13eec1bbb94484912d10a4e5376aacf533b3de6 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Mon, 4 Mar 2024 23:06:50 +0100 Subject: [PATCH 091/122] fix: properly floor the partial results (#1629) --- Conversions/DateDayDifference.js | 37 ++++++++---------- Conversions/test/DateDayDiffernce.test.js | 47 +++++++++++++++-------- 2 files changed, 48 insertions(+), 36 deletions(-) diff --git a/Conversions/DateDayDifference.js b/Conversions/DateDayDifference.js index 770b64c174..e03a5aa24b 100644 --- a/Conversions/DateDayDifference.js +++ b/Conversions/DateDayDifference.js @@ -14,21 +14,27 @@ const isLeap = (year) => { else return false } const DateToDay = (dd, mm, yyyy) => { - return Math.floor( + return ( 365 * (yyyy - 1) + - (yyyy - 1) / 4 - - (yyyy - 1) / 100 + - (yyyy - 1) / 400 + - dd + - (367 * mm - 362) / 12 + - (mm <= 2 ? 0 : isLeap(yyyy) ? -1 : -2) + Math.floor((yyyy - 1) / 4) - + Math.floor((yyyy - 1) / 100) + + Math.floor((yyyy - 1) / 400) + + dd + + Math.floor((367 * mm - 362) / 12) + + (mm <= 2 ? 0 : isLeap(yyyy) ? -1 : -2) ) } +const CheckDayAndMonth = (inDay, inMonth) => { + if (inDay <= 0 || inDay > 31 || inMonth <= 0 || inMonth > 12) { + throw new TypeError('Date is not valid.') + } +} + const DateDayDifference = (date1, date2) => { // firstly, check that both input are string or not. if (typeof date1 !== 'string' || typeof date2 !== 'string') { - return new TypeError('Argument is not a string.') + throw new TypeError('Argument is not a string.') } // extract the first date const [firstDateDay, firstDateMonth, firstDateYear] = date1 @@ -39,18 +45,9 @@ const DateDayDifference = (date1, date2) => { .split('/') .map((ele) => Number(ele)) // check the both data are valid or not. - if ( - firstDateDay < 0 || - firstDateDay > 31 || - firstDateMonth > 12 || - firstDateMonth < 0 || - secondDateDay < 0 || - secondDateDay > 31 || - secondDateMonth > 12 || - secondDateMonth < 0 - ) { - return new TypeError('Date is not valid.') - } + CheckDayAndMonth(firstDateDay, firstDateMonth) + CheckDayAndMonth(secondDateDay, secondDateMonth) + return Math.abs( DateToDay(secondDateDay, secondDateMonth, secondDateYear) - DateToDay(firstDateDay, firstDateMonth, firstDateYear) diff --git a/Conversions/test/DateDayDiffernce.test.js b/Conversions/test/DateDayDiffernce.test.js index 713ee1272e..a0f8834593 100644 --- a/Conversions/test/DateDayDiffernce.test.js +++ b/Conversions/test/DateDayDiffernce.test.js @@ -1,21 +1,36 @@ import { DateDayDifference } from '../DateDayDifference' -test('The difference between 17/08/2002 & 10/10/2020 is 6630', () => { - const res = DateDayDifference('17/08/2002', '10/10/2020') - expect(res).toBe(6630) -}) - -test('The difference between 18/02/2001 & 16/03/2022 is 7696', () => { - const res = DateDayDifference('18/02/2001', '16/03/2022') - expect(res).toBe(7696) -}) +describe('DateDayDifference', () => { + it.each([ + ['17/08/2002', '10/10/2020', 6629], + ['18/02/2001', '16/03/2022', 7696], + ['11/11/2011', '12/12/2012', 397], + ['01/01/2001', '16/03/2011', 3726], + ['04/03/2024', '04/03/2024', 0], + ['03/03/2024', '04/03/2024', 1], + ['02/03/2024', '04/03/2024', 2], + ['01/03/2024', '04/03/2024', 3], + ['29/02/2024', '04/03/2024', 4], + ['04/03/2024', '04/03/2025', 365], + ['04/03/2023', '04/03/2024', 366] + ])( + 'The difference between %s and %s is %i', + (firstDate, secondDate, expected) => { + expect(DateDayDifference(firstDate, secondDate)).toBe(expected) + expect(DateDayDifference(secondDate, firstDate)).toBe(expected) + } + ) -test('The difference between 11/11/2011 & 12/12/2012 is 398', () => { - const res = DateDayDifference('11/11/2011', '12/12/2012') - expect(res).toBe(398) -}) + it('should throw when any input is not a string', () => { + expect(() => DateDayDifference(10102024, '11/10/2024')).toThrowError() + expect(() => DateDayDifference('11/10/2024', 10102024)).toThrowError() + }) -test('The difference between 01/01/2001 & 16/03/2011 is 3727', () => { - const res = DateDayDifference('01/01/2001', '16/03/2011') - expect(res).toBe(3727) + it.each(['32/01/2000', '00/01/2000', '15/00/2000', '15/13/2000'])( + 'should throw when input is not a correct date %s', + (wrongDate) => { + expect(() => DateDayDifference(wrongDate, '04/03/2024')).toThrowError() + expect(() => DateDayDifference('04/03/2024', wrongDate)).toThrowError() + } + ) }) From d8cfdcd8002a58d9ec2d1c2880cbe20d5478104d Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Mon, 4 Mar 2024 23:07:16 +0100 Subject: [PATCH 092/122] chore: use `check-style` in (#1630) --- .husky/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 35ea7e3c08..037dbe870a 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,5 +1,5 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -npm run style +npm run check-style npm run test From 4a4ed57d4285fc61b5385d2c2525369ce2c4e6fb Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Thu, 7 Mar 2024 05:53:43 +0100 Subject: [PATCH 093/122] refactor: use `isLeapYear` (#1638) --- Conversions/DateDayDifference.js | 11 ++----- Timing-Functions/GetMonthDays.js | 9 +++--- Timing-Functions/test/GetMonthDays.test.js | 37 ++++++++++++++++------ 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/Conversions/DateDayDifference.js b/Conversions/DateDayDifference.js index e03a5aa24b..fef242568d 100644 --- a/Conversions/DateDayDifference.js +++ b/Conversions/DateDayDifference.js @@ -6,13 +6,8 @@ Algorithm & Explanation : https://ncalculators.com/time-date/date-difference-calculator.htm */ -// Internal method for make calculations easier -const isLeap = (year) => { - if (year % 400 === 0) return true - else if (year % 100 === 0) return false - else if (year % 4 === 0) return true - else return false -} +import { isLeapYear } from '../Maths/LeapYear' + const DateToDay = (dd, mm, yyyy) => { return ( 365 * (yyyy - 1) + @@ -21,7 +16,7 @@ const DateToDay = (dd, mm, yyyy) => { Math.floor((yyyy - 1) / 400) + dd + Math.floor((367 * mm - 362) / 12) + - (mm <= 2 ? 0 : isLeap(yyyy) ? -1 : -2) + (mm <= 2 ? 0 : isLeapYear(yyyy) ? -1 : -2) ) } diff --git a/Timing-Functions/GetMonthDays.js b/Timing-Functions/GetMonthDays.js index ce188c9603..43c2e7e6e6 100644 --- a/Timing-Functions/GetMonthDays.js +++ b/Timing-Functions/GetMonthDays.js @@ -6,6 +6,8 @@ e.g.: mahfoudh.arous.com ->false */ +import { isLeapYear } from '../Maths/LeapYear' + const getMonthDays = (monthNumber, year) => { const the31DaysMonths = [1, 3, 5, 7, 8, 10, 12] const the30DaysMonths = [4, 6, 9, 11] @@ -26,11 +28,8 @@ const getMonthDays = (monthNumber, year) => { return 30 } - // Check for Leap year - if (year % 4 === 0) { - if (year % 100 !== 0 || (year % 100 === 0 && year % 400 === 0)) { - return 29 - } + if (isLeapYear(year)) { + return 29 } return 28 diff --git a/Timing-Functions/test/GetMonthDays.test.js b/Timing-Functions/test/GetMonthDays.test.js index b7527c0ac6..1222cc4ae0 100644 --- a/Timing-Functions/test/GetMonthDays.test.js +++ b/Timing-Functions/test/GetMonthDays.test.js @@ -1,16 +1,33 @@ import { getMonthDays } from '../GetMonthDays' describe('Get the Days of a Month', () => { - it('expects to return 28', () => { - expect(getMonthDays(2, 2018)).toEqual(28) - }) - - it('expects to return 30', () => { - expect(getMonthDays(6, 254)).toEqual(30) - }) - - it('expects to return 29', () => { - expect(getMonthDays(2, 2024)).toEqual(29) + it.each([ + [1, 2024, 31], + [2, 2024, 29], + [3, 2024, 31], + [4, 2024, 30], + [5, 2024, 31], + [6, 2024, 30], + [7, 2024, 31], + [8, 2024, 31], + [9, 2024, 30], + [10, 2024, 31], + [11, 2024, 30], + [12, 2024, 31], + [1, 2023, 31], + [2, 2023, 28], + [3, 2023, 31], + [4, 2023, 30], + [5, 2023, 31], + [6, 2023, 30], + [7, 2023, 31], + [8, 2023, 31], + [9, 2023, 30], + [10, 2023, 31], + [11, 2023, 30], + [12, 2023, 31] + ])('Month %i in year %i has %i days', (month, year, expected) => { + expect(getMonthDays(month, year)).toBe(expected) }) it('expects to throw a type error', () => { From 02041984653585c09ced6f8c2a9a1d983b26797a Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Mon, 11 Mar 2024 21:26:29 +0100 Subject: [PATCH 094/122] feat: remove `twinPrime` (#1641) * tests: add missing test of `twinPrime` * feat: remove `twinPrime` --- Maths/TwinPrime.js | 29 ----------------------------- Maths/test/TwinPrime.test.js | 10 ---------- 2 files changed, 39 deletions(-) delete mode 100644 Maths/TwinPrime.js delete mode 100644 Maths/test/TwinPrime.test.js diff --git a/Maths/TwinPrime.js b/Maths/TwinPrime.js deleted file mode 100644 index 0bb17e0ebe..0000000000 --- a/Maths/TwinPrime.js +++ /dev/null @@ -1,29 +0,0 @@ -import { PrimeCheck } from './PrimeCheck' - -/** - * @function twinPrime - * Gets the 'twin prime' of a prime number. - * - * @param {Integer} n The number to find the twin prime of. - * @returns {Integer} Either the twin, or -1 if n or n + 2 is not prime. - * - * @see https://en.wikipedia.org/wiki/Twin_prime - * - * @example twinPrime(5) = 7 - * @example twinPrime(4) = -1 - */ -function twinPrime(n) { - const prime = PrimeCheck(n) - - if (!prime) { - return -1 - } - - if (!PrimeCheck(n + 2)) { - return -1 - } - - return n + 2 -} - -export { twinPrime } diff --git a/Maths/test/TwinPrime.test.js b/Maths/test/TwinPrime.test.js deleted file mode 100644 index c3e057e10e..0000000000 --- a/Maths/test/TwinPrime.test.js +++ /dev/null @@ -1,10 +0,0 @@ -import { twinPrime } from '../TwinPrime.js' - -describe('Twin Primes', () => { - it('Should be valid twin primes', () => { - expect(twinPrime(3)).toBe(5) - expect(twinPrime(5)).toBe(7) - expect(twinPrime(4)).toBe(-1) - expect(twinPrime(17)).toBe(19) - }) -}) From bd34e9fa61627853dd226d5695be57e3544a061c Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Sat, 16 Mar 2024 04:59:14 +0100 Subject: [PATCH 095/122] feat: remove duplicated `gcd`-like functions (#1642) * feat: remove duplicated `gcd`-like functions * Updated Documentation in README.md --------- Co-authored-by: vil02 --- DIRECTORY.md | 2 -- Maths/GetEuclidGCD.js | 26 +++++++++++++++++--- Maths/test/GetEuclidGCD.test.js | 43 ++++++++++++++++++--------------- Recursive/EucledianGCD.js | 30 ----------------------- 4 files changed, 46 insertions(+), 55 deletions(-) delete mode 100644 Recursive/EucledianGCD.js diff --git a/DIRECTORY.md b/DIRECTORY.md index 8b51ce3bf7..59f6273bf2 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -260,7 +260,6 @@ * [SquareRootLogarithmic](Maths/SquareRootLogarithmic.js) * [SumOfDigits](Maths/SumOfDigits.js) * [SumOfGeometricProgression](Maths/SumOfGeometricProgression.js) - * [TwinPrime](Maths/TwinPrime.js) * [TwoSum](Maths/TwoSum.js) * [Volume](Maths/Volume.js) * [WhileLoopFactorial](Maths/WhileLoopFactorial.js) @@ -296,7 +295,6 @@ * **Recursive** * [BinaryEquivalent](Recursive/BinaryEquivalent.js) * [BinarySearch](Recursive/BinarySearch.js) - * [EucledianGCD](Recursive/EucledianGCD.js) * [Factorial](Recursive/Factorial.js) * [FibonacciNumberRecursive](Recursive/FibonacciNumberRecursive.js) * [FloodFill](Recursive/FloodFill.js) diff --git a/Maths/GetEuclidGCD.js b/Maths/GetEuclidGCD.js index 31eeab42ec..42a30a6042 100644 --- a/Maths/GetEuclidGCD.js +++ b/Maths/GetEuclidGCD.js @@ -1,3 +1,9 @@ +function CheckInput(a, b) { + if (typeof a !== 'number' || typeof b !== 'number') { + throw new TypeError('Arguments must be numbers') + } +} + /** * GetEuclidGCD Euclidean algorithm to determine the GCD of two numbers * @param {Number} a integer (may be negative) @@ -5,9 +11,7 @@ * @returns {Number} Greatest Common Divisor gcd(a, b) */ export function GetEuclidGCD(a, b) { - if (typeof a !== 'number' || typeof b !== 'number') { - throw new TypeError('Arguments must be numbers') - } + CheckInput(a, b) a = Math.abs(a) b = Math.abs(b) while (b !== 0) { @@ -17,3 +21,19 @@ export function GetEuclidGCD(a, b) { } return a } + +/** + * Recursive version of GetEuclidGCD + * @param {Number} a integer (may be negative) + * @param {Number} b integer (may be negative) + * @returns {Number} Greatest Common Divisor gcd(a, b) + */ +export function GetEuclidGCDRecursive(a, b) { + CheckInput(a, b) + a = Math.abs(a) + b = Math.abs(b) + if (b == 0) { + return a + } + return GetEuclidGCDRecursive(b, a % b) +} diff --git a/Maths/test/GetEuclidGCD.test.js b/Maths/test/GetEuclidGCD.test.js index a6c7cb22e6..070a8479e3 100644 --- a/Maths/test/GetEuclidGCD.test.js +++ b/Maths/test/GetEuclidGCD.test.js @@ -1,22 +1,25 @@ -import { GetEuclidGCD } from '../GetEuclidGCD' +import { GetEuclidGCD, GetEuclidGCDRecursive } from '../GetEuclidGCD' -describe('GetEuclidGCD', () => { - it.each([ - [5, 20, 5], - [109, 902, 1], - [290, 780, 10], - [104, 156, 52], - [0, 100, 100], - [-5, 50, 5], - [0, 0, 0], - [1, 1234567, 1] - ])('returns correct result for %i and %j', (inputA, inputB, expected) => { - expect(GetEuclidGCD(inputA, inputB)).toBe(expected) - expect(GetEuclidGCD(inputB, inputA)).toBe(expected) - }) +describe.each([GetEuclidGCD, GetEuclidGCDRecursive])( + '%# GetEuclidGCD', + (gcdFunction) => { + it.each([ + [5, 20, 5], + [109, 902, 1], + [290, 780, 10], + [104, 156, 52], + [0, 100, 100], + [-5, 50, 5], + [0, 0, 0], + [1, 1234567, 1] + ])('returns correct result for %i and %j', (inputA, inputB, expected) => { + expect(gcdFunction(inputA, inputB)).toBe(expected) + expect(gcdFunction(inputB, inputA)).toBe(expected) + }) - it('should throw when any of the inputs is not a number', () => { - expect(() => GetEuclidGCD('1', 2)).toThrowError() - expect(() => GetEuclidGCD(1, '2')).toThrowError() - }) -}) + it('should throw when any of the inputs is not a number', () => { + expect(() => gcdFunction('1', 2)).toThrowError() + expect(() => gcdFunction(1, '2')).toThrowError() + }) + } +) diff --git a/Recursive/EucledianGCD.js b/Recursive/EucledianGCD.js deleted file mode 100644 index e0cc15ed56..0000000000 --- a/Recursive/EucledianGCD.js +++ /dev/null @@ -1,30 +0,0 @@ -function euclideanGCDRecursive(first, second) { - /* - Calculates GCD of two numbers using Euclidean Recursive Algorithm - :param first: First number - :param second: Second number - :return: GCD of the numbers - */ - if (second === 0) { - return first - } else { - return euclideanGCDRecursive(second, first % second) - } -} - -function euclideanGCDIterative(first, second) { - /* - Calculates GCD of two numbers using Euclidean Iterative Algorithm - :param first: First number - :param second: Second number - :return: GCD of the numbers - */ - while (second !== 0) { - const temp = second - second = first % second - first = temp - } - return first -} - -export { euclideanGCDIterative, euclideanGCDRecursive } From 702840b4c8b6582e6ee8ef0521b49b4b2db04225 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Thu, 28 Mar 2024 12:12:40 +0100 Subject: [PATCH 096/122] style: improve test names of `GetEuclidGCD'` (#1646) --- Maths/test/GetEuclidGCD.test.js | 41 +++++++++++++++------------------ 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/Maths/test/GetEuclidGCD.test.js b/Maths/test/GetEuclidGCD.test.js index 070a8479e3..92f888acea 100644 --- a/Maths/test/GetEuclidGCD.test.js +++ b/Maths/test/GetEuclidGCD.test.js @@ -1,25 +1,22 @@ import { GetEuclidGCD, GetEuclidGCDRecursive } from '../GetEuclidGCD' -describe.each([GetEuclidGCD, GetEuclidGCDRecursive])( - '%# GetEuclidGCD', - (gcdFunction) => { - it.each([ - [5, 20, 5], - [109, 902, 1], - [290, 780, 10], - [104, 156, 52], - [0, 100, 100], - [-5, 50, 5], - [0, 0, 0], - [1, 1234567, 1] - ])('returns correct result for %i and %j', (inputA, inputB, expected) => { - expect(gcdFunction(inputA, inputB)).toBe(expected) - expect(gcdFunction(inputB, inputA)).toBe(expected) - }) +describe.each([GetEuclidGCD, GetEuclidGCDRecursive])('%o', (gcdFunction) => { + it.each([ + [5, 20, 5], + [109, 902, 1], + [290, 780, 10], + [104, 156, 52], + [0, 100, 100], + [-5, 50, 5], + [0, 0, 0], + [1, 1234567, 1] + ])('returns correct result for %i and %j', (inputA, inputB, expected) => { + expect(gcdFunction(inputA, inputB)).toBe(expected) + expect(gcdFunction(inputB, inputA)).toBe(expected) + }) - it('should throw when any of the inputs is not a number', () => { - expect(() => gcdFunction('1', 2)).toThrowError() - expect(() => gcdFunction(1, '2')).toThrowError() - }) - } -) + it('should throw when any of the inputs is not a number', () => { + expect(() => gcdFunction('1', 2)).toThrowError() + expect(() => gcdFunction(1, '2')).toThrowError() + }) +}) From 34a663aca7c93aa3de3bd190e0f6cc467be75aa6 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Wed, 3 Apr 2024 17:18:45 +0200 Subject: [PATCH 097/122] fix: hadnle zeros at the endpoints in `BisectionMethod` (#1640) * fix: hadnle zeros at the endpoints * style: use simpler syntax express polynomials Co-authored-by: appgurueu <34514239+appgurueu@users.noreply.github.com> --------- Co-authored-by: appgurueu <34514239+appgurueu@users.noreply.github.com> --- Maths/BisectionMethod.js | 9 ++++----- Maths/test/BisectionMethod.test.js | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Maths/BisectionMethod.js b/Maths/BisectionMethod.js index 49b8c8ecc0..4539e6d466 100644 --- a/Maths/BisectionMethod.js +++ b/Maths/BisectionMethod.js @@ -23,7 +23,7 @@ const findRoot = (a, b, func, numberOfIterations) => { // Bolzano theorem const hasRoot = (a, b, func) => { - return func(a) * func(b) < 0 + return func(a) * func(b) <= 0 } if (hasRoot(a, b, func) === false) { throw Error( @@ -45,10 +45,9 @@ const findRoot = (a, b, func, numberOfIterations) => { const prod2 = fm * func(b) // Depending on the sign of the products above, decide which position will m fill (a's or b's) - if (prod1 > 0 && prod2 < 0) return findRoot(m, b, func, --numberOfIterations) - else if (prod1 < 0 && prod2 > 0) - return findRoot(a, m, func, --numberOfIterations) - else throw Error('Unexpected behavior') + if (prod2 <= 0) return findRoot(m, b, func, --numberOfIterations) + + return findRoot(a, m, func, --numberOfIterations) } export { findRoot } diff --git a/Maths/test/BisectionMethod.test.js b/Maths/test/BisectionMethod.test.js index ad865b6ad6..4a49e8f6a4 100644 --- a/Maths/test/BisectionMethod.test.js +++ b/Maths/test/BisectionMethod.test.js @@ -1,14 +1,7 @@ import { findRoot } from '../BisectionMethod' test('Equation f(x) = x^2 - 3*x + 2 = 0, has root x = 1 in [a, b] = [0, 1.5]', () => { - const root = findRoot( - 0, - 1.5, - (x) => { - return Math.pow(x, 2) - 3 * x + 2 - }, - 8 - ) + const root = findRoot(0, 1.5, (x) => x ** 2 - 3 * x + 2, 8) expect(root).toBe(0.9990234375) }) @@ -35,3 +28,12 @@ test('Equation f(x) = sqrt(x) + e^(2*x) - 8*x = 0, has root x = 0.93945851 in [a ) expect(Number(Number(root).toPrecision(8))).toBe(0.93945851) }) + +test('Equation f(x) = x^3 = 0, has root x = 0.0 in [a, b] = [-1.0, 1.0]', () => { + const root = findRoot(-1.0, 1.0, (x) => x ** 3, 32) + expect(root).toBeCloseTo(0.0, 5) +}) + +test('Throws an error when function does not change sign', () => { + expect(() => findRoot(-1.0, 1.0, (x) => x ** 2, 10)).toThrowError() +}) From 9c622dd0894693adedf18e79310185dd3ff80ecb Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Wed, 3 Apr 2024 17:19:26 +0200 Subject: [PATCH 098/122] refactor: add and use `parseDate` (#1643) * refactor: add and use `parseDate` * style: use proper spelling Co-authored-by: appgurueu <34514239+appgurueu@users.noreply.github.com> --------- Co-authored-by: appgurueu <34514239+appgurueu@users.noreply.github.com> --- Conversions/DateDayDifference.js | 28 ++++------------- Conversions/DateToDay.js | 15 ++++------ Timing-Functions/ParseDate.js | 27 +++++++++++++++++ Timing-Functions/test/ParseDate.test.js | 40 +++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 32 deletions(-) create mode 100644 Timing-Functions/ParseDate.js create mode 100644 Timing-Functions/test/ParseDate.test.js diff --git a/Conversions/DateDayDifference.js b/Conversions/DateDayDifference.js index fef242568d..726a634253 100644 --- a/Conversions/DateDayDifference.js +++ b/Conversions/DateDayDifference.js @@ -7,6 +7,7 @@ */ import { isLeapYear } from '../Maths/LeapYear' +import { parseDate } from '../Timing-Functions/ParseDate' const DateToDay = (dd, mm, yyyy) => { return ( @@ -20,32 +21,13 @@ const DateToDay = (dd, mm, yyyy) => { ) } -const CheckDayAndMonth = (inDay, inMonth) => { - if (inDay <= 0 || inDay > 31 || inMonth <= 0 || inMonth > 12) { - throw new TypeError('Date is not valid.') - } -} - const DateDayDifference = (date1, date2) => { - // firstly, check that both input are string or not. - if (typeof date1 !== 'string' || typeof date2 !== 'string') { - throw new TypeError('Argument is not a string.') - } - // extract the first date - const [firstDateDay, firstDateMonth, firstDateYear] = date1 - .split('/') - .map((ele) => Number(ele)) - // extract the second date - const [secondDateDay, secondDateMonth, secondDateYear] = date2 - .split('/') - .map((ele) => Number(ele)) - // check the both data are valid or not. - CheckDayAndMonth(firstDateDay, firstDateMonth) - CheckDayAndMonth(secondDateDay, secondDateMonth) + const firstDate = parseDate(date1) + const secondDate = parseDate(date2) return Math.abs( - DateToDay(secondDateDay, secondDateMonth, secondDateYear) - - DateToDay(firstDateDay, firstDateMonth, firstDateYear) + DateToDay(secondDate.day, secondDate.month, secondDate.year) - + DateToDay(firstDate.day, firstDate.month, firstDate.year) ) } diff --git a/Conversions/DateToDay.js b/Conversions/DateToDay.js index f360c9c737..96ec01e82d 100644 --- a/Conversions/DateToDay.js +++ b/Conversions/DateToDay.js @@ -12,6 +12,8 @@ Algorithm & Explanation : https://en.wikipedia.org/wiki/Zeller%27s_congruence */ +import { parseDate } from '../Timing-Functions/ParseDate' + // Array holding name of the day: Saturday - Sunday - Friday => 0 - 1 - 6 const daysNameArr = [ 'Saturday', @@ -25,15 +27,10 @@ const daysNameArr = [ const DateToDay = (date) => { // firstly, check that input is a string or not. - if (typeof date !== 'string') { - throw new TypeError('Argument is not a string.') - } - // extract the date - let [day, month, year] = date.split('/').map((x) => Number(x)) - // check the data are valid or not. - if (day < 1 || day > 31 || month > 12 || month < 1) { - throw new TypeError('Date is not valid.') - } + const dateStruct = parseDate(date) + let year = dateStruct.year + let month = dateStruct.month + let day = dateStruct.day // In case of Jan and Feb: // Year: we consider it as previous year diff --git a/Timing-Functions/ParseDate.js b/Timing-Functions/ParseDate.js new file mode 100644 index 0000000000..67f4e4cd0e --- /dev/null +++ b/Timing-Functions/ParseDate.js @@ -0,0 +1,27 @@ +import { getMonthDays } from './GetMonthDays' + +function checkDate(date) { + if (date.day < 1 || date.day > getMonthDays(date.month, date.year)) { + throw new Error('Invalid day value.') + } +} + +function parseDate(dateString) { + const regex = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/ + + const match = dateString.match(regex) + + if (!match) { + throw new Error("Invalid date format. Please use 'dd/mm/yyyy'.") + } + + const res = { + day: parseInt(match[1], 10), + month: parseInt(match[2], 10), + year: parseInt(match[3], 10) + } + checkDate(res) + return res +} + +export { parseDate } diff --git a/Timing-Functions/test/ParseDate.test.js b/Timing-Functions/test/ParseDate.test.js new file mode 100644 index 0000000000..3b807bb8a5 --- /dev/null +++ b/Timing-Functions/test/ParseDate.test.js @@ -0,0 +1,40 @@ +import { parseDate } from '../ParseDate' + +describe('parseDate', () => { + it.each([ + ['18/03/2024', { year: 2024, month: 3, day: 18 }], + ['29/02/2024', { year: 2024, month: 2, day: 29 }], + ['28/02/2023', { year: 2023, month: 2, day: 28 }], + ['01/12/2024', { year: 2024, month: 12, day: 1 }], + ['1/12/2024', { year: 2024, month: 12, day: 1 }], + ['10/1/2024', { year: 2024, month: 1, day: 10 }] + ])('Returns correct output for %s', (dateString, expected) => { + expect(parseDate(dateString)).toStrictEqual(expected) + }) + + it.each([ + '18-03-2024', + '18.03.2024', + '03/2024', + '01/02/03/2024', + '123/03/2024' + ])('Throws for %s', (wrongDateString) => { + expect(() => { + parseDate(wrongDateString) + }).toThrow() + }) + + it.each([ + '40/03/2024', + '30/02/2024', + '29/02/2023', + '31/04/2023', + '00/01/2024', + '01/00/2024', + '01/13/2024' + ])('Throws for %s', (wrongDateString) => { + expect(() => { + parseDate(wrongDateString) + }).toThrow() + }) +}) From d02e402972c643093701a05138dccb0ce0957754 Mon Sep 17 00:00:00 2001 From: SourabhHere Date: Wed, 3 Apr 2024 20:50:00 +0530 Subject: [PATCH 099/122] removed code already present in test cases related to DFT in Trees folder (#1648) --- Trees/DepthFirstSearch.js | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/Trees/DepthFirstSearch.js b/Trees/DepthFirstSearch.js index 7c67afc95e..f4ce2cfed5 100644 --- a/Trees/DepthFirstSearch.js +++ b/Trees/DepthFirstSearch.js @@ -44,30 +44,4 @@ function searchDFS(tree, value) { return null } -const tree = [ - { value: 6, left: 1, right: 2 }, - { value: 5, left: 3, right: 4 }, - { value: 7, left: null, right: 5 }, - { value: 3, left: 6, right: null }, - { value: 4, left: null, right: null }, - { value: 9, left: 7, right: 8 }, - { value: 2, left: 9, right: null }, - { value: 8, left: null, right: null }, - { value: 10, left: null, right: null }, - { value: 1, left: null, right: null } -] -searchDFS(tree, 9) // { value: 9, left: 7, right: 8 } -searchDFS(tree, 200) // null -traverseDFS(tree, 6) // [ 1, 2, 3, 4, 5, 8, 10, 9, 7, 6 ] -traverseDFS(tree, 200) // [] - -// 6 -// / \ -// 5 7 -// / \ \ -// 3 4 9 -// / / \ -// 2 8 10 -// / -// 1 export { searchDFS, traverseDFS } From d920e7f4276f982fcad8016a9c63435cd346e6bd Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Wed, 3 Apr 2024 17:24:06 +0200 Subject: [PATCH 100/122] refactor: reduce code duplication in `FloodFill` (#1645) * tests: add tests checking if floodFill funtions throw when location is outside * refactor: reduce code duplication by adding `checkLocation` to `FloodFill` * refactor: add and use `isInside` Co-authored-by: appgurueu <34514239+appgurueu@users.noreply.github.com> * Deduplicate further --------- Co-authored-by: appgurueu <34514239+appgurueu@users.noreply.github.com> --- Recursive/FloodFill.js | 59 +++++++++++++++----------------- Recursive/test/FloodFill.test.js | 13 +++++++ 2 files changed, 41 insertions(+), 31 deletions(-) diff --git a/Recursive/FloodFill.js b/Recursive/FloodFill.js index 33ea6025ad..5143b8f4ff 100644 --- a/Recursive/FloodFill.js +++ b/Recursive/FloodFill.js @@ -9,7 +9,7 @@ * @see https://www.techiedelight.com/flood-fill-algorithm/ */ -const neighbors = [ +const neighborOffsets = [ [-1, -1], [-1, 0], [-1, 1], @@ -20,6 +20,27 @@ const neighbors = [ [1, 1] ] +function isInside(rgbData, location) { + const x = location[0] + const y = location[1] + return x >= 0 && x < rgbData.length && y >= 0 && y < rgbData[0].length +} + +function checkLocation(rgbData, location) { + if (!isInside(rgbData, location)) { + throw new Error('location should point to a pixel within the rgbData') + } +} + +function* neighbors(rgbData, location) { + for (const offset of neighborOffsets) { + const neighborLocation = [location[0] + offset[0], location[1] + offset[1]] + if (isInside(rgbData, neighborLocation)) { + yield neighborLocation + } + } +} + /** * Implements the flood fill algorithm through a breadth-first approach using a queue. * @@ -34,14 +55,7 @@ export function breadthFirstSearch( targetColor, replacementColor ) { - if ( - location[0] < 0 || - location[0] >= rgbData.length || - location[1] < 0 || - location[1] >= rgbData[0].length - ) { - throw new Error('location should point to a pixel within the rgbData') - } + checkLocation(rgbData, location) const queue = [] queue.push(location) @@ -65,14 +79,7 @@ export function depthFirstSearch( targetColor, replacementColor ) { - if ( - location[0] < 0 || - location[0] >= rgbData.length || - location[1] < 0 || - location[1] >= rgbData[0].length - ) { - throw new Error('location should point to a pixel within the rgbData') - } + checkLocation(rgbData, location) depthFirstFill(rgbData, location, targetColor, replacementColor) } @@ -98,13 +105,8 @@ function breadthFirstFill( if (rgbData[currentLocation[0]][currentLocation[1]] === targetColor) { rgbData[currentLocation[0]][currentLocation[1]] = replacementColor - - for (let i = 0; i < neighbors.length; i++) { - const x = currentLocation[0] + neighbors[i][0] - const y = currentLocation[1] + neighbors[i][1] - if (x >= 0 && x < rgbData.length && y >= 0 && y < rgbData[0].length) { - queue.push([x, y]) - } + for (const neighborLocation of neighbors(rgbData, currentLocation)) { + queue.push(neighborLocation) } } } @@ -120,13 +122,8 @@ function breadthFirstFill( function depthFirstFill(rgbData, location, targetColor, replacementColor) { if (rgbData[location[0]][location[1]] === targetColor) { rgbData[location[0]][location[1]] = replacementColor - - for (let i = 0; i < neighbors.length; i++) { - const x = location[0] + neighbors[i][0] - const y = location[1] + neighbors[i][1] - if (x >= 0 && x < rgbData.length && y >= 0 && y < rgbData[0].length) { - depthFirstFill(rgbData, [x, y], targetColor, replacementColor) - } + for (const neighborLocation of neighbors(rgbData, location)) { + depthFirstFill(rgbData, neighborLocation, targetColor, replacementColor) } } } diff --git a/Recursive/test/FloodFill.test.js b/Recursive/test/FloodFill.test.js index 291788addd..618692dd97 100644 --- a/Recursive/test/FloodFill.test.js +++ b/Recursive/test/FloodFill.test.js @@ -21,6 +21,19 @@ describe('FloodFill', () => { }) }) +describe.each([breadthFirstSearch, depthFirstSearch])('%o', (floodFillFun) => { + it.each([ + [1, -1], + [-1, 1], + [0, 7], + [7, 0] + ])('throws for start position [%i, %i]', (location) => { + expect(() => + floodFillFun(generateTestRgbData(), location, green, orange) + ).toThrowError() + }) +}) + /** * Utility-function to test the function "breadthFirstSearch". * From 314144fae69100c9cf03845434c801f72e4d7714 Mon Sep 17 00:00:00 2001 From: Martin Beacham Date: Wed, 3 Apr 2024 11:25:30 -0400 Subject: [PATCH 101/122] Update CircularQueue.js for zero-length case (#1655) * Update CircularQueue.js * Update CircularQueue.js Taking comments into account for refactoring my change. * Update CircularQueue.js Adding "this" to checkEmpty() --- Data-Structures/Queue/CircularQueue.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data-Structures/Queue/CircularQueue.js b/Data-Structures/Queue/CircularQueue.js index 27f2196780..c716251668 100644 --- a/Data-Structures/Queue/CircularQueue.js +++ b/Data-Structures/Queue/CircularQueue.js @@ -77,7 +77,7 @@ class CircularQueue { // Displays the length of queue length() { - return this.queue.length - 1 + return this.checkEmpty() ? 0 : this.queue.length - 1 } // Display the top most value of queue From 6fe21d21e92d4f07b476d56fbcad838633e74550 Mon Sep 17 00:00:00 2001 From: Hasan Al-Kaf Date: Sat, 13 Apr 2024 20:51:54 +0300 Subject: [PATCH 102/122] chore: convert functions to an ES2015 classes (#1656) * chore: convert functions to an ES2015 classes * remove unnecessary functions --- Conversions/RailwayTimeConversion.js | 4 +- Data-Structures/Array/Reverse.js | 8 +- Data-Structures/Stack/Stack.js | 18 +- Data-Structures/Tree/AVLTree.js | 329 +++++++++--------- Data-Structures/Tree/BinarySearchTree.js | 184 +++++----- Data-Structures/Tree/Trie.js | 215 ++++++------ .../NumberOfSubsetEqualToGivenSum.js | 2 +- Project-Euler/Problem004.js | 2 +- 8 files changed, 384 insertions(+), 378 deletions(-) diff --git a/Conversions/RailwayTimeConversion.js b/Conversions/RailwayTimeConversion.js index 15f837b0da..b499023223 100644 --- a/Conversions/RailwayTimeConversion.js +++ b/Conversions/RailwayTimeConversion.js @@ -24,8 +24,8 @@ const RailwayTimeConversion = (timeString) => { const [hour, minute, secondWithShift] = timeString.split(':') // split second and shift value. const [second, shift] = [ - secondWithShift.substr(0, 2), - secondWithShift.substr(2) + secondWithShift.substring(0, 2), + secondWithShift.substring(2) ] // convert shifted time to not-shift time(Railway time) by using the above explanation. if (shift === 'PM') { diff --git a/Data-Structures/Array/Reverse.js b/Data-Structures/Array/Reverse.js index 79a789c017..ca08f35f8a 100644 --- a/Data-Structures/Array/Reverse.js +++ b/Data-Structures/Array/Reverse.js @@ -7,11 +7,9 @@ const Reverse = (arr) => { // limit specifies the amount of Reverse actions - for (let i = 0, j = arr.length - 1; i < arr.length / 2; i++, j--) { - const temp = arr[i] - arr[i] = arr[j] - arr[j] = temp - } + for (let i = 0, j = arr.length - 1; i < arr.length / 2; i++, j--) + [arr[i], arr[j]] = [arr[j], arr[i]] + return arr } export { Reverse } diff --git a/Data-Structures/Stack/Stack.js b/Data-Structures/Stack/Stack.js index d3001e8020..d8531fdebf 100644 --- a/Data-Structures/Stack/Stack.js +++ b/Data-Structures/Stack/Stack.js @@ -8,8 +8,8 @@ // Functions: push, pop, peek, view, length // Creates a stack constructor -const Stack = (function () { - function Stack() { +class Stack { + constructor() { // The top of the Stack this.top = 0 // The array representation of the stack @@ -17,13 +17,13 @@ const Stack = (function () { } // Adds a value onto the end of the stack - Stack.prototype.push = function (value) { + push(value) { this.stack[this.top] = value this.top++ } // Removes and returns the value at the end of the stack - Stack.prototype.pop = function () { + pop() { if (this.top === 0) { return 'Stack is Empty' } @@ -35,23 +35,21 @@ const Stack = (function () { } // Returns the size of the stack - Stack.prototype.size = function () { + size() { return this.top } // Returns the value at the end of the stack - Stack.prototype.peek = function () { + peek() { return this.stack[this.top - 1] } // To see all the elements in the stack - Stack.prototype.view = function (output = (value) => console.log(value)) { + view(output = (value) => console.log(value)) { for (let i = 0; i < this.top; i++) { output(this.stack[i]) } } - - return Stack -})() +} export { Stack } diff --git a/Data-Structures/Tree/AVLTree.js b/Data-Structures/Tree/AVLTree.js index e5abbf3e55..dd673a9330 100644 --- a/Data-Structures/Tree/AVLTree.js +++ b/Data-Structures/Tree/AVLTree.js @@ -31,8 +31,8 @@ let utils * @argument comp - A function used by AVL Tree For Comparison * If no argument is sent it uses utils.comparator */ -const AVLTree = (function () { - function _avl(comp) { +class AVLTree { + constructor(comp) { /** @public comparator function */ this._comp = undefined this._comp = comp !== undefined ? comp : utils.comparator() @@ -43,162 +43,6 @@ const AVLTree = (function () { this.size = 0 } - // creates new Node Object - const Node = function (val) { - this._val = val - this._left = null - this._right = null - this._height = 1 - } - - // get height of a node - const getHeight = function (node) { - if (node == null) { - return 0 - } - return node._height - } - - // height difference or balance factor of a node - const getHeightDifference = function (node) { - return node == null ? 0 : getHeight(node._left) - getHeight(node._right) - } - - // update height of a node based on children's heights - const updateHeight = function (node) { - if (node == null) { - return - } - node._height = Math.max(getHeight(node._left), getHeight(node._right)) + 1 - } - - // Helper: To check if the balanceFactor is valid - const isValidBalanceFactor = (balanceFactor) => - [0, 1, -1].includes(balanceFactor) - - // rotations of AVL Tree - const leftRotate = function (node) { - const temp = node._right - node._right = temp._left - temp._left = node - updateHeight(node) - updateHeight(temp) - return temp - } - const rightRotate = function (node) { - const temp = node._left - node._left = temp._right - temp._right = node - updateHeight(node) - updateHeight(temp) - return temp - } - - // check if tree is balanced else balance it for insertion - const insertBalance = function (node, _val, balanceFactor, tree) { - if (balanceFactor > 1 && tree._comp(_val, node._left._val) < 0) { - return rightRotate(node) // Left Left Case - } - if (balanceFactor < 1 && tree._comp(_val, node._right._val) > 0) { - return leftRotate(node) // Right Right Case - } - if (balanceFactor > 1 && tree._comp(_val, node._left._val) > 0) { - node._left = leftRotate(node._left) // Left Right Case - return rightRotate(node) - } - node._right = rightRotate(node._right) - return leftRotate(node) - } - - // check if tree is balanced after deletion - const delBalance = function (node) { - const balanceFactor1 = getHeightDifference(node) - if (isValidBalanceFactor(balanceFactor1)) { - return node - } - if (balanceFactor1 > 1) { - if (getHeightDifference(node._left) >= 0) { - return rightRotate(node) // Left Left - } - node._left = leftRotate(node._left) - return rightRotate(node) // Left Right - } - if (getHeightDifference(node._right) > 0) { - node._right = rightRotate(node._right) - return leftRotate(node) // Right Left - } - return leftRotate(node) // Right Right - } - - // implement avl tree insertion - const insert = function (root, val, tree) { - if (root == null) { - tree.size++ - return new Node(val) - } - if (tree._comp(root._val, val) < 0) { - root._right = insert(root._right, val, tree) - } else if (tree._comp(root._val, val) > 0) { - root._left = insert(root._left, val, tree) - } else { - return root - } - updateHeight(root) - const balanceFactor = getHeightDifference(root) - return isValidBalanceFactor(balanceFactor) - ? root - : insertBalance(root, val, balanceFactor, tree) - } - - // delete am element - const deleteElement = function (root, _val, tree) { - if (root == null) { - return root - } - if (tree._comp(root._val, _val) === 0) { - // key found case - if (root._left === null && root._right === null) { - root = null - tree.size-- - } else if (root._left === null) { - root = root._right - tree.size-- - } else if (root._right === null) { - root = root._left - tree.size-- - } else { - let temp = root._right - while (temp._left != null) { - temp = temp._left - } - root._val = temp._val - root._right = deleteElement(root._right, temp._val, tree) - } - } else { - if (tree._comp(root._val, _val) < 0) { - root._right = deleteElement(root._right, _val, tree) - } else { - root._left = deleteElement(root._left, _val, tree) - } - } - updateHeight(root) - root = delBalance(root) - return root - } - // search tree for a element - const searchAVLTree = function (root, val, tree) { - if (root == null) { - return null - } - if (tree._comp(root._val, val) === 0) { - return root - } - if (tree._comp(root._val, val) < 0) { - return searchAVLTree(root._right, val, tree) - } - return searchAVLTree(root._left, val, tree) - } - /* Public Functions */ /** * For Adding Elements to AVL Tree @@ -207,20 +51,22 @@ const AVLTree = (function () { * if a element exists it return false * @returns {Boolean} element added or not */ - _avl.prototype.add = function (_val) { + add(_val) { const prevSize = this.size this.root = insert(this.root, _val, this) return this.size !== prevSize } + /** * TO check is a particular element exists or not * @param {any} _val * @returns {Boolean} exists or not */ - _avl.prototype.find = function (_val) { + find(_val) { const temp = searchAVLTree(this.root, _val, this) return temp != null } + /** * * @param {any} _val @@ -228,13 +74,170 @@ const AVLTree = (function () { * in that case it return false * @returns {Boolean} if element was found and deleted */ - _avl.prototype.remove = function (_val) { + remove(_val) { const prevSize = this.size this.root = deleteElement(this.root, _val, this) return prevSize !== this.size } - return _avl -})() +} + +// creates new Node Object +class Node { + constructor(val) { + this._val = val + this._left = null + this._right = null + this._height = 1 + } +} + +// get height of a node +const getHeight = function (node) { + if (node == null) { + return 0 + } + return node._height +} + +// height difference or balance factor of a node +const getHeightDifference = function (node) { + return node == null ? 0 : getHeight(node._left) - getHeight(node._right) +} + +// update height of a node based on children's heights +const updateHeight = function (node) { + if (node == null) { + return + } + node._height = Math.max(getHeight(node._left), getHeight(node._right)) + 1 +} + +// Helper: To check if the balanceFactor is valid +const isValidBalanceFactor = (balanceFactor) => + [0, 1, -1].includes(balanceFactor) + +// rotations of AVL Tree +const leftRotate = function (node) { + const temp = node._right + node._right = temp._left + temp._left = node + updateHeight(node) + updateHeight(temp) + return temp +} +const rightRotate = function (node) { + const temp = node._left + node._left = temp._right + temp._right = node + updateHeight(node) + updateHeight(temp) + return temp +} + +// check if tree is balanced else balance it for insertion +const insertBalance = function (node, _val, balanceFactor, tree) { + if (balanceFactor > 1 && tree._comp(_val, node._left._val) < 0) { + return rightRotate(node) // Left Left Case + } + if (balanceFactor < 1 && tree._comp(_val, node._right._val) > 0) { + return leftRotate(node) // Right Right Case + } + if (balanceFactor > 1 && tree._comp(_val, node._left._val) > 0) { + node._left = leftRotate(node._left) // Left Right Case + return rightRotate(node) + } + node._right = rightRotate(node._right) + return leftRotate(node) +} + +// check if tree is balanced after deletion +const delBalance = function (node) { + const balanceFactor1 = getHeightDifference(node) + if (isValidBalanceFactor(balanceFactor1)) { + return node + } + if (balanceFactor1 > 1) { + if (getHeightDifference(node._left) >= 0) { + return rightRotate(node) // Left Left + } + node._left = leftRotate(node._left) + return rightRotate(node) // Left Right + } + if (getHeightDifference(node._right) > 0) { + node._right = rightRotate(node._right) + return leftRotate(node) // Right Left + } + return leftRotate(node) // Right Right +} + +// implement avl tree insertion +const insert = function (root, val, tree) { + if (root == null) { + tree.size++ + return new Node(val) + } + if (tree._comp(root._val, val) < 0) { + root._right = insert(root._right, val, tree) + } else if (tree._comp(root._val, val) > 0) { + root._left = insert(root._left, val, tree) + } else { + return root + } + updateHeight(root) + const balanceFactor = getHeightDifference(root) + return isValidBalanceFactor(balanceFactor) + ? root + : insertBalance(root, val, balanceFactor, tree) +} + +// delete am element +const deleteElement = function (root, _val, tree) { + if (root == null) { + return root + } + if (tree._comp(root._val, _val) === 0) { + // key found case + if (root._left === null && root._right === null) { + root = null + tree.size-- + } else if (root._left === null) { + root = root._right + tree.size-- + } else if (root._right === null) { + root = root._left + tree.size-- + } else { + let temp = root._right + while (temp._left != null) { + temp = temp._left + } + root._val = temp._val + root._right = deleteElement(root._right, temp._val, tree) + } + } else { + if (tree._comp(root._val, _val) < 0) { + root._right = deleteElement(root._right, _val, tree) + } else { + root._left = deleteElement(root._left, _val, tree) + } + } + updateHeight(root) + root = delBalance(root) + return root +} +// search tree for a element +const searchAVLTree = function (root, val, tree) { + if (root == null) { + return null + } + if (tree._comp(root._val, val) === 0) { + return root + } + if (tree._comp(root._val, val) < 0) { + return searchAVLTree(root._right, val, tree) + } + return searchAVLTree(root._left, val, tree) +} /** * A Code for Testing the AVLTree diff --git a/Data-Structures/Tree/BinarySearchTree.js b/Data-Structures/Tree/BinarySearchTree.js index c86a2995c0..abbcc3fb62 100644 --- a/Data-Structures/Tree/BinarySearchTree.js +++ b/Data-Structures/Tree/BinarySearchTree.js @@ -13,77 +13,79 @@ // class Node const Node = (function Node() { // Node in the tree - function Node(val) { - this.value = val - this.left = null - this.right = null - } - - // Search the tree for a value - Node.prototype.search = function (val) { - if (this.value === val) { - return this - } else if (val < this.value && this.left !== null) { - return this.left.search(val) - } else if (val > this.value && this.right !== null) { - return this.right.search(val) + class Node { + constructor(val) { + this.value = val + this.left = null + this.right = null } - return null - } - // Visit a node - Node.prototype.visit = function (output = (value) => console.log(value)) { - // Recursively go left - if (this.left !== null) { - this.left.visit() - } - // Print out value - output(this.value) - // Recursively go right - if (this.right !== null) { - this.right.visit() + // Search the tree for a value + search(val) { + if (this.value === val) { + return this + } else if (val < this.value && this.left !== null) { + return this.left.search(val) + } else if (val > this.value && this.right !== null) { + return this.right.search(val) + } + return null } - } - // Add a node - Node.prototype.addNode = function (n) { - if (n.value < this.value) { - if (this.left === null) { - this.left = n - } else { - this.left.addNode(n) + // Visit a node + visit(output = (value) => console.log(value)) { + // Recursively go left + if (this.left !== null) { + this.left.visit() } - } else if (n.value > this.value) { - if (this.right === null) { - this.right = n - } else { - this.right.addNode(n) + // Print out value + output(this.value) + // Recursively go right + if (this.right !== null) { + this.right.visit() } } - } - // remove a node - Node.prototype.removeNode = function (val) { - if (val === this.value) { - if (!this.left && !this.right) { - return null - } else { - if (this.left) { - const leftMax = maxVal(this.left) - this.value = leftMax - this.left = this.left.removeNode(leftMax) + // Add a node + addNode(n) { + if (n.value < this.value) { + if (this.left === null) { + this.left = n } else { - const rightMin = minVal(this.right) - this.value = rightMin - this.right = this.right.removeNode(rightMin) + this.left.addNode(n) + } + } else if (n.value > this.value) { + if (this.right === null) { + this.right = n + } else { + this.right.addNode(n) } } - } else if (val < this.value) { - this.left = this.left && this.left.removeNode(val) - } else if (val > this.value) { - this.right = this.right && this.right.removeNode(val) } - return this + + // remove a node + removeNode(val) { + if (val === this.value) { + if (!this.left && !this.right) { + return null + } else { + if (this.left) { + const leftMax = maxVal(this.left) + this.value = leftMax + this.left = this.left.removeNode(leftMax) + } else { + const rightMin = minVal(this.right) + this.value = rightMin + this.right = this.right.removeNode(rightMin) + } + } + } else if (val < this.value) { + this.left = this.left && this.left.removeNode(val) + } else if (val > this.value) { + this.right = this.right && this.right.removeNode(val) + } + return this + } } // find maximum value in the tree @@ -107,44 +109,46 @@ const Node = (function Node() { // class Tree const Tree = (function () { - function Tree() { - // Just store the root - this.root = null - } + class Tree { + constructor() { + // Just store the root + this.root = null + } - // Inorder traversal - Tree.prototype.traverse = function () { - if (!this.root) { - // No nodes are there in the tree till now - return + // Inorder traversal + traverse() { + if (!this.root) { + // No nodes are there in the tree till now + return + } + this.root.visit() } - this.root.visit() - } - // Start by searching the root - Tree.prototype.search = function (val) { - const found = this.root.search(val) - if (found !== null) { - return found.value + // Start by searching the root + search(val) { + const found = this.root.search(val) + if (found !== null) { + return found.value + } + // not found + return null } - // not found - return null - } - // Add a new value to the tree - Tree.prototype.addValue = function (val) { - const n = new Node(val) - if (this.root === null) { - this.root = n - } else { - this.root.addNode(n) + // Add a new value to the tree + addValue(val) { + const n = new Node(val) + if (this.root === null) { + this.root = n + } else { + this.root.addNode(n) + } } - } - // remove a value from the tree - Tree.prototype.removeValue = function (val) { - // remove something if root exists - this.root = this.root && this.root.removeNode(val) + // remove a value from the tree + removeValue(val) { + // remove something if root exists + this.root = this.root && this.root.removeNode(val) + } } // returns the constructor diff --git a/Data-Structures/Tree/Trie.js b/Data-Structures/Tree/Trie.js index ea59e53846..0d4018f74f 100644 --- a/Data-Structures/Tree/Trie.js +++ b/Data-Structures/Tree/Trie.js @@ -1,129 +1,132 @@ -const TrieNode = function TrieNode(key, parent) { - this.key = key - this.count = 0 - this.children = Object.create(null) - if (parent === undefined) { - this.parent = null - } else { - this.parent = parent +class TrieNode { + constructor(key, parent) { + this.key = key + this.count = 0 + this.children = Object.create(null) + if (parent === undefined) { + this.parent = null + } else { + this.parent = parent + } } } -function Trie() { - // create only root with null key and parent - this.root = new TrieNode(null, null) -} +class Trie { + constructor() { + // create only root with null key and parent + this.root = new TrieNode(null, null) + } -// Recursively finds the occurrence of all words in a given node -Trie.findAllWords = function (root, word, output) { - if (root === null) return - if (root.count > 0) { - if (typeof output === 'object') { - output.push({ word, count: root.count }) + // Recursively finds the occurrence of all words in a given node + static findAllWords(root, word, output) { + if (root === null) return + if (root.count > 0) { + if (typeof output === 'object') { + output.push({ word, count: root.count }) + } + } + let key + for (key in root.children) { + word += key + this.findAllWords(root.children[key], word, output) + word = word.slice(0, -1) } } - let key - for (key in root.children) { - word += key - this.findAllWords(root.children[key], word, output) - word = word.slice(0, -1) - } -} -Trie.prototype.insert = function (word) { - if (typeof word !== 'string') return - if (word === '') { - this.root.count += 1 - return - } - let node = this.root - const len = word.length - let i - for (i = 0; i < len; i++) { - if (node.children[word.charAt(i)] === undefined) { - node.children[word.charAt(i)] = new TrieNode(word.charAt(i), node) + insert(word) { + if (typeof word !== 'string') return + if (word === '') { + this.root.count += 1 + return + } + let node = this.root + const len = word.length + let i + for (i = 0; i < len; i++) { + if (node.children[word.charAt(i)] === undefined) { + node.children[word.charAt(i)] = new TrieNode(word.charAt(i), node) + } + node = node.children[word.charAt(i)] } - node = node.children[word.charAt(i)] + node.count += 1 } - node.count += 1 -} -Trie.prototype.findPrefix = function (word) { - if (typeof word !== 'string') return null - let node = this.root - const len = word.length - let i - // After end of this loop node will be at desired prefix - for (i = 0; i < len; i++) { - if (node.children[word.charAt(i)] === undefined) return null // No such prefix exists - node = node.children[word.charAt(i)] + findPrefix(word) { + if (typeof word !== 'string') return null + let node = this.root + const len = word.length + let i + // After end of this loop node will be at desired prefix + for (i = 0; i < len; i++) { + if (node.children[word.charAt(i)] === undefined) return null // No such prefix exists + node = node.children[word.charAt(i)] + } + return node } - return node -} -Trie.prototype.remove = function (word, count) { - if (typeof word !== 'string') return - if (typeof count !== 'number') count = 1 - else if (count <= 0) return + remove(word, count) { + if (typeof word !== 'string') return + if (typeof count !== 'number') count = 1 + else if (count <= 0) return - // for empty string just delete count of root - if (word === '') { - if (this.root.count >= count) this.root.count -= count - else this.root.count = 0 - return - } + // for empty string just delete count of root + if (word === '') { + if (this.root.count >= count) this.root.count -= count + else this.root.count = 0 + return + } - let child = this.root - const len = word.length - let i, key - // child: node which is to be deleted - for (i = 0; i < len; i++) { - key = word.charAt(i) - if (child.children[key] === undefined) return - child = child.children[key] - } + let child = this.root + const len = word.length + let i, key + // child: node which is to be deleted + for (i = 0; i < len; i++) { + key = word.charAt(i) + if (child.children[key] === undefined) return + child = child.children[key] + } - // Delete no of occurrences specified - if (child.count >= count) child.count -= count - else child.count = 0 + // Delete no of occurrences specified + if (child.count >= count) child.count -= count + else child.count = 0 - // If some occurrences are left we don't delete it or else - // if the object forms some other objects prefix we don't delete it - // For checking an empty object - // https://stackoverflow.com/questions/679915/how-do-i-test-for-an-empty-javascript-object - if ( - child.count <= 0 && - Object.keys(child.children).length && - child.children.constructor === Object - ) { - child.parent.children[child.key] = undefined + // If some occurrences are left we don't delete it or else + // if the object forms some other objects prefix we don't delete it + // For checking an empty object + // https://stackoverflow.com/questions/679915/how-do-i-test-for-an-empty-javascript-object + if ( + child.count <= 0 && + Object.keys(child.children).length && + child.children.constructor === Object + ) { + child.parent.children[child.key] = undefined + } } -} -Trie.prototype.findAllWords = function (prefix) { - const output = [] - // find the node with provided prefix - const node = this.findPrefix(prefix) - // No such prefix exists - if (node === null) return output - Trie.findAllWords(node, prefix, output) - return output -} - -Trie.prototype.contains = function (word) { - // find the node with given prefix - const node = this.findPrefix(word) - // No such word exists + findAllWords(prefix) { + const output = [] + // find the node with provided prefix + const node = this.findPrefix(prefix) + // No such prefix exists + if (node === null) return output + Trie.findAllWords(node, prefix, output) + return output + } - return node !== null && node.count !== 0 -} + contains(word) { + // find the node with given prefix + const node = this.findPrefix(word) + // No such word exists + return node !== null && node.count !== 0 + } -Trie.prototype.findOccurrences = function (word) { - // find the node with given prefix - const node = this.findPrefix(word) - // No such word exists - if (node === null) return 0 - return node.count + findOccurrences(word) { + // find the node with given prefix + const node = this.findPrefix(word) + // No such word exists + if (node === null) return 0 + return node.count + } } export { Trie } diff --git a/Dynamic-Programming/NumberOfSubsetEqualToGivenSum.js b/Dynamic-Programming/NumberOfSubsetEqualToGivenSum.js index dee12f8de9..48905c39e2 100644 --- a/Dynamic-Programming/NumberOfSubsetEqualToGivenSum.js +++ b/Dynamic-Programming/NumberOfSubsetEqualToGivenSum.js @@ -4,7 +4,7 @@ determine the total number of the subset with sum equal to the given sum. */ /* - Given solution is O(n*sum) Time complexity and O(sum) Space complexity + Given solution is O(n*sum) Time complexity and O(sum) Space complexity */ function NumberOfSubsetSum(array, sum) { const dp = [] // create an dp array where dp[i] denote number of subset with sum equal to i diff --git a/Project-Euler/Problem004.js b/Project-Euler/Problem004.js index 34fa87471d..7c85dfdb85 100644 --- a/Project-Euler/Problem004.js +++ b/Project-Euler/Problem004.js @@ -1,6 +1,6 @@ // https://projecteuler.net/problem=4 /* A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. - Find the largest palindrome made from the product of two 3-digit numbers. + Find the largest palindrome made from the product of two 3-digit numbers. */ export const largestPalindromic = (digits) => { let i From 6e27235fb75298833448ba1b23e5178f7eea2290 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 5 May 2024 21:22:35 +0200 Subject: [PATCH 103/122] Keep GitHub Actions up to date with GitHub's Dependabot Fixes software supply chain safety warnings like at the bottom right of https://github.com/TheAlgorithms/JavaScript/actions/runs/8960545794 * [Keeping your actions up to date with Dependabot](https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot) * [Configuration options for the dependabot.yml file - package-ecosystem](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem) --- .github/dependabot.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..15e494ec86 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +# Keep GitHub Actions up to date with Dependabot... +# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" From 6bb02af09b6d1de02a047b5c4608d2d101984911 Mon Sep 17 00:00:00 2001 From: cclauss Date: Sun, 5 May 2024 19:22:50 +0000 Subject: [PATCH 104/122] Updated Documentation in README.md --- DIRECTORY.md | 1 + 1 file changed, 1 insertion(+) diff --git a/DIRECTORY.md b/DIRECTORY.md index 59f6273bf2..6c1fa7aeb8 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -397,6 +397,7 @@ * **Timing-Functions** * [GetMonthDays](Timing-Functions/GetMonthDays.js) * [IntervalTimer](Timing-Functions/IntervalTimer.js) + * [ParseDate](Timing-Functions/ParseDate.js) * **Trees** * [BreadthFirstTreeTraversal](Trees/BreadthFirstTreeTraversal.js) * [DepthFirstSearch](Trees/DepthFirstSearch.js) From cc1e1dc643074f1489aa6ef5a8b7a02d01c7c7f1 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 17 May 2024 17:28:38 +0200 Subject: [PATCH 105/122] GitHub Actions: Test on the current version of Node.js (#1657) --- .github/workflows/Ci.yml | 2 +- .github/workflows/UpdateDirectory.yml | 2 +- .github/workflows/UploadCoverageReport.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Ci.yml b/.github/workflows/Ci.yml index 571b8a0fa8..99e8f7831f 100644 --- a/.github/workflows/Ci.yml +++ b/.github/workflows/Ci.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 cache: npm - name: 📦 Install dependencies diff --git a/.github/workflows/UpdateDirectory.yml b/.github/workflows/UpdateDirectory.yml index cb649e1c8b..437ab55b91 100644 --- a/.github/workflows/UpdateDirectory.yml +++ b/.github/workflows/UpdateDirectory.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 cache: npm - name: 📦 Install dependencies diff --git a/.github/workflows/UploadCoverageReport.yml b/.github/workflows/UploadCoverageReport.yml index 4dcad584bf..eee9d4aec9 100644 --- a/.github/workflows/UploadCoverageReport.yml +++ b/.github/workflows/UploadCoverageReport.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 cache: npm - name: Install dependencies From e2b975486234d07bd732bf290fce8cb28144a814 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Thu, 23 May 2024 19:45:08 +0200 Subject: [PATCH 106/122] tests: add tests of `LongestIncreasingSubsequence` (#1660) --- .../LongestIncreasingSubsequence.js | 3 +++ .../LongestIncreasingSubsequence.test.js | 24 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 Dynamic-Programming/tests/LongestIncreasingSubsequence.test.js diff --git a/Dynamic-Programming/LongestIncreasingSubsequence.js b/Dynamic-Programming/LongestIncreasingSubsequence.js index b9319db586..b8e1847cd8 100644 --- a/Dynamic-Programming/LongestIncreasingSubsequence.js +++ b/Dynamic-Programming/LongestIncreasingSubsequence.js @@ -6,6 +6,9 @@ // Return the length of the Longest Increasing Subsequence, given array x function longestIncreasingSubsequence(x) { const length = x.length + if (length == 0) { + return 0 + } const dp = Array(length).fill(1) let res = 1 diff --git a/Dynamic-Programming/tests/LongestIncreasingSubsequence.test.js b/Dynamic-Programming/tests/LongestIncreasingSubsequence.test.js new file mode 100644 index 0000000000..9a8024aa95 --- /dev/null +++ b/Dynamic-Programming/tests/LongestIncreasingSubsequence.test.js @@ -0,0 +1,24 @@ +import { longestIncreasingSubsequence } from '../LongestIncreasingSubsequence' + +describe('Testing longestIncreasingSubsequence', () => { + it.each([ + [[], 0], + [[1], 1], + [[2, 2], 1], + [[3, 3, 3], 1], + [[4, 4, 4, 4], 1], + [[1, 2], 2], + [[1, 2, 2, 2, 2], 2], + [[1, 0, 2], 2], + [[1, 10, 2, 30], 3], + [[5, 8, 3, 7, 9, 1], 3], + [[10, 9, 2, 5, 3, 7, 101, 18], 4], + [[10, 10, 9, 9, 2, 2, 5, 5, 3, 3, 7, 7, 101, 101, 18, 18], 4], + [[0, 1, 0, 3, 2, 3], 4], + [[1, 1, 2, 2, 2], 2], + [[1, 1, 2, 2, 2, 3, 3, 3, 3], 3], + [[0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15], 6] + ])('check with %j', (input, expected) => { + expect(longestIncreasingSubsequence(input)).toBe(expected) + }) +}) From 3623e4270f98d6dd5a1fe6a05cbec3c1a0657fbb Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Sat, 25 May 2024 13:01:13 +0200 Subject: [PATCH 107/122] tests: add `HexToDecimal.test.js` (#1662) --- Conversions/HexToDecimal.js | 5 ++++- Conversions/test/HexToDecimal.test.js | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 Conversions/test/HexToDecimal.test.js diff --git a/Conversions/HexToDecimal.js b/Conversions/HexToDecimal.js index 31ae13932f..e402421399 100644 --- a/Conversions/HexToDecimal.js +++ b/Conversions/HexToDecimal.js @@ -1,4 +1,7 @@ function hexToInt(hexNum) { + if (!/^[0-9A-F]+$/.test(hexNum)) { + throw new Error('Invalid hex string.') + } const numArr = hexNum.split('') // converts number to array return numArr.map((item, index) => { switch (item) { @@ -29,4 +32,4 @@ function hexToDecimal(hexNum) { }, 0) } -export { hexToInt, hexToDecimal } +export { hexToDecimal } diff --git a/Conversions/test/HexToDecimal.test.js b/Conversions/test/HexToDecimal.test.js new file mode 100644 index 0000000000..816c70511d --- /dev/null +++ b/Conversions/test/HexToDecimal.test.js @@ -0,0 +1,24 @@ +import { hexToDecimal } from '../HexToDecimal' + +describe('Testing HexToDecimal', () => { + it.each([ + ['0', 0], + ['1', 1], + ['A', 10], + ['B', 11], + ['C', 12], + ['D', 13], + ['E', 14], + ['F', 15], + ['10', 16], + ['859', 2137], + ['4D2', 1234], + ['81323ABD92', 554893491602] + ])('check with %s', (hexStr, expected) => { + expect(hexToDecimal(hexStr)).toBe(expected) + }) + + it.each(['a', '-1', 'G', ''])('throws for %s', (hexStr) => { + expect(() => hexToDecimal(hexStr)).toThrowError() + }) +}) From 1554ba5f9c1bade3e52733a2bf67017b073fbe75 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Sat, 25 May 2024 13:01:54 +0200 Subject: [PATCH 108/122] test: add tests for `NumberOfSubsetEqualToGivenSum` (#1661) --- .../NumberOfSubsetEqualToGivenSum.js | 15 +++++------ .../NumberOfSubsetEqualToGivenSum.test.js | 25 +++++++++++++++++++ 2 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 Dynamic-Programming/tests/NumberOfSubsetEqualToGivenSum.test.js diff --git a/Dynamic-Programming/NumberOfSubsetEqualToGivenSum.js b/Dynamic-Programming/NumberOfSubsetEqualToGivenSum.js index 48905c39e2..fd8e70c4d6 100644 --- a/Dynamic-Programming/NumberOfSubsetEqualToGivenSum.js +++ b/Dynamic-Programming/NumberOfSubsetEqualToGivenSum.js @@ -1,5 +1,5 @@ /* -Given an array of non-negative integers and a value sum, +Given an array of positive integers and a value sum, determine the total number of the subset with sum equal to the given sum. */ @@ -7,6 +7,13 @@ equal to the given sum. Given solution is O(n*sum) Time complexity and O(sum) Space complexity */ function NumberOfSubsetSum(array, sum) { + if (sum < 0) { + throw new Error('The sum must be non-negative.') + } + + if (!array.every((num) => num > 0)) { + throw new Error('All of the inputs of the array must be positive.') + } const dp = [] // create an dp array where dp[i] denote number of subset with sum equal to i for (let i = 1; i <= sum; i++) { dp[i] = 0 @@ -23,10 +30,4 @@ function NumberOfSubsetSum(array, sum) { return dp[sum] } -// example - -// const array = [1, 1, 2, 2, 3, 1, 1] -// const sum = 4 -// const result = NumberOfSubsetSum(array, sum) - export { NumberOfSubsetSum } diff --git a/Dynamic-Programming/tests/NumberOfSubsetEqualToGivenSum.test.js b/Dynamic-Programming/tests/NumberOfSubsetEqualToGivenSum.test.js new file mode 100644 index 0000000000..23eed33ebe --- /dev/null +++ b/Dynamic-Programming/tests/NumberOfSubsetEqualToGivenSum.test.js @@ -0,0 +1,25 @@ +import { NumberOfSubsetSum } from '../NumberOfSubsetEqualToGivenSum' + +describe('Testing NumberOfSubsetSum', () => { + it.each([ + [[], 0, 1], + [[], 1, 0], + [[1], 2, 0], + [[1, 2, 3, 4, 5], 0, 1], + [[1, 1, 1, 1, 1], 5, 1], + [[1, 1, 1, 1, 1], 4, 5], + [[1, 2, 3, 3], 6, 3], + [[10, 20, 30, 1], 31, 2], + [[1, 1, 2, 2, 3, 1, 1], 4, 18] + ])('check with %j and %i', (arr, sum, expected) => { + expect(NumberOfSubsetSum(arr, sum)).toBe(expected) + }) + + it.each([ + [[1, 2], -1], + [[0, 2], 2], + [[1, -1], 0] + ])('throws for %j and %i', (arr, sum) => { + expect(() => NumberOfSubsetSum(arr, sum)).toThrowError() + }) +}) From 79b93d35b6175fe6364fb16c07520e796a3fddb5 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Tue, 11 Jun 2024 22:10:48 +0200 Subject: [PATCH 109/122] style: remove redundant eslint suppressions (#1667) --- Backtracking/tests/RatInAMaze.test.js | 4 ---- Backtracking/tests/Sudoku.test.js | 1 - Data-Structures/Array/QuickSelect.js | 1 - Maths/test/EulerMethod.manual-test.js | 1 - Maths/test/FindMinIterator.test.js | 4 +--- Recursive/test/FloodFill.test.js | 1 - 6 files changed, 1 insertion(+), 11 deletions(-) diff --git a/Backtracking/tests/RatInAMaze.test.js b/Backtracking/tests/RatInAMaze.test.js index 6cc5b31aae..52f620027b 100644 --- a/Backtracking/tests/RatInAMaze.test.js +++ b/Backtracking/tests/RatInAMaze.test.js @@ -6,7 +6,6 @@ describe('RatInAMaze', () => { for (const value of values) { // we deliberately want to check whether this constructor call fails or not - // eslint-disable-next-line no-new expect(() => { new RatInAMaze(value) }).toThrow() @@ -15,7 +14,6 @@ describe('RatInAMaze', () => { it('should fail for an empty array', () => { // we deliberately want to check whether this constructor call fails or not - // eslint-disable-next-line no-new expect(() => { new RatInAMaze([]) }).toThrow() @@ -28,7 +26,6 @@ describe('RatInAMaze', () => { ] // we deliberately want to check whether this constructor call fails or not - // eslint-disable-next-line no-new expect(() => { new RatInAMaze(array) }).toThrow() @@ -39,7 +36,6 @@ describe('RatInAMaze', () => { for (const value of values) { // we deliberately want to check whether this constructor call fails or not - // eslint-disable-next-line no-new expect(() => { new RatInAMaze(value) }).toThrow() diff --git a/Backtracking/tests/Sudoku.test.js b/Backtracking/tests/Sudoku.test.js index 8cbe187089..c70f7de67a 100644 --- a/Backtracking/tests/Sudoku.test.js +++ b/Backtracking/tests/Sudoku.test.js @@ -27,7 +27,6 @@ const solved = [ describe('Sudoku', () => { it('should create a valid board successfully', () => { // we deliberately want to check whether this constructor call fails or not - // eslint-disable-next-line no-new expect(() => { new Sudoku(data) }).not.toThrow() diff --git a/Data-Structures/Array/QuickSelect.js b/Data-Structures/Array/QuickSelect.js index d01555ed95..53c8c8e855 100644 --- a/Data-Structures/Array/QuickSelect.js +++ b/Data-Structures/Array/QuickSelect.js @@ -12,7 +12,6 @@ */ function QuickSelect(items, kth) { - // eslint-disable-line no-unused-vars if (kth < 1 || kth > items.length) { throw new RangeError('Index Out of Bound') } diff --git a/Maths/test/EulerMethod.manual-test.js b/Maths/test/EulerMethod.manual-test.js index 27b4631a80..e1959280a5 100644 --- a/Maths/test/EulerMethod.manual-test.js +++ b/Maths/test/EulerMethod.manual-test.js @@ -15,7 +15,6 @@ function plotLine(label, points, width, height) { // Chart-class from chartjs const chart = new Chart(canvas, { - // eslint-disable-line type: 'scatter', data: { datasets: [ diff --git a/Maths/test/FindMinIterator.test.js b/Maths/test/FindMinIterator.test.js index 7b7229b106..792cb7695e 100644 --- a/Maths/test/FindMinIterator.test.js +++ b/Maths/test/FindMinIterator.test.js @@ -22,13 +22,12 @@ describe('FindMinIterator', () => { }) test('given empty generator then min is undefined', () => { - const src = function* () {} // eslint-disable-line + const src = function* () {} expect(FindMinIterator(src())).toBeUndefined() }) test('given generator then min is found', () => { const src = function* () { - // eslint-disable-line yield 1 yield -1 yield 0 @@ -38,7 +37,6 @@ describe('FindMinIterator', () => { test('given string generator then min string length is found', () => { const src = function* () { - // eslint-disable-line yield 'abc' yield 'de' yield 'qwerty' diff --git a/Recursive/test/FloodFill.test.js b/Recursive/test/FloodFill.test.js index 618692dd97..eb44e75e09 100644 --- a/Recursive/test/FloodFill.test.js +++ b/Recursive/test/FloodFill.test.js @@ -69,7 +69,6 @@ function testDepthFirst( replacementColor, testLocation ) { - // eslint-disable-line const rgbData = generateTestRgbData() depthFirstSearch(rgbData, fillLocation, targetColor, replacementColor) return rgbData[testLocation[0]][testLocation[1]] From 0182bcacd0573094452e2130a18e4b947df91e67 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Tue, 11 Jun 2024 22:11:12 +0200 Subject: [PATCH 110/122] style: remove `listIn` and `listOut` (#1669) --- Data-Structures/Queue/QueueUsing2Stacks.js | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/Data-Structures/Queue/QueueUsing2Stacks.js b/Data-Structures/Queue/QueueUsing2Stacks.js index 256f11060d..9a51ee3a72 100644 --- a/Data-Structures/Queue/QueueUsing2Stacks.js +++ b/Data-Structures/Queue/QueueUsing2Stacks.js @@ -29,24 +29,6 @@ class Queue { return top } } - - // display elements of the inputstack - listIn(output = (value) => console.log(value)) { - let i = 0 - while (i < this.inputStack.length) { - output(this.inputStack[i]) - i++ - } - } - - // display element of the outputstack - listOut(output = (value) => console.log(value)) { - let i = 0 - while (i < this.outputStack.length) { - output(this.outputStack[i]) - i++ - } - } } export { Queue } From 584424241c61079940d94a5aed1bed583c555098 Mon Sep 17 00:00:00 2001 From: Daniel <67126972+ddaniel27@users.noreply.github.com> Date: Mon, 17 Jun 2024 23:08:16 -0500 Subject: [PATCH 111/122] [Solution] Project euler challenge 19 with tests (#1659) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [Solution] Project euler challenge 19 with tests * update leap year function * Remove unnecessary, confusingly placed comments --------- Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --- Project-Euler/Problem019.js | 48 +++++++++++++++++++++++++++ Project-Euler/test/Problem019.test.js | 8 +++++ 2 files changed, 56 insertions(+) create mode 100644 Project-Euler/Problem019.js create mode 100644 Project-Euler/test/Problem019.test.js diff --git a/Project-Euler/Problem019.js b/Project-Euler/Problem019.js new file mode 100644 index 0000000000..5b488c7f96 --- /dev/null +++ b/Project-Euler/Problem019.js @@ -0,0 +1,48 @@ +/** + * Problem 19 - Counting Sundays + * + * @see {@link https://projecteuler.net/problem=19} + * + * You are given the following information, but you may prefer to do some research for yourself. + * 1 Jan 1900 was a Monday. + * Thirty days has September, + * April, June and November. + * All the rest have thirty-one, + * Saving February alone, + * Which has twenty-eight, rain or shine. + * And on leap years, twenty-nine. + * A leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400. + * How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)? + * + * @author ddaniel27 + */ +import { isLeapYear } from '../Maths/LeapYear' + +function problem19() { + let sundaysCount = 0 // Count of Sundays + let dayOfWeek = 2 // 1st Jan 1900 was a Monday, so 1st Jan 1901 was a Tuesday + + for (let year = 1901; year <= 2000; year++) { + for (let month = 1; month <= 12; month++) { + if (dayOfWeek === 0) { + // If it's a Sunday (0 is Sunday, 1 is Monday, ..., 6 is Saturday) + sundaysCount++ + } + + let daysInMonth = 31 + if (month === 4 || month === 6 || month === 9 || month === 11) { + // April, June, September, November + daysInMonth = 30 + } else if (month === 2) { + // February + daysInMonth = isLeapYear(year) ? 29 : 28 + } + + dayOfWeek = (dayOfWeek + daysInMonth) % 7 // Calculate the day of the week + } + } + + return sundaysCount +} + +export { problem19 } diff --git a/Project-Euler/test/Problem019.test.js b/Project-Euler/test/Problem019.test.js new file mode 100644 index 0000000000..8845e5a0ac --- /dev/null +++ b/Project-Euler/test/Problem019.test.js @@ -0,0 +1,8 @@ +import { problem19 } from '../Problem019.js' + +describe('checking sundays during the twentieth century', () => { + // Project Euler Challenge Check + test('result should be 171', () => { + expect(problem19()).toBe(171) + }) +}) From 5f8d4d447a85fb4aeb065983ab275a582d4ff07b Mon Sep 17 00:00:00 2001 From: Daniel <67126972+ddaniel27@users.noreply.github.com> Date: Sun, 23 Jun 2024 00:20:25 -0500 Subject: [PATCH 112/122] [Compressor] RLE Compressor implementation (#1671) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [Solution] Project euler challenge 19 with tests * update leap year function * Remove unnecessary, confusingly placed comments * [COMPRESSOR] RLE * [COMPRESSOR] RLE style fixed --------- Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --- Compression/RLE.js | 38 ++++++++++++++++++++++++++++++++++++ Compression/test/RLE.test.js | 13 ++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 Compression/RLE.js create mode 100644 Compression/test/RLE.test.js diff --git a/Compression/RLE.js b/Compression/RLE.js new file mode 100644 index 0000000000..81a1538646 --- /dev/null +++ b/Compression/RLE.js @@ -0,0 +1,38 @@ +/* + * RLE (Run Length Encoding) is a simple form of data compression. + * The basic idea is to represent repeated successive characters as a single count and character. + * For example, the string "AAAABBBCCDAA" would be encoded as "4A3B2C1D2A". + * + * @author - [ddaniel27](https://github.com/ddaniel27) + */ + +function Compress(str) { + let compressed = '' + let count = 1 + + for (let i = 0; i < str.length; i++) { + if (str[i] !== str[i + 1]) { + compressed += count + str[i] + count = 1 + continue + } + + count++ + } + + return compressed +} + +function Decompress(str) { + let decompressed = '' + let match = [...str.matchAll(/(\d+)(\D)/g)] // match all groups of digits followed by a non-digit character + + match.forEach((item) => { + let [count, char] = [item[1], item[2]] + decompressed += char.repeat(count) + }) + + return decompressed +} + +export { Compress, Decompress } diff --git a/Compression/test/RLE.test.js b/Compression/test/RLE.test.js new file mode 100644 index 0000000000..0094b5b7e2 --- /dev/null +++ b/Compression/test/RLE.test.js @@ -0,0 +1,13 @@ +import { Compress, Decompress } from '../RLE' + +describe('Test RLE Compressor/Decompressor', () => { + it('Test - 1, Pass long repetitive strings', () => { + expect(Compress('AAAAAAAAAAAAAA')).toBe('14A') + expect(Compress('AAABBQQQQQFG')).toBe('3A2B5Q1F1G') + }) + + it('Test - 2, Pass compressed strings', () => { + expect(Decompress('14A')).toBe('AAAAAAAAAAAAAA') + expect(Decompress('3A2B5Q1F1G')).toBe('AAABBQQQQQFG') + }) +}) From 8ceaa252b9b7aa37f217e1cb0cb65351698b8777 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 23 Jun 2024 10:51:19 +0530 Subject: [PATCH 113/122] chore(deps-dev): bump braces from 3.0.2 to 3.0.3 (#1670) Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3. - [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md) - [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3) --- updated-dependencies: - dependency-name: braces dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index a4efa09c1b..9a4fd732a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -463,11 +463,12 @@ } }, "node_modules/braces": { - "version": "3.0.2", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, - "license": "MIT", "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -634,9 +635,10 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, - "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" }, @@ -786,8 +788,9 @@ }, "node_modules/is-number": { "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.12.0" } @@ -1319,8 +1322,9 @@ }, "node_modules/to-regex-range": { "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, - "license": "MIT", "dependencies": { "is-number": "^7.0.0" }, From 9010481c2930d65621f18f41c216f29fceaa8807 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Sun, 23 Jun 2024 13:40:42 +0200 Subject: [PATCH 114/122] chore: update `codecov-action` to `v4` (#1605) The token has been added to the repository secrets. --- .github/workflows/UploadCoverageReport.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/UploadCoverageReport.yml b/.github/workflows/UploadCoverageReport.yml index eee9d4aec9..3f8fee4256 100644 --- a/.github/workflows/UploadCoverageReport.yml +++ b/.github/workflows/UploadCoverageReport.yml @@ -8,6 +8,9 @@ name: UploadCoverageReport - master pull_request: +env: + REPORT_PATH: "coverage/coverage-final.json" + jobs: UploadCoverageReport: runs-on: ubuntu-latest @@ -25,9 +28,18 @@ jobs: - name: Generate coverage report run: npm test -- --coverage - - name: Upload coverage to codecov - uses: codecov/codecov-action@v3 + - name: Upload coverage to codecov (tokenless) + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository + uses: codecov/codecov-action@v4 + with: + files: "${{ env.REPORT_PATH }}" + fail_ci_if_error: true + + - name: Upload coverage to codecov (with token) + if: "! github.event.pull_request.head.repo.fork " + uses: codecov/codecov-action@v4 with: - files: "coverage/coverage-final.json" + token: ${{ secrets.CODECOV_TOKEN }} + files: "${{ env.REPORT_PATH }}" fail_ci_if_error: true ... From 5b17ea1a93042dc02a597d6fe4a20c0948b0496c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Oct 2024 22:34:29 +0530 Subject: [PATCH 115/122] chore(deps): bump rollup from 4.9.6 to 4.22.4 (#1690) Bumps [rollup](https://github.com/rollup/rollup) from 4.9.6 to 4.22.4. - [Release notes](https://github.com/rollup/rollup/releases) - [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md) - [Commits](https://github.com/rollup/rollup/compare/v4.9.6...v4.22.4) --- updated-dependencies: - dependency-name: rollup dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 240 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 221 insertions(+), 19 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9a4fd732a9..c4e8c96761 100644 --- a/package-lock.json +++ b/package-lock.json @@ -174,30 +174,214 @@ "node": ">= 8" } }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.4.tgz", + "integrity": "sha512-Fxamp4aEZnfPOcGA8KSNEohV8hX7zVHOemC8jVBoBUHu5zpJK/Eu3uJwt6BMgy9fkvzxDaurgj96F/NiLukF2w==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.22.4.tgz", + "integrity": "sha512-VXoK5UMrgECLYaMuGuVTOx5kcuap1Jm8g/M83RnCHBKOqvPPmROFJGQaZhGccnsFtfXQ3XYa4/jMCJvZnbJBdA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.22.4.tgz", + "integrity": "sha512-xMM9ORBqu81jyMKCDP+SZDhnX2QEVQzTcC6G18KlTQEzWK8r/oNZtKuZaCcHhnsa6fEeOBionoyl5JsAbE/36Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.22.4.tgz", + "integrity": "sha512-aJJyYKQwbHuhTUrjWjxEvGnNNBCnmpHDvrb8JFDbeSH3m2XdHcxDd3jthAzvmoI8w/kSjd2y0udT+4okADsZIw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.22.4.tgz", + "integrity": "sha512-j63YtCIRAzbO+gC2L9dWXRh5BFetsv0j0va0Wi9epXDgU/XUi5dJKo4USTttVyK7fGw2nPWK0PbAvyliz50SCQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.22.4.tgz", + "integrity": "sha512-dJnWUgwWBX1YBRsuKKMOlXCzh2Wu1mlHzv20TpqEsfdZLb3WoJW2kIEsGwLkroYf24IrPAvOT/ZQ2OYMV6vlrg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.22.4.tgz", + "integrity": "sha512-AdPRoNi3NKVLolCN/Sp4F4N1d98c4SBnHMKoLuiG6RXgoZ4sllseuGioszumnPGmPM2O7qaAX/IJdeDU8f26Aw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.22.4.tgz", + "integrity": "sha512-Gl0AxBtDg8uoAn5CCqQDMqAx22Wx22pjDOjBdmG0VIWX3qUBHzYmOKh8KXHL4UpogfJ14G4wk16EQogF+v8hmA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.22.4.tgz", + "integrity": "sha512-3aVCK9xfWW1oGQpTsYJJPF6bfpWfhbRnhdlyhak2ZiyFLDaayz0EP5j9V1RVLAAxlmWKTDfS9wyRyY3hvhPoOg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.22.4.tgz", + "integrity": "sha512-ePYIir6VYnhgv2C5Xe9u+ico4t8sZWXschR6fMgoPUK31yQu7hTEJb7bCqivHECwIClJfKgE7zYsh1qTP3WHUA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.22.4.tgz", + "integrity": "sha512-GqFJ9wLlbB9daxhVlrTe61vJtEY99/xB3C8e4ULVsVfflcpmR6c8UZXjtkMA6FhNONhj2eA5Tk9uAVw5orEs4Q==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.9.6", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.22.4.tgz", + "integrity": "sha512-87v0ol2sH9GE3cLQLNEy0K/R0pz1nvg76o8M5nhMR0+Q+BBGLnb35P0fVz4CQxHYXaAOhE8HhlkaZfsdUOlHwg==", "cpu": [ "x64" ], "dev": true, - "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.9.6", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.22.4.tgz", + "integrity": "sha512-UV6FZMUgePDZrFjrNGIWzDo/vABebuXBhJEqrHxrGiU6HikPy0Z3LfdtciIttEUQfuDdCn8fqh7wiFJjCNwO+g==", "cpu": [ "x64" ], "dev": true, - "license": "MIT", "optional": true, "os": [ "linux" ] }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.22.4.tgz", + "integrity": "sha512-BjI+NVVEGAXjGWYHz/vv0pBqfGoUH0IGZ0cICTn7kB9PyjrATSkX+8WkguNjWoj2qSr1im/+tTGRaY+4/PdcQw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.22.4.tgz", + "integrity": "sha512-SiWG/1TuUdPvYmzmYnmd3IEifzR61Tragkbx9D3+R8mzQqDBz8v+BvZNDlkiTtI9T15KYZhP0ehn3Dld4n9J5g==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.22.4.tgz", + "integrity": "sha512-j8pPKp53/lq9lMXN57S8cFz0MynJk8OWNuUnXct/9KCpKU7DgU3bYMJhwWmcqC0UU29p8Lr0/7KEVcaM6bf47Q==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@types/estree": { "version": "1.0.5", "dev": true, @@ -651,6 +835,20 @@ "dev": true, "license": "ISC" }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/get-func-name": { "version": "2.0.2", "dev": true, @@ -1154,9 +1352,10 @@ } }, "node_modules/rollup": { - "version": "4.9.6", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.22.4.tgz", + "integrity": "sha512-vD8HJ5raRcWOyymsR6Z3o6+RzfEPCnVLMFJ6vRslO1jt4LO6dUo5Qnpg7y4RkZFM2DMe3WUirkI5c16onjrc6A==", "dev": true, - "license": "MIT", "dependencies": { "@types/estree": "1.0.5" }, @@ -1168,19 +1367,22 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.9.6", - "@rollup/rollup-android-arm64": "4.9.6", - "@rollup/rollup-darwin-arm64": "4.9.6", - "@rollup/rollup-darwin-x64": "4.9.6", - "@rollup/rollup-linux-arm-gnueabihf": "4.9.6", - "@rollup/rollup-linux-arm64-gnu": "4.9.6", - "@rollup/rollup-linux-arm64-musl": "4.9.6", - "@rollup/rollup-linux-riscv64-gnu": "4.9.6", - "@rollup/rollup-linux-x64-gnu": "4.9.6", - "@rollup/rollup-linux-x64-musl": "4.9.6", - "@rollup/rollup-win32-arm64-msvc": "4.9.6", - "@rollup/rollup-win32-ia32-msvc": "4.9.6", - "@rollup/rollup-win32-x64-msvc": "4.9.6", + "@rollup/rollup-android-arm-eabi": "4.22.4", + "@rollup/rollup-android-arm64": "4.22.4", + "@rollup/rollup-darwin-arm64": "4.22.4", + "@rollup/rollup-darwin-x64": "4.22.4", + "@rollup/rollup-linux-arm-gnueabihf": "4.22.4", + "@rollup/rollup-linux-arm-musleabihf": "4.22.4", + "@rollup/rollup-linux-arm64-gnu": "4.22.4", + "@rollup/rollup-linux-arm64-musl": "4.22.4", + "@rollup/rollup-linux-powerpc64le-gnu": "4.22.4", + "@rollup/rollup-linux-riscv64-gnu": "4.22.4", + "@rollup/rollup-linux-s390x-gnu": "4.22.4", + "@rollup/rollup-linux-x64-gnu": "4.22.4", + "@rollup/rollup-linux-x64-musl": "4.22.4", + "@rollup/rollup-win32-arm64-msvc": "4.22.4", + "@rollup/rollup-win32-ia32-msvc": "4.22.4", + "@rollup/rollup-win32-x64-msvc": "4.22.4", "fsevents": "~2.3.2" } }, From 18da83a5b7acd3a841819ebd24346bba5ada1923 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 5 Oct 2024 23:40:52 +0530 Subject: [PATCH 116/122] chore(deps): bump vite from 5.0.12 to 5.4.8 (#1711) Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.0.12 to 5.4.8. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v5.4.8/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v5.4.8/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 447 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 405 insertions(+), 42 deletions(-) diff --git a/package-lock.json b/package-lock.json index c4e8c96761..5c38ba06a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -76,13 +76,270 @@ "dev": true, "license": "MIT" }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@esbuild/linux-x64": { - "version": "0.19.12", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", "cpu": [ "x64" ], "dev": true, - "license": "MIT", "optional": true, "os": [ "linux" @@ -91,6 +348,102 @@ "node": ">=12" } }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@istanbuljs/schema": { "version": "0.1.3", "dev": true, @@ -751,10 +1104,11 @@ } }, "node_modules/esbuild": { - "version": "0.19.12", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", "dev": true, "hasInstallScript": true, - "license": "MIT", "bin": { "esbuild": "bin/esbuild" }, @@ -762,29 +1116,29 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.19.12", - "@esbuild/android-arm": "0.19.12", - "@esbuild/android-arm64": "0.19.12", - "@esbuild/android-x64": "0.19.12", - "@esbuild/darwin-arm64": "0.19.12", - "@esbuild/darwin-x64": "0.19.12", - "@esbuild/freebsd-arm64": "0.19.12", - "@esbuild/freebsd-x64": "0.19.12", - "@esbuild/linux-arm": "0.19.12", - "@esbuild/linux-arm64": "0.19.12", - "@esbuild/linux-ia32": "0.19.12", - "@esbuild/linux-loong64": "0.19.12", - "@esbuild/linux-mips64el": "0.19.12", - "@esbuild/linux-ppc64": "0.19.12", - "@esbuild/linux-riscv64": "0.19.12", - "@esbuild/linux-s390x": "0.19.12", - "@esbuild/linux-x64": "0.19.12", - "@esbuild/netbsd-x64": "0.19.12", - "@esbuild/openbsd-x64": "0.19.12", - "@esbuild/sunos-x64": "0.19.12", - "@esbuild/win32-arm64": "0.19.12", - "@esbuild/win32-ia32": "0.19.12", - "@esbuild/win32-x64": "0.19.12" + "@esbuild/aix-ppc64": "0.21.5", + "@esbuild/android-arm": "0.21.5", + "@esbuild/android-arm64": "0.21.5", + "@esbuild/android-x64": "0.21.5", + "@esbuild/darwin-arm64": "0.21.5", + "@esbuild/darwin-x64": "0.21.5", + "@esbuild/freebsd-arm64": "0.21.5", + "@esbuild/freebsd-x64": "0.21.5", + "@esbuild/linux-arm": "0.21.5", + "@esbuild/linux-arm64": "0.21.5", + "@esbuild/linux-ia32": "0.21.5", + "@esbuild/linux-loong64": "0.21.5", + "@esbuild/linux-mips64el": "0.21.5", + "@esbuild/linux-ppc64": "0.21.5", + "@esbuild/linux-riscv64": "0.21.5", + "@esbuild/linux-s390x": "0.21.5", + "@esbuild/linux-x64": "0.21.5", + "@esbuild/netbsd-x64": "0.21.5", + "@esbuild/openbsd-x64": "0.21.5", + "@esbuild/sunos-x64": "0.21.5", + "@esbuild/win32-arm64": "0.21.5", + "@esbuild/win32-ia32": "0.21.5", + "@esbuild/win32-x64": "0.21.5" } }, "node_modules/estree-walker": { @@ -1191,6 +1545,8 @@ }, "node_modules/nanoid": { "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", "dev": true, "funding": [ { @@ -1198,7 +1554,6 @@ "url": "https://github.com/sponsors/ai" } ], - "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -1252,9 +1607,10 @@ } }, "node_modules/picocolors": { - "version": "1.0.0", - "dev": true, - "license": "ISC" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", + "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==", + "dev": true }, "node_modules/picomatch": { "version": "2.3.1", @@ -1278,7 +1634,9 @@ } }, "node_modules/postcss": { - "version": "8.4.33", + "version": "8.4.47", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz", + "integrity": "sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==", "dev": true, "funding": [ { @@ -1294,11 +1652,10 @@ "url": "https://github.com/sponsors/ai" } ], - "license": "MIT", "dependencies": { "nanoid": "^3.3.7", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" + "picocolors": "^1.1.0", + "source-map-js": "^1.2.1" }, "engines": { "node": "^10 || ^12 || >=14" @@ -1441,9 +1798,10 @@ } }, "node_modules/source-map-js": { - "version": "1.0.2", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "dev": true, - "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" } @@ -1573,13 +1931,14 @@ "license": "MIT" }, "node_modules/vite": { - "version": "5.0.12", + "version": "5.4.8", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.8.tgz", + "integrity": "sha512-FqrItQ4DT1NC4zCUqMB4c4AZORMKIa0m8/URVCZ77OZ/QSNeJ54bU1vrFADbDsuwfIPcgknRkmqakQcgnL4GiQ==", "dev": true, - "license": "MIT", "dependencies": { - "esbuild": "^0.19.3", - "postcss": "^8.4.32", - "rollup": "^4.2.0" + "esbuild": "^0.21.3", + "postcss": "^8.4.43", + "rollup": "^4.20.0" }, "bin": { "vite": "bin/vite.js" @@ -1598,6 +1957,7 @@ "less": "*", "lightningcss": "^1.21.0", "sass": "*", + "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.4.0" @@ -1615,6 +1975,9 @@ "sass": { "optional": true }, + "sass-embedded": { + "optional": true + }, "stylus": { "optional": true }, From ff314a2bed38525af0445fde53e37338b4db3406 Mon Sep 17 00:00:00 2001 From: Omkarnath Parida Date: Wed, 9 Oct 2024 05:24:11 +0530 Subject: [PATCH 117/122] Add tests for Project Euler Problem 5 + minor refactor (#1691) --- DIRECTORY.md | 3 +++ Project-Euler/Problem005.js | 8 +++----- Project-Euler/test/Problem005.test.js | 12 ++++++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 Project-Euler/test/Problem005.test.js diff --git a/DIRECTORY.md b/DIRECTORY.md index 6c1fa7aeb8..7f6484cae5 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -35,6 +35,8 @@ * [ROT13](Ciphers/ROT13.js) * [VigenereCipher](Ciphers/VigenereCipher.js) * [XORCipher](Ciphers/XORCipher.js) +* **Compression** + * [RLE](Compression/RLE.js) * **Conversions** * [ArbitraryBase](Conversions/ArbitraryBase.js) * [ArrayBufferToBase64](Conversions/ArrayBufferToBase64.js) @@ -285,6 +287,7 @@ * [Problem016](Project-Euler/Problem016.js) * [Problem017](Project-Euler/Problem017.js) * [Problem018](Project-Euler/Problem018.js) + * [Problem019](Project-Euler/Problem019.js) * [Problem020](Project-Euler/Problem020.js) * [Problem021](Project-Euler/Problem021.js) * [Problem023](Project-Euler/Problem023.js) diff --git a/Project-Euler/Problem005.js b/Project-Euler/Problem005.js index fe8901c94c..92f3df9b68 100644 --- a/Project-Euler/Problem005.js +++ b/Project-Euler/Problem005.js @@ -5,11 +5,9 @@ Smallest multiple What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? */ -export const findSmallestMultiple = () => { - const divisors = [ - 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2 - ] - let num = 21 +export const findSmallestMultiple = (maxDivisor) => { + const divisors = Array.from({ length: maxDivisor }, (_, i) => i + 1) + let num = maxDivisor + 1 let result while (!result) { diff --git a/Project-Euler/test/Problem005.test.js b/Project-Euler/test/Problem005.test.js new file mode 100644 index 0000000000..f3ac1b03d8 --- /dev/null +++ b/Project-Euler/test/Problem005.test.js @@ -0,0 +1,12 @@ +import { expect } from 'vitest' +import { findSmallestMultiple } from '../Problem005.js' + +describe.concurrent('Find smallest multiple', () => { + test.each([ + [10, 2520], + [15, 360360], + [20, 232792560] + ])('max divisor -> %i, smallest multiple -> %i', (a, expected) => { + expect(findSmallestMultiple(a)).toBe(expected) + }) +}) From 55ff0ade85c3b4857f0a6531a5dfda9f21007aff Mon Sep 17 00:00:00 2001 From: Hridyanshu <124202756+HRIDYANSHU054@users.noreply.github.com> Date: Wed, 16 Oct 2024 23:52:31 +0530 Subject: [PATCH 118/122] docs: fixed misleading comment about the array method (forEach instead of reduce) used in AverageMean.js (#1727) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: fixed misleading comment about the array method (forEach instead of reduce) used in AverageMean.js * fix: optimized AverageMean.js by removing redundant comments and unnecessary operations. * Update Maths/AverageMean.js Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --------- Co-authored-by: Hridyanshu7 Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --- Maths/AverageMean.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Maths/AverageMean.js b/Maths/AverageMean.js index 75f7b1b58e..8ae3b55992 100644 --- a/Maths/AverageMean.js +++ b/Maths/AverageMean.js @@ -13,11 +13,7 @@ const mean = (nums) => { throw new TypeError('Invalid Input') } - // This loop sums all values in the 'nums' array using forEach loop - const sum = nums.reduce((sum, cur) => sum + cur, 0) - - // Divide sum by the length of the 'nums' array. - return sum / nums.length + return nums.reduce((sum, cur) => sum + cur, 0) / nums.length } export { mean } From d8588f9de18db16c29cd6c8332cd0de2c2bb2f3b Mon Sep 17 00:00:00 2001 From: Omkarnath Parida Date: Sat, 16 Nov 2024 21:38:17 +0530 Subject: [PATCH 119/122] Add tests for Project euler problem 14 solution (#1713) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 📦 NEW: Added solution for ProjectEuler-007 * 🐛 FIX: Spelling mistake fixes * 👌 IMPROVE: changed variable name from `inc` to `candidateValue` and thrown error in case of invalid input * 👌 IMPROVE: Modified the code * 👌 IMPROVE: Added test case for ProjectEuler Problem001 * 👌 IMPROVE: Added test cases for Project Euler Problem 4 * 👌 IMPROVE: auto prettier fixes * 📦 NEW: Testcases for Project Euler Problem 14 * Updated Documentation in README.md * 👌 IMPROVE: code improvements --------- Co-authored-by: Omkarnath Parida Co-authored-by: pomkarnath98 --- Project-Euler/test/Problem014.test.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Project-Euler/test/Problem014.test.js diff --git a/Project-Euler/test/Problem014.test.js b/Project-Euler/test/Problem014.test.js new file mode 100644 index 0000000000..ff464dd42d --- /dev/null +++ b/Project-Euler/test/Problem014.test.js @@ -0,0 +1,15 @@ +import { expect } from 'vitest' +import { findLongestCollatzSequence } from '../Problem014.js' + +describe('Longest Collatz Sequence', () => { + test.each([ + [2, 1], + [13, 9], + [1000000, 837799] + ])( + 'if limit is %i, then the Longest Collatz Sequence will be %i', + (a, expected) => { + expect(findLongestCollatzSequence(a)).toBe(expected) + } + ) +}) From 85a55daf49533b9fd558e52f13603a904613e4f2 Mon Sep 17 00:00:00 2001 From: Hridyanshu <124202756+HRIDYANSHU054@users.noreply.github.com> Date: Fri, 20 Dec 2024 21:35:50 +0530 Subject: [PATCH 120/122] test: added for Linear Search Algorithm (#1753) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test: added for Linear Search Algorithm * Update Search/LinearSearch.js Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --------- Co-authored-by: Hridyanshu7 Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> --- Search/LinearSearch.js | 2 ++ Search/test/LinearSearch.test.js | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 Search/test/LinearSearch.test.js diff --git a/Search/LinearSearch.js b/Search/LinearSearch.js index 637ebc1589..96a9d1fa34 100644 --- a/Search/LinearSearch.js +++ b/Search/LinearSearch.js @@ -3,6 +3,8 @@ * value within a list. It sequentially checks each element of the list * for the target value until a match is found or until all the elements * have been searched. + * + * @see https://en.wikipedia.org/wiki/Linear_search */ function SearchArray(searchNum, ar, output = (v) => console.log(v)) { const position = Search(ar, searchNum) diff --git a/Search/test/LinearSearch.test.js b/Search/test/LinearSearch.test.js new file mode 100644 index 0000000000..d593d9aa1c --- /dev/null +++ b/Search/test/LinearSearch.test.js @@ -0,0 +1,35 @@ +import { Search as linearSearch } from '../LinearSearch' + +const tests = [ + { + test: { + arr: [1, 2, 300, 401, 450, 504, 800, 821, 855, 900, 1002], + target: 900 + }, + expectedValue: 9 + }, + { + test: { + arr: [1, 104, 110, 4, 44, 55, 56, 78], + target: 104 + }, + expectedValue: 1 + }, + { + test: { + arr: [-4, 5, 50, 77, 821, 85, 99, 100], + target: 192 + }, + expectedValue: -1 + } +] + +describe('Linear Search', () => { + it.each(tests)( + 'linearSearch($test.arr, $test.target) => $expectedValue', + ({ test, expectedValue }) => { + const { arr, target } = test + expect(linearSearch(arr, target)).toBe(expectedValue) + } + ) +}) From a62a46e732798622b520769c9c1131a052721ca2 Mon Sep 17 00:00:00 2001 From: Shankha Suvra Dam <71999854+SpiderMath@users.noreply.github.com> Date: Sun, 12 Jan 2025 15:57:54 +0530 Subject: [PATCH 121/122] Resolve duplicate entries for sieve of eratosthenes (#1770) * remove intarr test * Remove main file oops * FIXES: #1666 , remove references to SieveOfEratosthenesIntArray * Finally fix the requirements, passes vitest * Updated Documentation in README.md * FIXES: #1666 and conform to alg comment standards --------- Co-authored-by: SpiderMath --- DIRECTORY.md | 1 - Maths/SieveOfEratosthenes.js | 43 ++++++++++--------- Maths/SieveOfEratosthenesIntArray.js | 24 ----------- Maths/test/SieveOfEratosthenes.test.js | 37 +++++++++++----- .../test/SieveOfEratosthenesIntArray.test.js | 12 ------ Project-Euler/Problem035.js | 2 +- 6 files changed, 49 insertions(+), 70 deletions(-) delete mode 100644 Maths/SieveOfEratosthenesIntArray.js delete mode 100644 Maths/test/SieveOfEratosthenesIntArray.test.js diff --git a/DIRECTORY.md b/DIRECTORY.md index 7f6484cae5..5e8e1f401a 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -254,7 +254,6 @@ * [RowEchelon](Maths/RowEchelon.js) * [ShorsAlgorithm](Maths/ShorsAlgorithm.js) * [SieveOfEratosthenes](Maths/SieveOfEratosthenes.js) - * [SieveOfEratosthenesIntArray](Maths/SieveOfEratosthenesIntArray.js) * [Signum](Maths/Signum.js) * [SimpsonIntegration](Maths/SimpsonIntegration.js) * [Softmax](Maths/Softmax.js) diff --git a/Maths/SieveOfEratosthenes.js b/Maths/SieveOfEratosthenes.js index 01e141f2f0..681d8ba904 100644 --- a/Maths/SieveOfEratosthenes.js +++ b/Maths/SieveOfEratosthenes.js @@ -1,25 +1,26 @@ -const sieveOfEratosthenes = (n) => { - /* - * Calculates prime numbers till a number n - * :param n: Number up to which to calculate primes - * :return: A boolean list containing only primes - */ - const primes = new Array(n + 1) - primes.fill(true) // set all as true initially - primes[0] = primes[1] = false // Handling case for 0 and 1 - const sqrtn = Math.ceil(Math.sqrt(n)) - for (let i = 2; i <= sqrtn; i++) { - if (primes[i]) { - for (let j = i * i; j <= n; j += i) { - /* - Optimization. - Let j start from i * i, not 2 * i, because smaller multiples of i have been marked false. +/** + * @function sieveOfEratosthenes + * @description Function to get all the prime numbers below a given number using sieve of eratosthenes algorithm + * @param {Number} max The limit below which all the primes are required to be + * @returns {Number[]} An array of all the prime numbers below max + * @see [Sieve of Eratosthenes](https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes) + * @example + * sieveOfEratosthenes(1) // ====> [] + * @example + * sieveOfEratosthenes(20) // ====> [2, 3, 5, 7, 11, 13, 17, 19] + * + */ +function sieveOfEratosthenes(max) { + const sieve = [] + const primes = [] - For example, let i = 4. - We do not have to check from 8(4 * 2) to 12(4 * 3) - because they have been already marked false when i=2 and i=3. - */ - primes[j] = false + for (let i = 2; i <= max; ++i) { + if (!sieve[i]) { + // If i has not been marked then it is prime + primes.push(i) + for (let j = i << 1; j <= max; j += i) { + // Mark all multiples of i as non-prime + sieve[j] = true } } } diff --git a/Maths/SieveOfEratosthenesIntArray.js b/Maths/SieveOfEratosthenesIntArray.js deleted file mode 100644 index 56336ce7d8..0000000000 --- a/Maths/SieveOfEratosthenesIntArray.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Function to get all prime numbers below a given number - * This function returns an array of prime numbers - * @see {@link https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes} - */ - -function sieveOfEratosthenes(max) { - const sieve = [] - const primes = [] - - for (let i = 2; i <= max; ++i) { - if (!sieve[i]) { - // If i has not been marked then it is prime - primes.push(i) - for (let j = i << 1; j <= max; j += i) { - // Mark all multiples of i as non-prime - sieve[j] = true - } - } - } - return primes -} - -export { sieveOfEratosthenes } diff --git a/Maths/test/SieveOfEratosthenes.test.js b/Maths/test/SieveOfEratosthenes.test.js index 056693d39b..1a10b8bc7f 100644 --- a/Maths/test/SieveOfEratosthenes.test.js +++ b/Maths/test/SieveOfEratosthenes.test.js @@ -1,14 +1,29 @@ import { sieveOfEratosthenes } from '../SieveOfEratosthenes' -import { PrimeCheck } from '../PrimeCheck' - -describe('should return an array of prime booleans', () => { - it('should have each element in the array as a prime boolean', () => { - const n = 30 - const primes = sieveOfEratosthenes(n) - primes.forEach((primeBool, index) => { - if (primeBool) { - expect(PrimeCheck(index)).toBeTruthy() - } - }) + +describe('sieveOfEratosthenes', () => { + test('returns an empty array for max < 2', () => { + expect(sieveOfEratosthenes(1)).toEqual([]) + }) + + test('returns [2] for max = 2', () => { + expect(sieveOfEratosthenes(2)).toEqual([2]) + }) + + test('returns [2, 3] for max = 3', () => { + expect(sieveOfEratosthenes(3)).toEqual([2, 3]) + }) + + test('returns [2, 3, 5, 7] for max = 10', () => { + expect(sieveOfEratosthenes(10)).toEqual([2, 3, 5, 7]) + }) + + test('returns [2, 3, 5, 7, 11, 13, 17, 19] for max = 20', () => { + expect(sieveOfEratosthenes(20)).toEqual([2, 3, 5, 7, 11, 13, 17, 19]) + }) + + test('returns [2, 3, 5, 7, 11, 13, 17, 19, 23, 29] for max = 30', () => { + expect(sieveOfEratosthenes(30)).toEqual([ + 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 + ]) }) }) diff --git a/Maths/test/SieveOfEratosthenesIntArray.test.js b/Maths/test/SieveOfEratosthenesIntArray.test.js deleted file mode 100644 index e3a3be3002..0000000000 --- a/Maths/test/SieveOfEratosthenesIntArray.test.js +++ /dev/null @@ -1,12 +0,0 @@ -import { sieveOfEratosthenes } from '../SieveOfEratosthenesIntArray' -import { PrimeCheck } from '../PrimeCheck' - -describe('should return an array of prime numbers', () => { - it('should have each element in the array as a prime numbers', () => { - const n = 100 - const primes = sieveOfEratosthenes(n) - primes.forEach((prime) => { - expect(PrimeCheck(prime)).toBeTruthy() - }) - }) -}) diff --git a/Project-Euler/Problem035.js b/Project-Euler/Problem035.js index c877acba5a..0b11cd0357 100644 --- a/Project-Euler/Problem035.js +++ b/Project-Euler/Problem035.js @@ -9,7 +9,7 @@ * * @author ddaniel27 */ -import { sieveOfEratosthenes } from '../Maths/SieveOfEratosthenesIntArray' +import { sieveOfEratosthenes } from '../Maths/SieveOfEratosthenes' function problem35(n) { if (n < 2) { From 1d252d7acae4ac46a3fc5d972c068cb95688c2f7 Mon Sep 17 00:00:00 2001 From: Ridge Kimani <101694484+ridge-kimani@users.noreply.github.com> Date: Wed, 15 Jan 2025 14:11:02 +0300 Subject: [PATCH 122/122] feat: add tests for binary search trees (#1769) --- Data-Structures/Tree/BinarySearchTree.js | 17 +++-- .../Tree/test/BinarySearchTree.test.js | 66 +++++++++++++++++++ 2 files changed, 76 insertions(+), 7 deletions(-) create mode 100644 Data-Structures/Tree/test/BinarySearchTree.test.js diff --git a/Data-Structures/Tree/BinarySearchTree.js b/Data-Structures/Tree/BinarySearchTree.js index abbcc3fb62..8a65c8e650 100644 --- a/Data-Structures/Tree/BinarySearchTree.js +++ b/Data-Structures/Tree/BinarySearchTree.js @@ -36,13 +36,13 @@ const Node = (function Node() { visit(output = (value) => console.log(value)) { // Recursively go left if (this.left !== null) { - this.left.visit() + this.left.visit(output) } // Print out value output(this.value) // Recursively go right if (this.right !== null) { - this.right.visit() + this.right.visit(output) } } @@ -116,20 +116,23 @@ const Tree = (function () { } // Inorder traversal - traverse() { + traverse(output = (value) => console.log(value)) { if (!this.root) { // No nodes are there in the tree till now return } - this.root.visit() + this.root.visit(output) } // Start by searching the root search(val) { - const found = this.root.search(val) - if (found !== null) { - return found.value + if (this.root) { + const found = this.root.search(val) + if (found !== null) { + return found.value + } } + // not found return null } diff --git a/Data-Structures/Tree/test/BinarySearchTree.test.js b/Data-Structures/Tree/test/BinarySearchTree.test.js new file mode 100644 index 0000000000..4c6c353592 --- /dev/null +++ b/Data-Structures/Tree/test/BinarySearchTree.test.js @@ -0,0 +1,66 @@ +import { Tree } from '../BinarySearchTree.js' + +describe('Binary Search Tree', () => { + let tree + + beforeEach(() => { + tree = new Tree() + tree.addValue(10) + tree.addValue(5) + tree.addValue(15) + tree.addValue(3) + tree.addValue(8) + }) + + test('should add values to the tree', () => { + tree.addValue(12) + + expect(tree.search(12)).toBe(12) + expect(tree.search(5)).toBe(5) + expect(tree.search(15)).toBe(15) + }) + + test('should perform in-order traversal', () => { + const values = [] + const output = (val) => values.push(val) + tree.traverse(output) + expect(values).toEqual([3, 5, 8, 10, 15]) + }) + + test('should remove leaf nodes correctly', () => { + tree.removeValue(5) + expect(tree.search(5)).toBeNull() + }) + + test('should remove nodes with one child correctly', () => { + tree.addValue(12) + tree.removeValue(15) + + expect(tree.search(15)).toBeNull() + expect(tree.search(12)).toBe(12) + }) + + test('should remove nodes with two children correctly', () => { + tree.addValue(18) + tree.removeValue(15) + + expect(tree.search(15)).toBeNull() + expect(tree.search(18)).toBe(18) + }) + + test('should return null for non-existent values', () => { + expect(tree.search(20)).toBeNull() + expect(tree.search(0)).toBeNull() + }) + + test('should handle removal of root node correctly', () => { + tree.removeValue(10) + expect(tree.search(10)).toBeNull() + }) + + test('should handle empty tree gracefully', () => { + const newTree = new Tree() + newTree.removeValue(22) // Should not throw + expect(newTree.search(22)).toBeNull() + }) +})