bmssp 0.11.0 → 0.12.0
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/README.md +16 -5
- package/index.mjs +1 -1
- package/package.json +1 -1
- package/src/bmssp.mjs +9 -7
package/README.md
CHANGED
|
@@ -29,20 +29,31 @@ To use this package, you can import it in your JavaScript code as follows:
|
|
|
29
29
|
|
|
30
30
|
```javascript
|
|
31
31
|
// This is a WIP example
|
|
32
|
-
import {
|
|
32
|
+
import { BMSSP } from "bmssp";
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const myBMSSP = new BMSSP([
|
|
35
|
+
[0, 1, 50],
|
|
36
|
+
[1, 2, 75],
|
|
37
|
+
[0, 2, 25],
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
console.log(myBMSSP.graph);
|
|
36
41
|
```
|
|
37
42
|
|
|
38
43
|
The file must use ECMAScript modules (ESM) syntax and have the `.mjs` file extension. Go to the `examples` directory for more usage examples.
|
|
39
44
|
|
|
40
45
|
### Using the docker image
|
|
41
46
|
|
|
42
|
-
You can also use the published docker image and run
|
|
47
|
+
You can also use the published docker image and run the example:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
docker run -it sirivasv/bmssp-js:latest
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Or your tests in a pre-configured environment (replace `folder-mytest/` with your tests folder and `index.mjs` with your test file):
|
|
43
54
|
|
|
44
55
|
```bash
|
|
45
|
-
docker run -it -v ./mytest
|
|
56
|
+
docker run -it -v ./folder-mytest/:/bmssp-js/folder-mytest/ sirivasv/bmssp-js:latest node /bmssp-js/folder-mytest/index.mjs
|
|
46
57
|
```
|
|
47
58
|
|
|
48
59
|
Other versions of the docker image can be found on [Docker Hub](https://hub.docker.com/r/sirivasv/bmssp-js/tags).
|
package/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { BMSSP } from "./src/bmssp.mjs";
|
package/package.json
CHANGED
package/src/bmssp.mjs
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
class BMSSP {
|
|
2
|
+
constructor(inputGraph) {
|
|
3
|
+
this.graph = [];
|
|
4
|
+
for (let edge of inputGraph) {
|
|
5
|
+
// Create a deep copy of each edge array
|
|
6
|
+
this.graph.push([...edge]);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
3
9
|
}
|
|
4
10
|
|
|
5
|
-
|
|
6
|
-
return `Processed: ${message}`;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export { printMessage, processMessage };
|
|
11
|
+
export { BMSSP };
|