Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit17ad4dc

Browse files
committed
Upgrade packages.
1 parent58640ee commit17ad4dc

File tree

14 files changed

+1898
-745
lines changed

14 files changed

+1898
-745
lines changed

‎package-lock.json

Lines changed: 1845 additions & 698 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@
3636
},
3737
"homepage":"https://github.com/trekhleb/javascript-algorithms#readme",
3838
"devDependencies": {
39-
"@types/jest":"^22.2.3",
39+
"@types/jest":"^23.1.4",
4040
"babel-cli":"^6.26.0",
4141
"babel-preset-env":"^1.7.0",
4242
"codecov":"^3.0.2",
4343
"eslint":"^4.19.1",
44-
"eslint-config-airbnb":"^16.1.0",
45-
"eslint-plugin-import":"^2.12.0",
46-
"eslint-plugin-jest":"^21.15.2",
47-
"eslint-plugin-jsx-a11y":"^6.0.3",
48-
"eslint-plugin-react":"^7.8.2",
49-
"jest":"^22.4.4",
44+
"eslint-config-airbnb":"^17.0.0",
45+
"eslint-plugin-import":"^2.13.0",
46+
"eslint-plugin-jest":"^21.17.0",
47+
"eslint-plugin-jsx-a11y":"^6.1.0",
48+
"eslint-plugin-react":"^7.10.0",
49+
"jest":"^23.3.0",
5050
"pre-commit":"^1.2.2"
5151
},
5252
"dependencies": {}

‎src/algorithms/graph/prim/prim.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ export default function prim(graph) {
6060
nextMinVertex.getEdges().forEach((graphEdge)=>{
6161
// Add only vertices that link to unvisited nodes.
6262
if(
63-
!visitedVertices[graphEdge.startVertex.getKey()]||
64-
!visitedVertices[graphEdge.endVertex.getKey()]
63+
!visitedVertices[graphEdge.startVertex.getKey()]
64+
||!visitedVertices[graphEdge.endVertex.getKey()]
6565
){
6666
edgesQueue.add(graphEdge,graphEdge.weight);
6767
}

‎src/algorithms/math/primality-test/trialDivision.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ export default function trialDivision(number) {
1111
if(number<=1){
1212
// If number is less than one then it isn't prime by definition.
1313
returnfalse;
14-
}elseif(number<=3){
14+
}
15+
16+
if(number<=3){
1517
// All numbers from 2 to 3 are prime.
1618
returntrue;
1719
}

‎src/algorithms/sets/knapsack-problem/Knapsack.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,16 @@ export default class Knapsack {
128128
// In this case this would mean that we need to include previous item
129129
// to the list of selected items.
130130
if(
131-
knapsackMatrix[itemIndex][weightIndex]&&
132-
knapsackMatrix[itemIndex][weightIndex]===knapsackMatrix[itemIndex-1][weightIndex]
131+
knapsackMatrix[itemIndex][weightIndex]
132+
&&knapsackMatrix[itemIndex][weightIndex]===knapsackMatrix[itemIndex-1][weightIndex]
133133
){
134134
// Check if there are several items with the same weight but with the different values.
135135
// We need to add highest item in the matrix that is possible to get the highest value.
136136
constprevSumValue=knapsackMatrix[itemIndex-1][weightIndex];
137137
constprevPrevSumValue=knapsackMatrix[itemIndex-2][weightIndex];
138138
if(
139-
!prevSumValue||
140-
(prevSumValue&&prevPrevSumValue!==prevSumValue)
139+
!prevSumValue
140+
||(prevSumValue&&prevPrevSumValue!==prevSumValue)
141141
){
142142
this.selectedItems.push(prevItem);
143143
}

‎src/algorithms/sorting/insertion-sort/InsertionSort.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export default class InsertionSort extends Sort {
1414
// Go and check if previous elements and greater then current one.
1515
// If this is the case then swap that elements.
1616
while(
17-
array[currentIndex-1]!==undefined&&
18-
this.comparator.lessThan(array[currentIndex],array[currentIndex-1])
17+
array[currentIndex-1]!==undefined
18+
&&this.comparator.lessThan(array[currentIndex],array[currentIndex-1])
1919
){
2020
// Call visiting callback.
2121
this.callbacks.visitingCallback(array[currentIndex-1]);

‎src/algorithms/sorting/radix-sort/RadixSort.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ export default class RadixSort extends Sort {
1818
constnumPasses=this.determineNumPasses(sortedArray);
1919

2020
for(letcurrentIndex=0;currentIndex<numPasses;currentIndex+=1){
21-
constbuckets=isArrayOfNumbers ?
22-
this.placeElementsInNumberBuckets(sortedArray,currentIndex) :
23-
this.placeElementsInCharacterBuckets(sortedArray,currentIndex,numPasses);
21+
constbuckets=isArrayOfNumbers
22+
?this.placeElementsInNumberBuckets(sortedArray,currentIndex)
23+
:this.placeElementsInCharacterBuckets(sortedArray,currentIndex,numPasses);
2424

2525
// Flatten buckets into sortedArray, and repeat at next index
2626
sortedArray=buckets.reduce((acc,val)=>{

‎src/algorithms/string/regular-expression-matching/regularExpressionMatching.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,18 @@ export default function regularExpressionMatching(string, pattern) {
8888
matchMatrix[rowIndex][columnIndex]=true;
8989
}elseif(
9090
(
91-
pattern[patternIndex-1]===string[stringIndex]||
92-
pattern[patternIndex-1]===ANY_CHAR
93-
)&&
94-
matchMatrix[rowIndex-1][columnIndex]===true
91+
pattern[patternIndex-1]===string[stringIndex]
92+
||pattern[patternIndex-1]===ANY_CHAR
93+
)
94+
&&matchMatrix[rowIndex-1][columnIndex]===true
9595
){
9696
matchMatrix[rowIndex][columnIndex]=true;
9797
}else{
9898
matchMatrix[rowIndex][columnIndex]=false;
9999
}
100100
}elseif(
101-
pattern[patternIndex]===string[stringIndex]||
102-
pattern[patternIndex]===ANY_CHAR
101+
pattern[patternIndex]===string[stringIndex]
102+
||pattern[patternIndex]===ANY_CHAR
103103
){
104104
/*
105105
* In case if current pattern char is the same as current string char

‎src/algorithms/string/z-algorithm/zAlgorithm.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ function buildZArray(zString) {
4040
// more characters that are equal to the ones in the prefix we will expand
4141
// right Z box boundary by 3.
4242
while(
43-
zBoxRightIndex<zString.length&&
44-
zString[zBoxRightIndex-zBoxLeftIndex]===zString[zBoxRightIndex]
43+
zBoxRightIndex<zString.length
44+
&&zString[zBoxRightIndex-zBoxLeftIndex]===zString[zBoxRightIndex]
4545
){
4646
// Expanding Z box right boundary.
4747
zBoxRightIndex+=1;
@@ -81,8 +81,8 @@ function buildZArray(zString) {
8181
// And start comparing characters one by one as we normally do for the case
8282
// when we are outside of checkbox.
8383
while(
84-
zBoxRightIndex<zString.length&&
85-
zString[zBoxRightIndex-zBoxLeftIndex]===zString[zBoxRightIndex]
84+
zBoxRightIndex<zString.length
85+
&&zString[zBoxRightIndex-zBoxLeftIndex]===zString[zBoxRightIndex]
8686
){
8787
zBoxRightIndex+=1;
8888
}

‎src/algorithms/uncategorized/n-queens/nQueens.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ function isSafe(queensPositions, rowIndex, columnIndex) {
1616

1717
if(
1818
// Check if queen has been already placed.
19-
currentQueenPosition&&
20-
(
19+
currentQueenPosition
20+
&&(
2121
// Check if there are any queen on the same column.
22-
newQueenPosition.columnIndex===currentQueenPosition.columnIndex||
22+
newQueenPosition.columnIndex===currentQueenPosition.columnIndex
2323
// Check if there are any queen on the same row.
24-
newQueenPosition.rowIndex===currentQueenPosition.rowIndex||
24+
||newQueenPosition.rowIndex===currentQueenPosition.rowIndex
2525
// Check if there are any queen on the same left diagonal.
26-
newQueenPosition.leftDiagonal===currentQueenPosition.leftDiagonal||
26+
||newQueenPosition.leftDiagonal===currentQueenPosition.leftDiagonal
2727
// Check if there are any queen on the same right diagonal.
28-
newQueenPosition.rightDiagonal===currentQueenPosition.rightDiagonal
28+
||newQueenPosition.rightDiagonal===currentQueenPosition.rightDiagonal
2929
)
3030
){
3131
// Can't place queen into current position since there are other queens that

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp