Skip to content

Commit 0450ae6

Browse files
committed
Add anchors
1 parent 3fdfa80 commit 0450ae6

File tree

1 file changed

+111
-1
lines changed
  • lib/node_modules/@stdlib/array/float32

1 file changed

+111
-1
lines changed

lib/node_modules/@stdlib/array/float32/README.md

+111-1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ var arr = new Float32Array( buf, 0, 4 );
105105

106106
### Properties
107107

108+
<a name="static-prop-bytes-per-element"></a>
109+
108110
#### Float32Array.BYTES_PER_ELEMENT
109111

110112
Number of bytes per view element.
@@ -116,6 +118,8 @@ var nbytes = Float32Array.BYTES_PER_ELEMENT;
116118
// returns 4
117119
```
118120

121+
<a name="static-prop-name"></a>
122+
119123
#### Float32Array.name
120124

121125
[Typed array][mdn-typed-array] constructor name.
@@ -127,6 +131,8 @@ var str = Float32Array.name;
127131
// returns 'Float32Array'
128132
```
129133

134+
<a name="prop-buffer"></a>
135+
130136
#### Float32Array.prototype.buffer
131137

132138
**Read-only** property which returns the [`ArrayBuffer`][mdn-arraybuffer] referenced by the [typed array][mdn-typed-array].
@@ -139,6 +145,8 @@ var buf = arr.buffer;
139145
// returns <ArrayBuffer>
140146
```
141147

148+
<a name="prop-byte-length"></a>
149+
142150
#### Float32Array.prototype.byteLength
143151

144152
**Read-only** property which returns the length (in bytes) of the [typed array][mdn-typed-array].
@@ -151,6 +159,8 @@ var byteLength = arr.byteLength;
151159
// returns 20
152160
```
153161

162+
<a name="prop-byte-offset"></a>
163+
154164
#### Float32Array.prototype.byteOffset
155165

156166
**Read-only** property which returns the offset (in bytes) of the [typed array][mdn-typed-array] from the start of its [`ArrayBuffer`][mdn-arraybuffer].
@@ -163,6 +173,8 @@ var byteOffset = arr.byteOffset;
163173
// returns 0
164174
```
165175

176+
<a name="prop-bytes-per-element"></a>
177+
166178
#### Float32Array.prototype.BYTES_PER_ELEMENT
167179

168180
Number of bytes per view element.
@@ -175,6 +187,8 @@ var nbytes = arr.BYTES_PER_ELEMENT;
175187
// returns 4
176188
```
177189

190+
<a name="prop-length"></a>
191+
178192
#### Float32Array.prototype.length
179193

180194
**Read-only** property which returns the number of view elements.
@@ -191,7 +205,103 @@ var len = arr.length;
191205

192206
### Methods
193207

194-
TODO: add methods
208+
<a name="static-method-from"></a>
209+
210+
#### factory.from( src\[, map\[, thisArg]] )
211+
212+
Creates a new named typed tuple from an array-like `object` or an iterable.
213+
214+
```javascript
215+
var factory = namedtypedtuple( [ 'x', 'y' ] );
216+
217+
var tuple = factory.from( [ 1.0, -1.0 ] );
218+
219+
var x = tuple.x;
220+
// returns 1.0
221+
222+
x = tuple[ 0 ];
223+
// returns 1.0
224+
225+
var y = tuple.y;
226+
// returns -1.0
227+
228+
y = tuple[ 1 ];
229+
// returns -1.0
230+
```
231+
232+
To invoke a function for each `src` value, provide a callback function.
233+
234+
```javascript
235+
var factory = namedtypedtuple( [ 'x', 'y' ] );
236+
237+
function mapFcn( v ) {
238+
return v * 2.0;
239+
}
240+
241+
var tuple = factory.from( [ 1.0, -1.0 ], mapFcn );
242+
243+
var x = tuple.x;
244+
// returns 2.0
245+
246+
x = tuple[ 0 ];
247+
// returns 2.0
248+
249+
var y = tuple.y;
250+
// returns -2.0
251+
252+
y = tuple[ 1 ];
253+
// returns -2.0
254+
```
255+
256+
A callback function is provided three arguments:
257+
258+
- `value`: source value
259+
- `index`: source index
260+
- `field`: tuple field
261+
262+
To set the callback execution context, provide a `thisArg`.
263+
264+
```javascript
265+
var factory = namedtypedtuple( [ 'x', 'y' ] );
266+
267+
function mapFcn( v ) {
268+
this.count += 1;
269+
return v * 2.0;
270+
}
271+
272+
var ctx = {
273+
'count': 0
274+
};
275+
276+
var tuple = factory.from( [ 1.0, -1.0 ], mapFcn, ctx );
277+
278+
var n = ctx.count;
279+
// returns 2
280+
```
281+
282+
<a name="static-method-of"></a>
283+
284+
#### factory.of( element0\[, element1\[, ...\[, elementN]]] )
285+
286+
Creates a new named typed tuple from a variable number of arguments.
287+
288+
```javascript
289+
var factory = namedtypedtuple( [ 'x', 'y' ] );
290+
291+
var tuple = factory.of( 1.0, -1.0 );
292+
293+
var x = tuple.x;
294+
// returns 1.0
295+
296+
x = tuple[ 0 ];
297+
// returns 1.0
298+
299+
var y = tuple.y;
300+
// returns -1.0
301+
302+
y = tuple[ 1 ];
303+
// returns -1.0
304+
```
195305

196306
</section>
197307

0 commit comments

Comments
 (0)