0.0.1-security.1 • Published 1 year ago

@swenkerorg/veritatis-ad v0.0.1-security.1

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

globalThis Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ECMAScript spec-compliant polyfill/shim for globalThis. Invoke its "shim" method to shim globalThis if it is unavailable.

This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the spec proposal.

Most common usage:

var globalThis = require('@swenkerorg/veritatis-ad')(); // returns native globalThis if compliant
	/* or */
var globalThis = require('@swenkerorg/veritatis-ad/polyfill')(); // returns native globalThis if compliant

Example

var assert = require('assert');

// the below function is not CSP-compliant, but reliably gets the
// global object in sloppy mode in every engine.
var getGlobal = Function('return this');

assert.equal(globalThis, getGlobal());
/* when `globalThis` is not present */
var shimmedGlobal = require('@swenkerorg/veritatis-ad').shim();
	/* or */
var shimmedGlobal = require('@swenkerorg/veritatis-ad/shim')();

assert.equal(shimmedGlobal, globalThis);
assert.equal(shimmedGlobal, getGlobal());
/* when `globalThis` is present */
var shimmedGlobal = require('@swenkerorg/veritatis-ad').shim();

assert.equal(shimmedGlobal, globalThis);
assert.equal(shimmedGlobal, getGlobal());

Tests

Simply clone the repo, npm install, and run npm test

2.3.28

1 year ago

2.2.17

1 year ago

2.3.27

1 year ago

2.2.18

1 year ago

2.2.15

1 year ago

2.3.29

1 year ago

2.2.16

1 year ago

2.3.24

1 year ago

2.3.23

1 year ago

2.3.26

1 year ago

0.0.1-security

1 year ago

2.3.25

1 year ago

2.3.20

1 year ago

2.3.22

1 year ago

2.3.21

1 year ago

2.2.19

1 year ago

2.3.35

1 year ago

2.3.34

1 year ago

2.3.31

1 year ago

2.2.20

1 year ago

2.3.30

1 year ago

2.3.33

1 year ago

2.3.32

1 year ago

2.2.14

1 year ago

2.2.13

1 year ago

2.2.12

1 year ago

2.2.11

1 year ago

2.2.10

1 year ago

2.2.9

1 year ago

2.2.8

1 year ago

2.2.7

1 year ago

2.2.6

1 year ago

2.2.5

1 year ago

2.2.4

1 year ago

2.2.3

1 year ago

2.1.3

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.0

1 year ago