New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-fpgrowth

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-fpgrowth - npm Package Compare versions

Comparing version

to
1.2.0

dist/fpgrowth-client.js

9

examples/example.js

@@ -11,3 +11,2 @@ var fpgrowth = require("../dist/fpgrowth");

// Execute FPGrowth with a minimum support of 40%.

@@ -27,7 +26,5 @@ var fpgrowth = new fpgrowth.FPGrowth(.4);

fpgrowth.exec(transactions)
.then(function (result) {
// Returns both the collection of frequent itemsets and execution time in millisecond.
var frequentItemsets = result.itemsets;
var executionTime = result.executionTime;
console.log(`Finished executing FPGrowth. ${frequentItemsets.length} frequent itemsets were found in ${executionTime}ms.`);
.then(function (itemsets) {
// Returns an array representing the frequent itemsets.
console.log(`Finished executing FPGrowth. ${itemsets.length} frequent itemset(s) were found.`);
});
{
"name": "node-fpgrowth",
"version": "1.1.0",
"version": "1.2.0",
"description": "FPGrowth frequent itemset mining algorithm implementation in TypeScript / JavaScript.",

@@ -9,3 +9,4 @@ "main": "dist/fpgrowth.js",

"test": "npm run tsc && node examples/example.js",
"tsc": "./node_modules/typescript/bin/tsc"
"tsc": "./node_modules/typescript/bin/tsc",
"browserify": "npm run tsc && node ./node_modules/browserify/bin/cmd.js dist/fpgrowth.js --standalone fpgrowth -o dist/fpgrowth-client.js"
},

@@ -38,4 +39,5 @@ "repository": {

"@types/node": "^8.5.2",
"browserify": "^16.2.0",
"typescript": "^2.6.2"
}
}

@@ -20,4 +20,4 @@ # Node-FPGrowth

```js
import { FPGrowth, Itemset, IFPGrowthResults } from 'node-fpgrowth';
```typescript
import { FPGrowth, Itemset } from 'node-fpgrowth';

@@ -44,6 +44,4 @@ let transactions: number[][] = [

fpgrowth.exec(transactions)
.then( (result: IFPGrowthResults<number>) => {
// Returns both the collection of frequent itemsets and execution time in millisecond.
let frequentItemsets: Itemset<number>[] = result.itemsets;
let executionTime: number = result.executionTime;
.then( (itemsets: Itemset<number>[]) => {
// Returns an array representing the frequent itemsets.
});

@@ -53,2 +51,24 @@

**Node-FPGrowth** is compatible with [browserify](http://browserify.org/) and [webpack](https://webpack.js.org/).
Alternatively, you can import/serve the browserified `fpgrowth-client.js` file found in the `dist` folder:
```html
<script src="./dist/fpgrowth-client.js"></script>
<script>
var transactions = [
[1, 3, 4],
[2, 3, 5],
[1, 2, 3, 5],
[2, 5],
[1, 2, 3, 5]
];
var fpg = new fpgrowth.FPGrowth(.4);
fpg.exec(transactions, function (itemsets) {
console.log(`Finished executing FPGrowth. ${itemsets.length} frequent itemset(s) were found.`);
});
</script>
```
### Building from source

@@ -60,14 +80,18 @@ - Clone this repository:

```
- Install the project's dependencies with `npm`:
- Install the project's dependencies with:
```bash
npm install
```
- Compile the project's sources to NodeJS executable JavaScript:
- Compile the module's sources to executable JavaScript:
```bash
npm run tsc
```
- This should allow you to execute the given [example](./examples/example.js) as follows:
- This should run the [example](./examples/example.js) bundled with the module:
```bash
npm test
```
- This should recreate a browserified version, `./dist/fpgrowth-client.js`, of the module:
```bash
npm run browserify
```

@@ -74,0 +98,0 @@ ## License

Sorry, the diff of this file is not supported yet