Projekt

Obecné

Profil

Stáhnout (571 Bajtů) Statistiky
| Větev: | Revize:
1
'use strict';
2

    
3
var GetIntrinsic = require('../GetIntrinsic');
4

    
5
var $TypeError = GetIntrinsic('%TypeError%');
6

    
7
var IsPropertyKey = require('./IsPropertyKey');
8
var ToObject = require('./ToObject');
9

    
10
/**
11
 * 7.3.2 GetV (V, P)
12
 * 1. Assert: IsPropertyKey(P) is true.
13
 * 2. Let O be ToObject(V).
14
 * 3. ReturnIfAbrupt(O).
15
 * 4. Return O.[[Get]](P, V).
16
 */
17

    
18
module.exports = function GetV(V, P) {
19
	// 7.3.2.1
20
	if (!IsPropertyKey(P)) {
21
		throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
22
	}
23

    
24
	// 7.3.2.2-3
25
	var O = ToObject(V);
26

    
27
	// 7.3.2.4
28
	return O[P];
29
};
(28-28/109)