Commit c811aefa authored by Aral Balkan's avatar Aral Balkan
Browse files

Update all remaining examples to ESM format

parent 03a74c22
const JSDF = require('../../lib/JSDF')
const faker = require('faker')
import JSDF from '../../lib/JSDF.js'
import faker from 'faker'
const card = faker.helpers.createCard()
......@@ -35,8 +35,8 @@ console.timeLog('serialise custom objects')
let folks
......@@ -3,6 +3,7 @@
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
const fs = require('fs')
const JSDB = require('../..')
import fs from 'fs'
import JSDB from '../../index.js'
const db ='db')
<script src="db/episodes.js"></script>
<h1>Lovecraft Country</h1>
<p>Episodes and ratings from <a href=''>IMDB</a>:</p>
<ul id='episodes'>
<script type="module">
import { _ as episodes } from '/db/episodes.js'
const episodesList = document.getElementById('episodes')
episodes.forEach(episode => {
document.write(`<li><strong>${episode.title}</strong> ⭐ ${episode.rating}</li>`)
const li = document.createElement('li')
li.innerHTML = `<strong>${episode.title}</strong> ⭐ ${episode.rating}`
const JSDB = require('../..')
import JSDB from '../../index.js'
// Open your database (creating it if it doesn’t exist)
// It will be stored in a directory called “db”.
const JSDB = require('../..')
import JSDB from '../../index.js'
const db ='db')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment