Inline ES Modules

Andrea Giammarchi andrea.giammarchi at gmail.com
Tue Jun 19 18:23:43 UTC 2018


we need to go deeper ...

```js
(async () => {

const {getPersonType} = await import(`data:application/javascript,
export function getPersonType(person) {
  switch (person) {
    case 'Teacher': return 'A teacher';
    case 'Director': return 'A director';
  }
}
`)

console.log(
  getPersonType('Teacher')
);

})();
```

💩



On Tue, Jun 19, 2018 at 12:10 AM, Darien Valentine <valentinium at gmail.com>
wrote:

> ```
> import getPersonType from 'data:text/javascript,\
>   export default function getPersonType(person) {\
>     switch (person) {\
>       case \'Teacher\': return \'A teacher\';\
>       case \'Director\': return \'A director\';\
>     }\
>   }';
> ```
>
> okay, not a serious suggestion, but it does technically work :)
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180619/ef2b97bc/attachment.html>


More information about the es-discuss mailing list