0.0.1-security.1 • Published 1 year ago

@swenkerorg/perferendis-minus v0.0.1-security.1

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

@swenkerorg/perferendis-minus Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

Get and robustly cache all JS language-level intrinsics at first require time.

See the syntax described in the JS spec for reference.

Example

var GetIntrinsic = require('@swenkerorg/perferendis-minus');
var assert = require('assert');

// static methods
assert.equal(GetIntrinsic('%Math.pow%'), Math.pow);
assert.equal(Math.pow(2, 3), 8);
assert.equal(GetIntrinsic('%Math.pow%')(2, 3), 8);
delete Math.pow;
assert.equal(GetIntrinsic('%Math.pow%')(2, 3), 8);

// instance methods
var arr = [1];
assert.equal(GetIntrinsic('%Array.prototype.push%'), Array.prototype.push);
assert.deepEqual(arr, [1]);

arr.push(2);
assert.deepEqual(arr, [1, 2]);

GetIntrinsic('%Array.prototype.push%').call(arr, 3);
assert.deepEqual(arr, [1, 2, 3]);

delete Array.prototype.push;
GetIntrinsic('%Array.prototype.push%').call(arr, 4);
assert.deepEqual(arr, [1, 2, 3, 4]);

// missing features
delete JSON.parse; // to simulate a real intrinsic that is missing in the environment
assert.throws(() => GetIntrinsic('%JSON.parse%'));
assert.equal(undefined, GetIntrinsic('%JSON.parse%', true));

Tests

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

Security

Please email @ljharb or see https://tidelift.com/security if you have a potential security vulnerability to report.

3.5.14

1 year ago

5.6.31

1 year ago

5.6.30

1 year ago

3.6.22

1 year ago

3.6.21

1 year ago

3.6.20

1 year ago

3.5.18

1 year ago

3.5.17

1 year ago

3.5.16

1 year ago

3.5.15

1 year ago

4.6.22

1 year ago

4.6.23

1 year ago

4.6.26

1 year ago

4.6.24

1 year ago

0.0.1-security

1 year ago

4.6.25

1 year ago

3.4.14

1 year ago

3.6.19

1 year ago

3.6.18

1 year ago

5.6.29

1 year ago

5.6.26

1 year ago

5.6.28

1 year ago

5.6.27

1 year ago

3.3.14

1 year ago

3.3.13

1 year ago

3.3.12

1 year ago

3.3.11

1 year ago

2.3.11

1 year ago

2.2.11

1 year ago

1.2.11

1 year ago

1.2.10

1 year ago

1.2.9

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago