BVB Source Codes

reactide Show index.js Source code

Return Download reactide: download index.js Source code - Download reactide Source code - Type:.js
  1. var compare = require('./compare');
  2.  
  3. function mediator(a, b) {
  4.         return compare(this, a.converted, b.converted);
  5. }
  6.  
  7. module.exports = function (array, opts) {
  8.         if (!Array.isArray(array) || array.length < 2) {
  9.                 return array;
  10.         }
  11.         if (typeof opts !== 'object') {
  12.                 opts = {};
  13.         }
  14.         opts.sign = !!opts.sign;
  15.         var insensitive = !!opts.insensitive;
  16.         var result = Array(array.length);
  17.         var i, max, value;
  18.  
  19.         for (i = 0, max = array.length; i < max; i += 1) {
  20.                 value = String(array[i]);
  21.                 result[i] = {
  22.                         value: array[i],
  23.                         converted: insensitive ? value.toLowerCase() : value
  24.                 };
  25.         }
  26.  
  27.         result.sort(mediator.bind(opts));
  28.  
  29.         for (i = result.length - 1; ~i; i -= 1) {
  30.                 result[i] = result[i].value;
  31.         }
  32.  
  33.         return result;
  34. };
  35.  
downloadindex.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