From ece54d5f23bb1ba49719e9b32409d3800da097c2 Mon Sep 17 00:00:00 2001 From: Jan Klaas Kollhof Date: Sat, 18 Jul 2020 18:27:16 +0200 Subject: [PATCH] feat: add globals module to allow access to all global objects via import --- package.json | 2 +- src/globals.js | 1 + src/nullish.test.fnk | 1 + src/reflect.test.fnk | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 src/globals.js diff --git a/package.json b/package.json index 562ca65..b44ba8a 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "build": "run build:*", "build:dir": "mkdir -p ./build/pkg/", "build:fnk": "fnk --src ./src --out-dir build/pkg --ignore './src/**/*.test.fnk'", - "build:js": "cp ./src/this.js ./src/reflect.js ./src/nullish.js ./build/pkg/", + "build:js": "cp ./src/globals.js ./src/this.js ./src/reflect.js ./src/nullish.js ./build/pkg/", "build:files": "cp ./package.json ./README.md ./LICENSE ./build/pkg/", "test": "run jest", "jest": "jest --verbose --runInBand --no-cache ", diff --git a/src/globals.js b/src/globals.js new file mode 100644 index 0000000..6d41ca0 --- /dev/null +++ b/src/globals.js @@ -0,0 +1 @@ +module.exports = globalThis; \ No newline at end of file diff --git a/src/nullish.test.fnk b/src/nullish.test.fnk index 949c4b7..4f53f7a 100644 --- a/src/nullish.test.fnk +++ b/src/nullish.test.fnk @@ -1,6 +1,7 @@ {describe, it, expect, to_equal} = import '@fink/jest' {null, undefined} = import './nullish' +{JSON} = import './globals' describe 'null, undefined', fn: diff --git a/src/reflect.test.fnk b/src/reflect.test.fnk index 16b6648..cb23f7a 100644 --- a/src/reflect.test.fnk +++ b/src/reflect.test.fnk @@ -8,6 +8,7 @@ get_type, is_instance } = import './reflect' +{String, Array} = import './globals' describe 'reflect', fn: