File tree Expand file tree Collapse file tree 5 files changed +93
-0
lines changed
ClearScriptTest/JavaScript/CommonJS Expand file tree Collapse file tree 5 files changed +93
-0
lines changed Original file line number Diff line number Diff line change 1+ // Copyright (c) Microsoft Corporation. All rights reserved.
2+ // Licensed under the MIT license.
3+
4+ // ReSharper disable once PossiblyUnassignedProperty
5+ exports . Meta = module . getContext ( ) ;
6+
7+ exports . Add = function ( a , b ) {
8+ return a + b ;
9+ }
10+
11+ exports . Subtract = function ( a , b ) {
12+ return a - b ;
13+ }
14+
15+ exports . Multiply = function ( a , b ) {
16+ return a * b ;
17+ }
18+
19+ exports . Divide = function ( a , b ) {
20+ return a / b ;
21+ }
Original file line number Diff line number Diff line change 1+ // Copyright (c) Microsoft Corporation. All rights reserved.
2+ // Licensed under the MIT license.
3+
4+ let Arithmetic = require ( "../Arithmetic/Arithmetic" ) ;
5+ let Self = require ( "Geometry" ) ;
6+
7+ // ReSharper disable once PossiblyUnassignedProperty
8+ exports . Meta = module . getContext ( ) ;
9+
10+ exports . Rectangle = class {
11+ constructor ( width , height ) {
12+ this . width = width ;
13+ this . height = height ;
14+ }
15+ get Area ( ) {
16+ return Self . Rectangle . CalculateArea ( this . width , this . height ) ;
17+ }
18+ static CalculateArea ( width , height ) {
19+ return Arithmetic . Multiply ( width , height ) ;
20+ }
21+ }
22+
23+ exports . Square = class extends exports . Rectangle {
24+ constructor ( side ) {
25+ super ( side , side ) ;
26+ }
27+ } ;
Original file line number Diff line number Diff line change 1+ // Copyright (c) Microsoft Corporation. All rights reserved.
2+ // Licensed under the MIT license.
3+
4+ let Arithmetic = require ( "Arithmetic" ) ;
5+ let Self = require ( "Geometry" ) ;
6+
7+ // ReSharper disable once PossiblyUnassignedProperty
8+ exports . Meta = module . getContext ( ) ;
9+
10+ exports . Rectangle = class {
11+ constructor ( width , height ) {
12+ this . width = width ;
13+ this . height = height ;
14+ }
15+ get Area ( ) {
16+ return Self . Rectangle . CalculateArea ( this . width , this . height ) ;
17+ }
18+ static CalculateArea ( width , height ) {
19+ return Arithmetic . Multiply ( width , height ) ;
20+ }
21+ }
22+
23+ exports . Square = class extends exports . Rectangle {
24+ constructor ( side ) {
25+ super ( side , side ) ;
26+ }
27+ } ;
Original file line number Diff line number Diff line change 1+ // Copyright (c) Microsoft Corporation. All rights reserved.
2+ // Licensed under the MIT license.
3+
4+ // ReSharper disable once JsPathNotFound
5+ let Geometry = require ( "Geometry/Geometry.js" ) ;
6+
7+ // ReSharper disable once ReturnFromGlobalScopetWithValue
8+ return new Geometry . Square ( 25 ) . Area ;
Original file line number Diff line number Diff line change 1+ // Copyright (c) Microsoft Corporation. All rights reserved.
2+ // Licensed under the MIT license.
3+
4+ // ReSharper disable once JsPathNotFound
5+ let Geometry = require ( "Geometry/Geometry" ) ;
6+
7+ foo . bar = new Geometry . Square ( 25 ) . Area ;
8+
9+ // ReSharper disable once ReturnFromGlobalScopetWithValue
10+ return foo . bar ;
You can’t perform that action at this time.
0 commit comments