aboutsummaryrefslogtreecommitdiffstats
path: root/core/src/OC/util.js
diff options
context:
space:
mode:
authordependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>2019-11-13 12:05:10 +0000
committerChristoph Wurst <christoph@winzerhof-wurst.at>2019-12-19 11:55:33 +0100
commitec01e0a790448fff38364f629a4de4edb5d465bf (patch)
tree8fb5369e3d6f9f805025802e12feaa4dfaef1e03 /core/src/OC/util.js
parent5d9fd7ba0cced84f1d07627b0860ac5490de164d (diff)
downloadnextcloud-server-ec01e0a790448fff38364f629a4de4edb5d465bf.tar.gz
nextcloud-server-ec01e0a790448fff38364f629a4de4edb5d465bf.zip
Bump eslint-config-nextcloud from 0.0.6 to 0.1.0
Bumps [eslint-config-nextcloud](https://github.com/nextcloud/eslint-config-nextcloud) from 0.0.6 to 0.1.0. - [Release notes](https://github.com/nextcloud/eslint-config-nextcloud/releases) - [Commits](https://github.com/nextcloud/eslint-config-nextcloud/compare/v0.0.6...v0.1.0) Co-authored-by: Christoph Wurst <christoph@winzerhof-wurst.at> Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core/src/OC/util.js')
-rw-r--r--core/src/OC/util.js42
1 files changed, 21 insertions, 21 deletions
diff --git a/core/src/OC/util.js b/core/src/OC/util.js
index 7c4a44b77d9..1bb4ae9ead0 100644
--- a/core/src/OC/util.js
+++ b/core/src/OC/util.js
@@ -28,7 +28,7 @@ import humanFileSize from '../Util/human-file-size'
function chunkify(t) {
// Adapted from http://my.opera.com/GreyWyvern/blog/show.dml/1671288
- let tz = []
+ const tz = []
let x = 0
let y = -1
let n = 0
@@ -37,7 +37,7 @@ function chunkify(t) {
while (x < t.length) {
c = t.charAt(x)
// only include the dot in strings
- var m = ((!n && c === '.') || (c >= '0' && c <= '9'))
+ const m = ((!n && c === '.') || (c >= '0' && c <= '9'))
if (m !== n) {
// next chunk
y++
@@ -75,10 +75,10 @@ export default {
return null
}
- var s = string.toLowerCase().trim()
- var bytes = null
+ const s = string.toLowerCase().trim()
+ let bytes = null
- var bytesArray = {
+ const bytesArray = {
'b': 1,
'k': 1024,
'kb': 1024,
@@ -89,10 +89,10 @@ export default {
'tb': 1024 * 1024 * 1024 * 1024,
't': 1024 * 1024 * 1024 * 1024,
'pb': 1024 * 1024 * 1024 * 1024 * 1024,
- 'p': 1024 * 1024 * 1024 * 1024 * 1024
+ 'p': 1024 * 1024 * 1024 * 1024 * 1024,
}
- var matches = s.match(/^[\s+]?([0-9]*)(\.([0-9]+))?( +)?([kmgtp]?b?)$/i)
+ const matches = s.match(/^[\s+]?([0-9]*)(\.([0-9]+))?( +)?([kmgtp]?b?)$/i)
if (matches !== null) {
bytes = parseFloat(s)
if (!isFinite(bytes)) {
@@ -124,7 +124,7 @@ export default {
* @returns {string} human readable difference from now
*/
relativeModifiedDate: function(timestamp) {
- var diff = moment().diff(moment(timestamp))
+ const diff = moment().diff(moment(timestamp))
if (diff >= 0 && diff < 45000) {
return t('core', 'seconds ago')
}
@@ -150,11 +150,11 @@ export default {
return this._scrollBarWidth
}
- var inner = document.createElement('p')
+ const inner = document.createElement('p')
inner.style.width = '100%'
inner.style.height = '200px'
- var outer = document.createElement('div')
+ const outer = document.createElement('div')
outer.style.position = 'absolute'
outer.style.top = '0px'
outer.style.left = '0px'
@@ -165,9 +165,9 @@ export default {
outer.appendChild(inner)
document.body.appendChild(outer)
- var w1 = inner.offsetWidth
+ const w1 = inner.offsetWidth
outer.style.overflow = 'scroll'
- var w2 = inner.offsetWidth
+ let w2 = inner.offsetWidth
if (w1 === w2) {
w2 = outer.clientWidth
}
@@ -199,13 +199,13 @@ export default {
* or 0 if the strings are identical
*/
naturalSortCompare: function(a, b) {
- var x
- var aa = chunkify(a)
- var bb = chunkify(b)
+ let x
+ const aa = chunkify(a)
+ const bb = chunkify(b)
for (x = 0; aa[x] && bb[x]; x++) {
if (aa[x] !== bb[x]) {
- var aNum = Number(aa[x]); var bNum = Number(bb[x])
+ const aNum = Number(aa[x]); const bNum = Number(bb[x])
// note: == is correct here
/* eslint-disable-next-line */
if (aNum == aa[x] && bNum == bb[x]) {
@@ -226,7 +226,7 @@ export default {
* @param {integer} interval in milliseconds
*/
waitFor: function(callback, interval) {
- var internalCallback = function() {
+ const internalCallback = function() {
if (callback() !== true) {
setTimeout(internalCallback, interval)
}
@@ -242,13 +242,13 @@ export default {
* @returns {boolean} true if the cookie with the given name has the given value
*/
isCookieSetToValue: function(name, value) {
- var cookies = document.cookie.split(';')
- for (var i = 0; i < cookies.length; i++) {
- var cookie = cookies[i].split('=')
+ const cookies = document.cookie.split(';')
+ for (let i = 0; i < cookies.length; i++) {
+ const cookie = cookies[i].split('=')
if (cookie[0].trim() === name && cookie[1].trim() === value) {
return true
}
}
return false
- }
+ },
}