Skip to content

Commit

Permalink
style: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
FeliciousX committed Aug 5, 2020
1 parent bc98ca1 commit 6f0d771
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 26 deletions.
26 changes: 10 additions & 16 deletions __tests__/classes/DOMMatrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,19 @@ describe('DOMMatrix class', () => {

it('should return Float32Array', () => {
const matrix32 = new DOMMatrix().toFloat32Array();
expect(matrix32).toBeInstanceOf(Float32Array)
expect(matrix32).toStrictEqual(new Float32Array([
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
]))
})
expect(matrix32).toBeInstanceOf(Float32Array);
expect(matrix32).toStrictEqual(
new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])
);
});

it('should return Float64Array', () => {
const matrix64 = new DOMMatrix().toFloat64Array();
expect(matrix64).toBeInstanceOf(Float64Array)
expect(matrix64).toStrictEqual(new Float64Array([
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
]))
})
expect(matrix64).toBeInstanceOf(Float64Array);
expect(matrix64).toStrictEqual(
new Float64Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])
);
});

it('should know if a 2d matrix is an identity matrix', () => {
const matrix = new DOMMatrix([1, 0, 0, 1, 0, 0]);
Expand Down
44 changes: 34 additions & 10 deletions src/classes/DOMMatrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,43 @@ export default class DOMMatrix {

toFloat32Array() {
return new Float32Array([
this.m11, this.m12, this.m13, this.m14,
this.m21, this.m22, this.m23, this.m24,
this.m31, this.m32, this.m33, this.m34,
this.m41, this.m42, this.m43, this.m44
])
this.m11,
this.m12,
this.m13,
this.m14,
this.m21,
this.m22,
this.m23,
this.m24,
this.m31,
this.m32,
this.m33,
this.m34,
this.m41,
this.m42,
this.m43,
this.m44,
]);
}

toFloat64Array() {
return new Float64Array([
this.m11, this.m12, this.m13, this.m14,
this.m21, this.m22, this.m23, this.m24,
this.m31, this.m32, this.m33, this.m34,
this.m41, this.m42, this.m43, this.m44
])
this.m11,
this.m12,
this.m13,
this.m14,
this.m21,
this.m22,
this.m23,
this.m24,
this.m31,
this.m32,
this.m33,
this.m34,
this.m41,
this.m42,
this.m43,
this.m44,
]);
}
}

0 comments on commit 6f0d771

Please sign in to comment.