mirror of https://bitbucket.org/ausocean/av.git
Merged in m3u-packages (pull request #332)
mjpeg-player: made node.js packages compatible for es6 import/exports Approved-by: Saxon Milton Approved-by: Scott Barnard
This commit is contained in:
commit
1b7e817266
|
@ -10,7 +10,7 @@ var has = Object.prototype.hasOwnProperty
|
|||
* @constructor
|
||||
* @private
|
||||
*/
|
||||
function Events() {}
|
||||
function Events() { }
|
||||
|
||||
//
|
||||
// We try to not inherit from `Object.prototype`. In some engines creating an
|
||||
|
@ -185,7 +185,7 @@ EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
|
|||
case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
|
||||
}
|
||||
|
||||
for (i = 1, args = new Array(len -1); i < len; i++) {
|
||||
for (i = 1, args = new Array(len - 1); i < len; i++) {
|
||||
args[i - 1] = arguments[i];
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
|
|||
case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
|
||||
case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
|
||||
default:
|
||||
if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
|
||||
if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) {
|
||||
args[j - 1] = arguments[j];
|
||||
}
|
||||
|
||||
|
@ -328,9 +328,4 @@ EventEmitter.prefixed = prefix;
|
|||
//
|
||||
EventEmitter.EventEmitter = EventEmitter;
|
||||
|
||||
//
|
||||
// Expose the module.
|
||||
//
|
||||
if ('undefined' !== typeof module) {
|
||||
module.exports = EventEmitter;
|
||||
}
|
||||
export default EventEmitter;
|
||||
|
|
|
@ -1,22 +1,18 @@
|
|||
// see https://tools.ietf.org/html/rfc1808
|
||||
|
||||
/* jshint ignore:start */
|
||||
(function(root) {
|
||||
/* jshint ignore:end */
|
||||
var URL_REGEX = /^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/;
|
||||
var FIRST_SEGMENT_REGEX = /^([^\/?#]*)(.*)$/;
|
||||
var SLASH_DOT_REGEX = /(?:\/|^)\.(?=\/)/g;
|
||||
var SLASH_DOT_DOT_REGEX = /(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g;
|
||||
|
||||
var URL_REGEX = /^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/;
|
||||
var FIRST_SEGMENT_REGEX = /^([^\/?#]*)(.*)$/;
|
||||
var SLASH_DOT_REGEX = /(?:\/|^)\.(?=\/)/g;
|
||||
var SLASH_DOT_DOT_REGEX = /(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g;
|
||||
|
||||
var URLToolkit = { // jshint ignore:line
|
||||
var URLToolkit = { // jshint ignore:line
|
||||
// If opts.alwaysNormalize is true then the path will always be normalized even when it starts with / or //
|
||||
// E.g
|
||||
// With opts.alwaysNormalize = false (default, spec compliant)
|
||||
// http://a.com/b/cd + /e/f/../g => http://a.com/e/f/../g
|
||||
// With opts.alwaysNormalize = true (not spec compliant)
|
||||
// http://a.com/b/cd + /e/f/../g => http://a.com/e/g
|
||||
buildAbsoluteURL: function(baseURL, relativeURL, opts) {
|
||||
buildAbsoluteURL: function (baseURL, relativeURL, opts) {
|
||||
opts = opts || {};
|
||||
// remove any remaining space and CRLF
|
||||
baseURL = baseURL.trim();
|
||||
|
@ -112,7 +108,7 @@
|
|||
}
|
||||
return URLToolkit.buildURLFromParts(builtParts);
|
||||
},
|
||||
parseURL: function(url) {
|
||||
parseURL: function (url) {
|
||||
var parts = URL_REGEX.exec(url);
|
||||
if (!parts) {
|
||||
return null;
|
||||
|
@ -126,7 +122,7 @@
|
|||
fragment: parts[6] || ''
|
||||
};
|
||||
},
|
||||
normalizePath: function(path) {
|
||||
normalizePath: function (path) {
|
||||
// The following operations are
|
||||
// then applied, in order, to the new path:
|
||||
// 6a) All occurrences of "./", where "." is a complete path
|
||||
|
@ -142,22 +138,12 @@
|
|||
// 6d) If the path ends with "<segment>/..", where <segment> is a
|
||||
// complete path segment not equal to "..", that
|
||||
// "<segment>/.." is removed.
|
||||
while (path.length !== (path = path.replace(SLASH_DOT_DOT_REGEX, '')).length) {} // jshint ignore:line
|
||||
while (path.length !== (path = path.replace(SLASH_DOT_DOT_REGEX, '')).length) { } // jshint ignore:line
|
||||
return path.split('').reverse().join('');
|
||||
},
|
||||
buildURLFromParts: function(parts) {
|
||||
buildURLFromParts: function (parts) {
|
||||
return parts.scheme + parts.netLoc + parts.path + parts.params + parts.query + parts.fragment;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/* jshint ignore:start */
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = URLToolkit;
|
||||
else if(typeof define === 'function' && define.amd)
|
||||
define([], function() { return URLToolkit; });
|
||||
else if(typeof exports === 'object')
|
||||
exports["URLToolkit"] = URLToolkit;
|
||||
else
|
||||
root["URLToolkit"] = URLToolkit;
|
||||
})(this);
|
||||
/* jshint ignore:end */
|
||||
export default URLToolkit;
|
||||
|
|
Loading…
Reference in New Issue