main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
858 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 | * @returns {string | null} runtime code
|
---|
21 | */
|
---|
22 | generate() {
|
---|
23 | const compilation = /** @type {Compilation} */ (this.compilation);
|
---|
24 | const { runtimeTemplate } = compilation;
|
---|
25 |
|
---|
26 | return Template.asString([
|
---|
27 | `${RuntimeGlobals.hasOwnProperty} = ${runtimeTemplate.returningFunction(
|
---|
28 | "Object.prototype.hasOwnProperty.call(obj, prop)",
|
---|
29 | "obj, prop"
|
---|
30 | )}`
|
---|
31 | ]);
|
---|
32 | }
|
---|
33 | }
|
---|
34 |
|
---|
35 | module.exports = HasOwnPropertyRuntimeModule;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.