FORGEBOX Enterprise 🚀 - Take your ColdFusion (CFML) Development to Modern Times! Learn More...

CFFractions

v1.0.0 Public
# CFFractions

## A simple CFML whole value implementation of fractions

### Fraction

#### `plus`

```cfc
	var f1 = new CFFractions.models.Fraction(1, 5);
	var f2 = new CFFractions.models.Fraction(2, 3);
	var sum = f1.plus(f2);
	writeDump(sum.toString); // 13/15
```

#### `minus`

```cfc
	var f1 = new CFFractions.models.Fraction(5, 6);
	var f2 = new CFFractions.models.Fraction(1, 6);
	var difference = f1.minus(f2);
	writeDump(difference.toString); // 2/3
```

#### `times`

```cfc
	var f1 = new CFFractions.models.Fraction(2, 6);
	var f2 = new CFFractions.models.Fraction(-1, 6);
	var product = f1.times(f2);
	writeDump(product.toString); // -1/18
```

#### `divdedBy`

```cfc
	var f1 = new CFFractions.models.Fraction(1, 5);
	var f2 = new CFFractions.models.Fraction(2, -3);
	var quotient = f1.divdedBy(f2);
	writeDump(quotient.toString); // -3/10
```

### Factory

#### `make`

```cfc
	var factory = new CFFractions.models.Factory();
	var fraction = factory.make(3, 4);
	writeDump(fraction.toString()); // 3/4
```

### WireBox Integration

Inject `Factory` in to your component using `[email protected]`.  This lets you avoid having to specify `initArguments` in your `createInstance` calls.

Here are all the versions for this package. Please note that you can leverage CommandBox package versioning to install any package you like. Please refer to our managing package version guide for more information.

Version Created Last Update Published By Stable Actions
Current
1.0.0 Mar 29 2016 11:40 AM Jun 10 2016 06:30 AM

 

$ box install cffractions

No collaborators yet.
 
  • Mar 29 2016 11:40 AM
  • Jun 10 2016 06:30 AM
  • 1,082
  • 902
  • 1