BVB Source Codes

reactide Show utils.js Source code

Return Download reactide: download utils.js Source code - Download reactide Source code - Type:.js
  1. 'use strict';
  2.  
  3. exports.repeat = function (str, num) {
  4.   var result = '';
  5.   for (var i = 0; i < num; i++) { result += str; }
  6.   return result;
  7. };
  8.  
  9. exports.arrayEqual = function (a, b) {
  10.   if (a.length !== b.length) { return false; }
  11.   for (var i = 0; i < a.length; i++) {
  12.     if (a[i] !== b[i]) { return false; }
  13.   }
  14.   return true;
  15. };
  16.  
  17. exports.trimChars = function (str, chars) {
  18.   var start = 0;
  19.   var end = str.length - 1;
  20.   while (chars.indexOf(str.charAt(start)) >= 0) { start++; }
  21.   while (chars.indexOf(str.charAt(end)) >= 0) { end--; }
  22.   return str.slice(start, end + 1);
  23. };
  24.  
  25. exports.capitalize = function (str) {
  26.   return str.charAt(0).toUpperCase() + str.slice(1);
  27. };
  28.  
  29. exports.arrayUnion = function () {
  30.   var result = [];
  31.   for (var i = 0, values = {}; i < arguments.length; i++) {
  32.     var arr = arguments[i];
  33.     for (var j = 0; j < arr.length; j++) {
  34.       if (!values[arr[j]]) {
  35.         values[arr[j]] = true;
  36.         result.push(arr[j]);
  37.       }
  38.     }
  39.   }
  40.   return result;
  41. };
  42.  
  43. function has(obj, key) {
  44.   return Object.prototype.hasOwnProperty.call(obj, key);
  45. }
  46.  
  47. exports.has = has;
  48.  
  49. exports.extend = function (dest, src) {
  50.   for (var i in src) {
  51.     if (has(src, i)) { dest[i] = src[i]; }
  52.   }
  53. };
  54.  
  55. exports.trimEnd = function (str) {
  56.   return str.replace(/\s+$/g, '');
  57. };
  58.  
downloadutils.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