Projekt

Obecné

Profil

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

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

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

    
7
var CreateDataProperty = require('./CreateDataProperty');
8
var IsPropertyKey = require('./IsPropertyKey');
9
var Type = require('./Type');
10

    
11
// // https://ecma-international.org/ecma-262/6.0/#sec-createdatapropertyorthrow
12

    
13
module.exports = function CreateDataPropertyOrThrow(O, P, V) {
14
	if (Type(O) !== 'Object') {
15
		throw new $TypeError('Assertion failed: Type(O) is not Object');
16
	}
17
	if (!IsPropertyKey(P)) {
18
		throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
19
	}
20
	var success = CreateDataProperty(O, P, V);
21
	if (!success) {
22
		throw new $TypeError('unable to create data property');
23
	}
24
	return success;
25
};
(9-9/115)