|
Last change
on this file since cdcff72 was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
910 bytes
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
|---|
| 3 | Author Sergey Melyukov @smelukov
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | "use strict";
|
|---|
| 7 |
|
|---|
| 8 | const RuntimeGlobals = require("../RuntimeGlobals");
|
|---|
| 9 | const RuntimeModule = require("../RuntimeModule");
|
|---|
| 10 | const Template = require("../Template");
|
|---|
| 11 |
|
|---|
| 12 | /** @typedef {import("../Compilation")} Compilation */
|
|---|
| 13 |
|
|---|
| 14 | class HasOwnPropertyRuntimeModule extends RuntimeModule {
|
|---|
| 15 | constructor() {
|
|---|
| 16 | super("hasOwnProperty shorthand");
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | /**
|
|---|
| 20 | * Generates runtime code for this runtime module.
|
|---|
| 21 | * @returns {string | null} runtime code
|
|---|
| 22 | */
|
|---|
| 23 | generate() {
|
|---|
| 24 | const compilation = /** @type {Compilation} */ (this.compilation);
|
|---|
| 25 | const { runtimeTemplate } = compilation;
|
|---|
| 26 |
|
|---|
| 27 | return Template.asString([
|
|---|
| 28 | `${RuntimeGlobals.hasOwnProperty} = ${runtimeTemplate.returningFunction(
|
|---|
| 29 | "Object.prototype.hasOwnProperty.call(obj, prop)",
|
|---|
| 30 | "obj, prop"
|
|---|
| 31 | )}`
|
|---|
| 32 | ]);
|
|---|
| 33 | }
|
|---|
| 34 | }
|
|---|
| 35 |
|
|---|
| 36 | module.exports = HasOwnPropertyRuntimeModule;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.