Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
731 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 | class HasOwnPropertyRuntimeModule extends RuntimeModule {
|
---|
13 | constructor() {
|
---|
14 | super("hasOwnProperty shorthand");
|
---|
15 | }
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * @returns {string} runtime code
|
---|
19 | */
|
---|
20 | generate() {
|
---|
21 | const { runtimeTemplate } = this.compilation;
|
---|
22 |
|
---|
23 | return Template.asString([
|
---|
24 | `${RuntimeGlobals.hasOwnProperty} = ${runtimeTemplate.returningFunction(
|
---|
25 | "Object.prototype.hasOwnProperty.call(obj, prop)",
|
---|
26 | "obj, prop"
|
---|
27 | )}`
|
---|
28 | ]);
|
---|
29 | }
|
---|
30 | }
|
---|
31 |
|
---|
32 | module.exports = HasOwnPropertyRuntimeModule;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.