BVB Source Codes

reactide Show browsers.js Source code

Return Download reactide: download browsers.js Source code - Download reactide Source code - Type:.js
  1. (function() {
  2.   var Browsers, browserslist, utils;
  3.  
  4.   browserslist = require('browserslist');
  5.  
  6.   utils = require('./utils');
  7.  
  8.   Browsers = (function() {
  9.     Browsers.prefixes = function() {
  10.       var data, i, name;
  11.       if (this.prefixesCache) {
  12.         return this.prefixesCache;
  13.       }
  14.       data = require('caniuse-db/data.json').agents;
  15.       return this.prefixesCache = utils.uniq((function() {
  16.         var results;
  17.         results = [];
  18.         for (name in data) {
  19.           i = data[name];
  20.           results.push("-" + i.prefix + "-");
  21.         }
  22.         return results;
  23.       })()).sort(function(a, b) {
  24.         return b.length - a.length;
  25.       });
  26.     };
  27.  
  28.     Browsers.withPrefix = function(value) {
  29.       if (!this.prefixesRegexp) {
  30.         this.prefixesRegexp = RegExp("" + (this.prefixes().join('|')));
  31.       }
  32.       return this.prefixesRegexp.test(value);
  33.     };
  34.  
  35.     function Browsers(data1, requirements, options, stats) {
  36.       this.data = data1;
  37.       this.options = options;
  38.       this.stats = stats;
  39.       this.selected = this.parse(requirements);
  40.     }
  41.  
  42.     Browsers.prototype.parse = function(requirements) {
  43.       var ref, ref1;
  44.       return browserslist(requirements, {
  45.         stats: this.stats,
  46.         path: (ref = this.options) != null ? ref.from : void 0,
  47.         env: (ref1 = this.options) != null ? ref1.env : void 0
  48.       });
  49.     };
  50.  
  51.     Browsers.prototype.browsers = function(criteria) {
  52.       var browser, data, ref, selected, versions;
  53.       selected = [];
  54.       ref = this.data;
  55.       for (browser in ref) {
  56.         data = ref[browser];
  57.         versions = criteria(data).map(function(version) {
  58.           return browser + " " + version;
  59.         });
  60.         selected = selected.concat(versions);
  61.       }
  62.       return selected;
  63.     };
  64.  
  65.     Browsers.prototype.prefix = function(browser) {
  66.       var data, name, prefix, ref, version;
  67.       ref = browser.split(' '), name = ref[0], version = ref[1];
  68.       data = this.data[name];
  69.       if (data.prefix_exceptions) {
  70.         prefix = data.prefix_exceptions[version];
  71.       }
  72.       prefix || (prefix = data.prefix);
  73.       return '-' + prefix + '-';
  74.     };
  75.  
  76.     Browsers.prototype.isSelected = function(browser) {
  77.       return this.selected.indexOf(browser) !== -1;
  78.     };
  79.  
  80.     return Browsers;
  81.  
  82.   })();
  83.  
  84.   module.exports = Browsers;
  85.  
  86. }).call(this);
  87.  
downloadbrowsers.js Source code - Download reactide Source code
Related Source Codes/Software:
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
postal - 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top