Big update!Announcing Socket for GitHub 1.0. Learn more
Socket
BlogLoveFAQ
Install
Log in

get-intrinsic

Package Overview
Dependencies
3
Maintainers
1
Versions
6
Issues
File Explorer

Advanced tools

get-intrinsic

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

    1.1.2latest

Version published
Maintainers
1
Weekly downloads
32,150,379
decreased by-2.43%

Weekly downloads

Changelog

Source

v1.1.2 - 2022-06-08

Fixed

Commits

  • [actions] reuse common workflows 0972547
  • [meta] use npmignore to autogenerate an npmignore file 5ba0b51
  • [actions] use node/install instead of node/run; use codecov action c364492
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, es-abstract, object-inspect, tape dc04dad
  • [Dev Deps] update eslint, @ljharb/eslint-config, es-abstract, object-inspect, safe-publish-latest, tape 1c14059
  • [Tests] use mock-property b396ef0
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, object-inspect, tape c2c758d
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, es-abstract, es-value-fixtures, object-inspect, tape 29e3c09
  • [actions] update codecov uploader 8cbc141
  • [Dev Deps] update @ljharb/eslint-config, es-abstract, es-value-fixtures, object-inspect, tape 10b6f5c
  • [readme] add github actions/codecov badges 4e25400
  • [Tests] use for-each instead of foreach c05b957
  • [Dev Deps] update es-abstract 29b05ae
  • [meta] use prepublishOnly script for npm 7+ 95c285d
  • [Deps] update has-symbols 593cb4f
  • [readme] fix repo URLs 1c8305b
  • [Deps] update has-symbols c7138b6
  • [Dev Deps] remove unused has-bigints bd63aff

Readme

Source

get-intrinsic 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('get-intrinsic'); 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.

Keywords

FAQs

What is get-intrinsic?

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

Is get-intrinsic popular?

The npm package get-intrinsic receives a total of 26,225,305 weekly downloads. As such, get-intrinsic popularity was classified as popular.

Is get-intrinsic well maintained?

We found that get-intrinsic demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 08 Jun 2022
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc