From 1498aef23fa691bbe039c9035e0fa2cbe0f9c821 Mon Sep 17 00:00:00 2001 From: Sajad Dehshiri Date: Sat, 8 Oct 2022 22:46:25 +0330 Subject: [PATCH] Es6 example (#29) * Create package.json * Create index.js --- example/es6/index.js | 12 ++++++++++++ example/es6/package.json | 12 ++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 example/es6/index.js create mode 100644 example/es6/package.json diff --git a/example/es6/index.js b/example/es6/index.js new file mode 100644 index 0000000..b6cd3ce --- /dev/null +++ b/example/es6/index.js @@ -0,0 +1,12 @@ +import { readFile } from "fs/promises"; + +const cities = JSON.parse( + await readFile(new URL("../../json/cities.json", import.meta.url)) +); + +const provinces = JSON.parse( + await readFile(new URL("../../json/provinces.json", import.meta.url)) +); + +console.log("---------", cities); +console.log("
", "---------", provinces); diff --git a/example/es6/package.json b/example/es6/package.json new file mode 100644 index 0000000..fc2aa3c --- /dev/null +++ b/example/es6/package.json @@ -0,0 +1,12 @@ +{ + "name": "list-of-cities-in-iran", + "version": "1.2.0", + "description": "List of cities in Iran", + "type": "module", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Sajad Dehshiri ", + "license": "ISC" +} \ No newline at end of file