nt 0.7.3 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/util.js DELETED
@@ -1,45 +0,0 @@
1
- const urlRegexp = /^(http|udp|ftp|dht)s?:\/\//;
2
-
3
- /**
4
- * Returns true if str is a URL.
5
- *
6
- * @param {string} str
7
- * @return {boolean}
8
- */
9
- exports.isURL = str => urlRegexp.test(str);
10
-
11
-
12
- /**
13
- * Returns true if n is an integer.
14
- *
15
- * @param {number} n
16
- * @return {boolean}
17
- */
18
- exports.isInteger = n => !isNaN(parseInt(n, 10));
19
-
20
-
21
- /**
22
- * Splits a path into an array, platform safe.
23
- *
24
- * @param {string} path
25
- * @return {Array.<string>}
26
- */
27
- exports.splitPath = path => path.split(path.sep);
28
-
29
-
30
- /**
31
- * Returns true if part of buffer `b` beginning at `start` matches buffer `a`.
32
- *
33
- * @param {Buffer} a
34
- * @param {Buffer} b
35
- * @param {number} start
36
- */
37
- exports.buffersMatch = (a, b, start) => {
38
- for (let i = 0, l = b.length; i < l; i++) {
39
- if (a[start + i] !== b[i]) {
40
- return false;
41
- }
42
- }
43
-
44
- return true;
45
- };