Socket
Socket
Sign inDemoInstall

@lite-js/try2get

Package Overview
Dependencies
1
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @lite-js/try2get

get any or get all return values


Version published
Weekly downloads
1
Maintainers
1
Created
Weekly downloads
 

Readme

Source

try2get

get any or get all return values

install

npm i try2get --save

use cases

getting a supported XHR object xhr.js:

const try2get = require('try2get');
const xhr = try2get.one(
    () => new XMLHttpRequest(),
    () => new ActiveXObject('MSXML2.XMLHTTP'),
    () => new ActiveXObject('Microsoft.XMLHTTP')
);

listing all the supported features built-ins.js:

const try2get = require('../index');
const lang = require('zero-lang');

const features = try2get.all([
    () => ArrayBuffer,
    () => Atomics,
    () => DataView,
    () => Float32Array,
    () => Float64Array,
    () => JSON,
    () => Map,
    () => Math,
    () => Promise,
    () => Proxy,
    () => Reflect,
    () => SIMD,
    () => Set,
    () => Symbol,
    () => Uint16Array,
    () => Uint32Array,
    () => Uint8Array,
    () => Uint8ClampedArray,
    () => WeakMap,
    () => WeakSet,
]);

console.log(lang.map(features, feature => feature.toString()));

Keywords

FAQs

Last updated on 27 May 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc