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.

Dependencies (0)


Dev Dependencies (1)


 

$ box install cffractions

No collaborators yet.
 
  • {{ getFullDate("Mar 29 2016 11:03 AM GMT") }}
  • {{ getFullDate("Jun 10 2016 06:06 AM GMT") }}
  • 1,396
  • 1,076
  • 1