@gkucmierz/utils 1.23.0 → 1.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/main.mjs CHANGED
@@ -9,8 +9,8 @@ import {
9
9
  bijective2num, bijective2numBI, num2bijective, num2bijectiveBI
10
10
  } from './src/bijective-numeration.mjs'
11
11
  import {
12
- bisectionSearchArr
13
- } from './src/bisection-search.mjs'
12
+ binarySearchArr
13
+ } from './src/binary-search.mjs'
14
14
  import {
15
15
  egcd
16
16
  } from './src/egcd.mjs'
@@ -66,7 +66,7 @@ import {
66
66
  export * from './src/SetCnt.mjs';
67
67
  export * from './src/base64.mjs';
68
68
  export * from './src/bijective-numeration.mjs';
69
- export * from './src/bisection-search.mjs';
69
+ export * from './src/binary-search.mjs';
70
70
  export * from './src/egcd.mjs';
71
71
  export * from './src/factors.mjs';
72
72
  export * from './src/gcd.mjs';
@@ -86,5 +86,5 @@ export * from './src/square-root.mjs';
86
86
  export * from './src/tonelli-shanks.mjs';
87
87
 
88
88
  export default [
89
- SetCnt, fromBase64, fromBase64Url, toBase64, toBase64Url, bijective2num, bijective2numBI, num2bijective, num2bijectiveBI, bisectionSearchArr, egcd, factors, factorsBI, gcd, gcdBI, getType, gpn, gpnBI, Heap, heronsFormula, heronsFormulaBI, lcm, lcmBI, ListNode, matrixAsArray, memoize, mod, modBI, phi, phiBI, powMod, powModBI, array2range, range2array, squareRoot, squareRootBI, tonelliShanksBI
89
+ SetCnt, fromBase64, fromBase64Url, toBase64, toBase64Url, bijective2num, bijective2numBI, num2bijective, num2bijectiveBI, binarySearchArr, egcd, factors, factorsBI, gcd, gcdBI, getType, gpn, gpnBI, Heap, heronsFormula, heronsFormulaBI, lcm, lcmBI, ListNode, matrixAsArray, memoize, mod, modBI, phi, phiBI, powMod, powModBI, array2range, range2array, squareRoot, squareRootBI, tonelliShanksBI
90
90
  ];
package/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@gkucmierz/utils",
3
- "version": "1.23.0",
3
+ "version": "1.23.1",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@gkucmierz/utils",
9
- "version": "1.23.0",
9
+ "version": "1.23.1",
10
10
  "license": "MIT",
11
11
  "devDependencies": {
12
12
  "husky": "^8.0.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gkucmierz/utils",
3
- "version": "1.23.0",
3
+ "version": "1.23.1",
4
4
  "description": "Usefull functions for solving programming tasks",
5
5
  "main": "main.mjs",
6
6
  "scripts": {
@@ -0,0 +1,15 @@
1
+
2
+ import {
3
+ binarySearchArr,
4
+ } from '../src/binary-search.mjs';
5
+
6
+ describe('binarySearchArr', () => {
7
+ it('few cases', () => {
8
+ expect(binarySearchArr([1, 2, 3, 4], 1)).toBe(0);
9
+ expect(binarySearchArr([1, 2, 3, 4], 2)).toBe(1);
10
+ expect(binarySearchArr([1, 2, 3, 4], 3)).toBe(2);
11
+ expect(binarySearchArr([1, 2, 3, 4], 4)).toBe(3);
12
+ expect(binarySearchArr([1, 2, 3, 4], 0)).toBe(-1);
13
+ expect(binarySearchArr([1, 2, 3, 4], 5)).toBe(-1);
14
+ });
15
+ });
@@ -1,5 +1,5 @@
1
1
 
2
- export const bisectionSearchArr = (arr, target) => {
2
+ export const binarySearchArr = (arr, target) => {
3
3
  let [a, b] = [0, arr.length];
4
4
  let lm;
5
5
  while (b - a > 0) {
package/src/matrix.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- // represent matrix using array using Proxy
3
+ // represent matrix as array using Proxy
4
4
  // todo: iterator can be added
5
5
 
6
6
  export const matrixAsArray = matrix => {
@@ -1,15 +0,0 @@
1
-
2
- import {
3
- bisectionSearchArr,
4
- } from '../src/bisection-search.mjs';
5
-
6
- describe('bisectionSearchArr', () => {
7
- it('few cases', () => {
8
- expect(bisectionSearchArr([1, 2, 3, 4], 1)).toBe(0);
9
- expect(bisectionSearchArr([1, 2, 3, 4], 2)).toBe(1);
10
- expect(bisectionSearchArr([1, 2, 3, 4], 3)).toBe(2);
11
- expect(bisectionSearchArr([1, 2, 3, 4], 4)).toBe(3);
12
- expect(bisectionSearchArr([1, 2, 3, 4], 0)).toBe(-1);
13
- expect(bisectionSearchArr([1, 2, 3, 4], 5)).toBe(-1);
14
- });
15
- });