summaryrefslogtreecommitdiffstats
path: root/core/src/OC/util.js
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2019-02-01 08:51:46 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2019-02-01 08:51:46 +0100
commit799a0fbb78560cd03e14764b5b7544761478f309 (patch)
tree706728b1fffa13efcfba9c80fab18790200dd713 /core/src/OC/util.js
parent0d43ef06f5dbd05edfe61e9c78461e15312834ea (diff)
downloadnextcloud-server-799a0fbb78560cd03e14764b5b7544761478f309.tar.gz
nextcloud-server-799a0fbb78560cd03e14764b5b7544761478f309.zip
Make chunkify an internal function to prevent context errors
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core/src/OC/util.js')
-rw-r--r--core/src/OC/util.js44
1 files changed, 22 insertions, 22 deletions
diff --git a/core/src/OC/util.js b/core/src/OC/util.js
index c139a57be07..dd66f4b2954 100644
--- a/core/src/OC/util.js
+++ b/core/src/OC/util.js
@@ -28,6 +28,26 @@ import History from './util-history'
import OC from './index'
import humanFileSize from '../Util/human-file-size'
+function chunkify(t) {
+ // Adapted from http://my.opera.com/GreyWyvern/blog/show.dml/1671288
+ let tz = [], x = 0, y = -1, n = 0, code, c;
+
+ while (x < t.length) {
+ c = t.charAt(x);
+ // only include the dot in strings
+ var m = ((!n && c === '.') || (c >= '0' && c <= '9'));
+ if (m !== n) {
+ // next chunk
+ y++;
+ tz[y] = '';
+ n = m;
+ }
+ tz[y] += c;
+ x++;
+ }
+ return tz;
+}
+
/**
* Utility functions
* @namespace OC.Util
@@ -169,26 +189,6 @@ export default {
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
},
- _chunkify: function (t) {
- // Adapted from http://my.opera.com/GreyWyvern/blog/show.dml/1671288
- var tz = [], x = 0, y = -1, n = 0, code, c;
-
- while (x < t.length) {
- c = t.charAt(x);
- // only include the dot in strings
- var m = ((!n && c === '.') || (c >= '0' && c <= '9'));
- if (m !== n) {
- // next chunk
- y++;
- tz[y] = '';
- n = m;
- }
- tz[y] += c;
- x++;
- }
- return tz;
- },
-
/**
* Compare two strings to provide a natural sort
* @param a first string to compare
@@ -198,8 +198,8 @@ export default {
*/
naturalSortCompare: function (a, b) {
var x;
- var aa = this._chunkify(a);
- var bb = this._chunkify(b);
+ var aa = chunkify(a);
+ var bb = chunkify(b);
for (x = 0; aa[x] && bb[x]; x++) {
if (aa[x] !== bb[x]) {