|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
568 bytes
|
| Rev | Line | |
|---|
| [9af201e] | 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | var $TypeError = require('es-errors/type');
|
|---|
| 4 |
|
|---|
| 5 | var inspect = require('object-inspect');
|
|---|
| 6 |
|
|---|
| 7 | var isPropertyKey = require('../helpers/isPropertyKey');
|
|---|
| 8 |
|
|---|
| 9 | var isObject = require('es-object-atoms/isObject');
|
|---|
| 10 |
|
|---|
| 11 | // https://262.ecma-international.org/6.0/#sec-get-o-p
|
|---|
| 12 |
|
|---|
| 13 | module.exports = function Get(O, P) {
|
|---|
| 14 | // 7.3.1.1
|
|---|
| 15 | if (!isObject(O)) {
|
|---|
| 16 | throw new $TypeError('Assertion failed: Type(O) is not Object');
|
|---|
| 17 | }
|
|---|
| 18 | // 7.3.1.2
|
|---|
| 19 | if (!isPropertyKey(P)) {
|
|---|
| 20 | throw new $TypeError('Assertion failed: P is not a Property Key, got ' + inspect(P));
|
|---|
| 21 | }
|
|---|
| 22 | // 7.3.1.3
|
|---|
| 23 | return O[P];
|
|---|
| 24 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.