@lite-js/try2get
get any or get all return values
Last updated 3 years ago by leungwensen .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @lite-js/try2get 
SYNC missed versions from official npm registry.

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()));

Current Tags

  • 0.0.1                                ...           latest (3 years ago)

1 Versions

  • 0.0.1                                ...           3 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |