Skip to content

Commit 075c739

Browse files
committed
Rename properties
1 parent f2ceeae commit 075c739

8 files changed

Lines changed: 39 additions & 39 deletions

File tree

lib/node_modules/@stdlib/types/complex64/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,25 @@ var nbytes = z.byteLength;
5858

5959
A `Complex64` instance has the following properties...
6060

61-
#### real
61+
#### re
6262

6363
A __read-only__ property returning the __real__ component.
6464

6565
``` javascript
6666
var z = new Complex64( 5.0, 3.0 );
6767

68-
var re = z.real;
68+
var re = z.re;
6969
// returns 5.0
7070
```
7171

72-
#### imag
72+
#### im
7373

7474
A __read-only__ property returning the __imaginary__ component.
7575

7676
``` javascript
7777
var z = new Complex64( 5.0, -3.0 );
7878

79-
var im = z.imag;
79+
var im = z.im;
8080
// returns -3.0
8181
```
8282

@@ -113,8 +113,8 @@ var o = z.toJSON();
113113
/*
114114
{
115115
"type": "Complex64",
116-
"real": 5.0,
117-
"imag": -3.0
116+
"re": 5.0,
117+
"im": -3.0
118118
}
119119
*/
120120
```
@@ -159,14 +159,14 @@ console.log( 'type: %s', typeof z );
159159
console.log( 'str: %s', z );
160160
// => str: 3 - 2i
161161

162-
console.log( 'real: %d', z.real );
162+
console.log( 'real: %d', z.re );
163163
// => real: 3.0
164164

165-
console.log( 'imag: %d', z.imag );
165+
console.log( 'imag: %d', z.im );
166166
// => imag: -2.0
167167

168168
console.log( 'JSON: %s', JSON.stringify( z ) );
169-
// => JSON: {"type":"Complex64","real":3,"imag":-2}
169+
// => JSON: {"type":"Complex64","re":3,"im":-2}
170170
```
171171

172172
</section>

lib/node_modules/@stdlib/types/complex64/benchmark/benchmark.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ bench( pkg+'::get:real', function benchmark( b ) {
3838

3939
b.tic();
4040
for ( i = 0; i < b.iterations; i++ ) {
41-
re = z.real;
41+
re = z.re;
4242
if ( isnan( re ) ) {
4343
b.fail( 'should not return NaN' );
4444
}
@@ -60,7 +60,7 @@ bench( pkg+'::get:imag', function benchmark( b ) {
6060

6161
b.tic();
6262
for ( i = 0; i < b.iterations; i++ ) {
63-
im = z.imag;
63+
im = z.im;
6464
if ( isnan( im ) ) {
6565
b.fail( 'should not return NaN' );
6666
}

lib/node_modules/@stdlib/types/complex64/docs/repl.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
z: Complex64
1919
64-bit complex number.
2020

21-
z.real: number
21+
z.re: number
2222
Read-only property returning the real component.
2323

24-
z.imag: number
24+
z.im: number
2525
Read-only property returning the imaginary component.
2626

2727
z.BYTES_PER_ELEMENT
@@ -34,9 +34,9 @@
3434
--------
3535
> var z = {{alias}}( 5.0, 3.0 )
3636
<Complex64>
37-
> z.real
37+
> z.re
3838
5.0
39-
> z.imag
39+
> z.im
4040
3.0
4141

4242
See Also

lib/node_modules/@stdlib/types/complex64/examples/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ console.log( 'type: %s', typeof z );
1010
console.log( 'str: %s', z );
1111
// => str: 3 - 2i
1212

13-
console.log( 'real: %d', z.real );
13+
console.log( 'real: %d', z.re );
1414
// => real: 3.0
1515

16-
console.log( 'imag: %d', z.imag );
16+
console.log( 'imag: %d', z.im );
1717
// => imag: -2.0
1818

1919
console.log( 'JSON: %s', JSON.stringify( z ) );
20-
// => JSON: {"type":"Complex64","real":3,"imag":-2}
20+
// => JSON: {"type":"Complex64","re":3,"im":-2}

lib/node_modules/@stdlib/types/complex64/lib/complex64.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ function Complex64( real, imag ) {
3535
if ( !isNumber( imag ) ) {
3636
throw new TypeError( 'invalid input argument. Imaginary component must be a number primitive. Value: `'+imag+'`.' );
3737
}
38-
Object.defineProperty( this, 'real', {
38+
Object.defineProperty( this, 're', {
3939
'configurable': false,
4040
'enumerable': true,
4141
'get': getReal
4242
});
4343

44-
Object.defineProperty( this, 'imag', {
44+
Object.defineProperty( this, 'im', {
4545
'configurable': false,
4646
'enumerable': true,
4747
'get': getImag
@@ -138,7 +138,7 @@ setReadOnly( Complex64.prototype, 'toString', require( './tostring.js' ) );
138138
* var z = new Complex64( 5.0, 3.0 );
139139
*
140140
* var obj = z.toJSON();
141-
* // returns { 'type': 'Complex64', 'real': 5.0, 'imag': 3.0 }
141+
* // returns { 'type': 'Complex64', 're': 5.0, 'im': 3.0 }
142142
*/
143143
setReadOnly( Complex64.prototype, 'toJSON', require( './tojson.js' ) );
144144

lib/node_modules/@stdlib/types/complex64/lib/tojson.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ function toJSON() {
1010
/* eslint-disable no-invalid-this */
1111
var out = {};
1212
out.type = 'Complex64';
13-
out.real = this.real;
14-
out.imag = this.imag;
13+
out.re = this.re;
14+
out.im = this.im;
1515
return out;
1616
} // end FUNCTION toJSON()
1717

lib/node_modules/@stdlib/types/complex64/lib/tostring.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
*/
1010
function toString() {
1111
/* eslint-disable no-invalid-this */
12-
var str = '' + this.real;
13-
if ( this.imag < 0 ) {
14-
str += ' - ' + (-this.imag);
12+
var str = '' + this.re;
13+
if ( this.im < 0 ) {
14+
str += ' - ' + (-this.im);
1515
} else {
16-
str += ' + ' + this.imag;
16+
str += ' + ' + this.im;
1717
}
1818
str += 'i';
1919
return str;

lib/node_modules/@stdlib/types/complex64/test/test.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ tape( 'the constructor prototype has a read-only `byteLength` property', functio
105105
}
106106
});
107107

108-
tape( 'the constructor returns an instance having a `real` property for getting the real component', function test( t ) {
108+
tape( 'the constructor returns an instance having a property for getting the real component', function test( t ) {
109109
var z = new Complex64( 5.0, 3.0 );
110-
t.strictEqual( z.real, 5.0, 'returns expected value' );
110+
t.strictEqual( z.re, 5.0, 'returns expected value' );
111111
t.end();
112112
});
113113

@@ -117,13 +117,13 @@ tape( 'the constructor returns an instance which throws an error when attempting
117117
t.end();
118118

119119
function foo() {
120-
z.real = -5.0;
120+
z.re = -5.0;
121121
}
122122
});
123123

124-
tape( 'the constructor returns an instance having an `imag` property for getting the imaginary component', function test( t ) {
124+
tape( 'the constructor returns an instance having a property for getting the imaginary component', function test( t ) {
125125
var z = new Complex64( 5.0, 3.0 );
126-
t.strictEqual( z.imag, 3.0, 'returns expected value' );
126+
t.strictEqual( z.im, 3.0, 'returns expected value' );
127127
t.end();
128128
});
129129

@@ -133,15 +133,15 @@ tape( 'the constructor returns an instance which throws an error when attempting
133133
t.end();
134134

135135
function foo() {
136-
z.imag = -3.0;
136+
z.im = -3.0;
137137
}
138138
});
139139

140140
tape( 'the constructor returns an instance which stores real and imaginary components as single-precision floating-point numbers', function test( t ) {
141141
var z = new Complex64( 3.14, -3.14 );
142142

143-
t.strictEqual( z.real, 3.140000104904175, 'stores as single-precision' );
144-
t.strictEqual( z.imag, -3.140000104904175, 'stores as single-precision' );
143+
t.strictEqual( z.re, 3.140000104904175, 'stores as single-precision' );
144+
t.strictEqual( z.im, -3.140000104904175, 'stores as single-precision' );
145145

146146
t.end();
147147
});
@@ -165,17 +165,17 @@ tape( 'the constructor returns an instance which supports serializing an instanc
165165
z = new Complex64( 5.0, -3.0 );
166166
expected = {
167167
'type': 'Complex64',
168-
'real': 5.0,
169-
'imag': -3.0
168+
're': 5.0,
169+
'im': -3.0
170170
};
171171
t.deepEqual( z.toJSON(), expected, 'returns expected value' );
172172
t.strictEqual( JSON.stringify( z ), JSON.stringify( expected ), 'serializes as JSON when called by JSON.stringify()' );
173173

174174
z = new Complex64( 5.0, 3.0 );
175175
expected = {
176176
'type': 'Complex64',
177-
'real': 5.0,
178-
'imag': 3.0
177+
're': 5.0,
178+
'im': 3.0
179179
};
180180
t.deepEqual( z.toJSON(), expected, 'returns expected value' );
181181
t.strictEqual( JSON.stringify( z ), JSON.stringify( expected ), 'serializes as JSON when called by JSON.stringify()' );

0 commit comments

Comments
 (0)