Skip to content

lite-js/try2get

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

try2get

npm version Build Status

get any or get all return values

install

npm i @lite-js/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()));

About

get any or get all return values

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published