runtime-shared
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -51,2 +51,6 @@ | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
// https://github.com/WebReflection/url-search-params | ||
@@ -79,21 +83,2 @@ | ||
function URLSearchParams(query) { | ||
this[secret] = Object.create(null); | ||
if (!query) return; | ||
if (query.charAt(0) === '?') { | ||
query = query.slice(1); | ||
} | ||
for (var index, value, pairs = (query || '').split('&'), i = 0, length = pairs.length; i < length; i++) { | ||
value = pairs[i]; | ||
index = value.indexOf('='); | ||
if (-1 < index) { | ||
this.append(decode(value.slice(0, index)), decode(value.slice(index + 1))); | ||
} else if (value.length) { | ||
this.append(decode(value), ''); | ||
} | ||
} | ||
} | ||
var URLSearchParamsProto = URLSearchParams.prototype; | ||
function isIterable() { | ||
@@ -107,138 +92,161 @@ try { | ||
URLSearchParamsProto.append = function append(name, value) { | ||
var dict = this[secret]; | ||
if (name in dict) { | ||
dict[name].push('' + value); | ||
} else { | ||
dict[name] = ['' + value]; | ||
} | ||
}; | ||
var URLSearchParams = function () { | ||
function URLSearchParams(query) { | ||
_classCallCheck(this, URLSearchParams); | ||
URLSearchParamsProto.delete = function del(name) { | ||
delete this[secret][name]; | ||
}; | ||
URLSearchParamsProto.get = function get(name) { | ||
var dict = this[secret]; | ||
return name in dict ? dict[name][0] : null; | ||
}; | ||
URLSearchParamsProto.getAll = function getAll(name) { | ||
var dict = this[secret]; | ||
return name in dict ? dict[name].slice(0) : []; | ||
}; | ||
URLSearchParamsProto.has = function has(name) { | ||
return name in this[secret]; | ||
}; | ||
URLSearchParamsProto.set = function set(name, value) { | ||
this[secret][name] = ['' + value]; | ||
}; | ||
URLSearchParamsProto.forEach = function forEach(callback, thisArg) { | ||
var dict = this[secret]; | ||
Object.getOwnPropertyNames(dict).forEach(function (name) { | ||
dict[name].forEach(function (value) { | ||
callback.call(thisArg, value, name, this); | ||
}, this); | ||
}, this); | ||
}; | ||
URLSearchParamsProto.keys = function keys() { | ||
var items = []; | ||
this.forEach(function (value, name) { | ||
items.push(name); | ||
}); | ||
var iterator = { | ||
next: function next() { | ||
var value = items.shift(); | ||
return { done: value === undefined, value: value }; | ||
this[secret] = Object.create(null); | ||
if (!query) return; | ||
if (query.charAt(0) === '?') { | ||
query = query.slice(1); | ||
} | ||
}; | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function () { | ||
return iterator; | ||
}; | ||
for (var index, value, pairs = (query || '').split('&'), i = 0, length = pairs.length; i < length; i++) { | ||
value = pairs[i]; | ||
index = value.indexOf('='); | ||
if (-1 < index) { | ||
this.append(decode(value.slice(0, index)), decode(value.slice(index + 1))); | ||
} else if (value.length) { | ||
this.append(decode(value), ''); | ||
} | ||
} | ||
} | ||
return iterator; | ||
}; | ||
URLSearchParamsProto.values = function values() { | ||
var items = []; | ||
this.forEach(function (value) { | ||
items.push(value); | ||
}); | ||
var iterator = { | ||
next: function next() { | ||
var value = items.shift(); | ||
return { done: value === undefined, value: value }; | ||
_createClass(URLSearchParams, [{ | ||
key: 'append', | ||
value: function append(name, value) { | ||
var dict = this[secret]; | ||
if (name in dict) { | ||
dict[name].push('' + value); | ||
} else { | ||
dict[name] = ['' + value]; | ||
} | ||
} | ||
}; | ||
}, { | ||
key: 'delete', | ||
value: function _delete(name) { | ||
delete this[secret][name]; | ||
} | ||
}, { | ||
key: 'get', | ||
value: function get(name) { | ||
var dict = this[secret]; | ||
return name in dict ? dict[name][0] : null; | ||
} | ||
}, { | ||
key: 'getAll', | ||
value: function getAll(name) { | ||
var dict = this[secret]; | ||
return name in dict ? dict[name].slice(0) : []; | ||
} | ||
}, { | ||
key: 'has', | ||
value: function has(name) { | ||
return name in this[secret]; | ||
} | ||
}, { | ||
key: 'set', | ||
value: function set(name, value) { | ||
this[secret][name] = ['' + value]; | ||
} | ||
}, { | ||
key: 'forEach', | ||
value: function forEach(callback, thisArg) { | ||
var dict = this[secret]; | ||
Object.getOwnPropertyNames(dict).forEach(function (name) { | ||
dict[name].forEach(function (value) { | ||
callback.call(thisArg, value, name, this); | ||
}, this); | ||
}, this); | ||
} | ||
}, { | ||
key: 'keys', | ||
value: function keys() { | ||
var items = []; | ||
this.forEach(function (value, name) { | ||
items.push(name); | ||
}); | ||
var iterator = { | ||
next: function next() { | ||
var value = items.shift(); | ||
return { done: value === undefined, value: value }; | ||
} | ||
}; | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function () { | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function () { | ||
return iterator; | ||
}; | ||
} | ||
return iterator; | ||
}; | ||
} | ||
} | ||
}, { | ||
key: 'values', | ||
value: function values() { | ||
var items = []; | ||
this.forEach(function (value) { | ||
items.push(value); | ||
}); | ||
var iterator = { | ||
next: function next() { | ||
var value = items.shift(); | ||
return { done: value === undefined, value: value }; | ||
} | ||
}; | ||
return iterator; | ||
}; | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function () { | ||
return iterator; | ||
}; | ||
} | ||
URLSearchParamsProto.entries = function entries() { | ||
var items = []; | ||
this.forEach(function (value, name) { | ||
items.push([name, value]); | ||
}); | ||
var iterator = { | ||
next: function next() { | ||
var value = items.shift(); | ||
return { done: value === undefined, value: value }; | ||
return iterator; | ||
} | ||
}; | ||
}, { | ||
key: 'entries', | ||
value: function entries() { | ||
var items = []; | ||
this.forEach(function (value, name) { | ||
items.push([name, value]); | ||
}); | ||
var iterator = { | ||
next: function next() { | ||
var value = items.shift(); | ||
return { done: value === undefined, value: value }; | ||
} | ||
}; | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function () { | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function () { | ||
return iterator; | ||
}; | ||
} | ||
return iterator; | ||
}; | ||
} | ||
} | ||
}, { | ||
key: 'toString', | ||
value: function toString() { | ||
var dict = this[secret], | ||
query = [], | ||
i, | ||
key, | ||
name, | ||
value; | ||
for (key in dict) { | ||
name = encode(key); | ||
for (i = 0, value = dict[key]; i < value.length; i++) { | ||
query.push(name + '=' + encode(value[i])); | ||
} | ||
} | ||
return query.join('&'); | ||
} | ||
}]); | ||
return iterator; | ||
}; | ||
return URLSearchParams; | ||
}(); | ||
if (iterable) { | ||
URLSearchParamsProto[Symbol.iterator] = URLSearchParamsProto.entries; | ||
URLSearchParams.prototype[Symbol.iterator] = URLSearchParams.prototype.entries; | ||
} | ||
/* | ||
URLSearchParamsProto.toBody = function() { | ||
return new Blob( | ||
[this.toString()], | ||
{type: 'application/x-www-form-urlencoded'} | ||
); | ||
}; | ||
*/ | ||
URLSearchParamsProto.toJSON = function toJSON() { | ||
return {}; | ||
}; | ||
URLSearchParamsProto.toString = function toString() { | ||
var dict = this[secret], | ||
query = [], | ||
i, | ||
key, | ||
name, | ||
value; | ||
for (key in dict) { | ||
name = encode(key); | ||
for (i = 0, value = dict[key]; i < value.length; i++) { | ||
query.push(name + '=' + encode(value[i])); | ||
} | ||
} | ||
return query.join('&'); | ||
}; | ||
module.exports = URLSearchParams; | ||
@@ -245,0 +253,0 @@ |
@@ -49,2 +49,6 @@ module.exports = /******/ (function(modules) { // webpackBootstrap | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
// https://github.com/WebReflection/url-search-params | ||
@@ -77,21 +81,2 @@ | ||
function URLSearchParams(query) { | ||
this[secret] = Object.create(null); | ||
if (!query) return; | ||
if (query.charAt(0) === '?') { | ||
query = query.slice(1); | ||
} | ||
for (var index, value, pairs = (query || '').split('&'), i = 0, length = pairs.length; i < length; i++) { | ||
value = pairs[i]; | ||
index = value.indexOf('='); | ||
if (-1 < index) { | ||
this.append(decode(value.slice(0, index)), decode(value.slice(index + 1))); | ||
} else if (value.length) { | ||
this.append(decode(value), ''); | ||
} | ||
} | ||
} | ||
var URLSearchParamsProto = URLSearchParams.prototype; | ||
function isIterable() { | ||
@@ -105,138 +90,161 @@ try { | ||
URLSearchParamsProto.append = function append(name, value) { | ||
var dict = this[secret]; | ||
if (name in dict) { | ||
dict[name].push('' + value); | ||
} else { | ||
dict[name] = ['' + value]; | ||
} | ||
}; | ||
var URLSearchParams = function () { | ||
function URLSearchParams(query) { | ||
_classCallCheck(this, URLSearchParams); | ||
URLSearchParamsProto.delete = function del(name) { | ||
delete this[secret][name]; | ||
}; | ||
URLSearchParamsProto.get = function get(name) { | ||
var dict = this[secret]; | ||
return name in dict ? dict[name][0] : null; | ||
}; | ||
URLSearchParamsProto.getAll = function getAll(name) { | ||
var dict = this[secret]; | ||
return name in dict ? dict[name].slice(0) : []; | ||
}; | ||
URLSearchParamsProto.has = function has(name) { | ||
return name in this[secret]; | ||
}; | ||
URLSearchParamsProto.set = function set(name, value) { | ||
this[secret][name] = ['' + value]; | ||
}; | ||
URLSearchParamsProto.forEach = function forEach(callback, thisArg) { | ||
var dict = this[secret]; | ||
Object.getOwnPropertyNames(dict).forEach(function (name) { | ||
dict[name].forEach(function (value) { | ||
callback.call(thisArg, value, name, this); | ||
}, this); | ||
}, this); | ||
}; | ||
URLSearchParamsProto.keys = function keys() { | ||
var items = []; | ||
this.forEach(function (value, name) { | ||
items.push(name); | ||
}); | ||
var iterator = { | ||
next: function next() { | ||
var value = items.shift(); | ||
return { done: value === undefined, value: value }; | ||
this[secret] = Object.create(null); | ||
if (!query) return; | ||
if (query.charAt(0) === '?') { | ||
query = query.slice(1); | ||
} | ||
}; | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function () { | ||
return iterator; | ||
}; | ||
for (var index, value, pairs = (query || '').split('&'), i = 0, length = pairs.length; i < length; i++) { | ||
value = pairs[i]; | ||
index = value.indexOf('='); | ||
if (-1 < index) { | ||
this.append(decode(value.slice(0, index)), decode(value.slice(index + 1))); | ||
} else if (value.length) { | ||
this.append(decode(value), ''); | ||
} | ||
} | ||
} | ||
return iterator; | ||
}; | ||
URLSearchParamsProto.values = function values() { | ||
var items = []; | ||
this.forEach(function (value) { | ||
items.push(value); | ||
}); | ||
var iterator = { | ||
next: function next() { | ||
var value = items.shift(); | ||
return { done: value === undefined, value: value }; | ||
_createClass(URLSearchParams, [{ | ||
key: 'append', | ||
value: function append(name, value) { | ||
var dict = this[secret]; | ||
if (name in dict) { | ||
dict[name].push('' + value); | ||
} else { | ||
dict[name] = ['' + value]; | ||
} | ||
} | ||
}; | ||
}, { | ||
key: 'delete', | ||
value: function _delete(name) { | ||
delete this[secret][name]; | ||
} | ||
}, { | ||
key: 'get', | ||
value: function get(name) { | ||
var dict = this[secret]; | ||
return name in dict ? dict[name][0] : null; | ||
} | ||
}, { | ||
key: 'getAll', | ||
value: function getAll(name) { | ||
var dict = this[secret]; | ||
return name in dict ? dict[name].slice(0) : []; | ||
} | ||
}, { | ||
key: 'has', | ||
value: function has(name) { | ||
return name in this[secret]; | ||
} | ||
}, { | ||
key: 'set', | ||
value: function set(name, value) { | ||
this[secret][name] = ['' + value]; | ||
} | ||
}, { | ||
key: 'forEach', | ||
value: function forEach(callback, thisArg) { | ||
var dict = this[secret]; | ||
Object.getOwnPropertyNames(dict).forEach(function (name) { | ||
dict[name].forEach(function (value) { | ||
callback.call(thisArg, value, name, this); | ||
}, this); | ||
}, this); | ||
} | ||
}, { | ||
key: 'keys', | ||
value: function keys() { | ||
var items = []; | ||
this.forEach(function (value, name) { | ||
items.push(name); | ||
}); | ||
var iterator = { | ||
next: function next() { | ||
var value = items.shift(); | ||
return { done: value === undefined, value: value }; | ||
} | ||
}; | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function () { | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function () { | ||
return iterator; | ||
}; | ||
} | ||
return iterator; | ||
}; | ||
} | ||
} | ||
}, { | ||
key: 'values', | ||
value: function values() { | ||
var items = []; | ||
this.forEach(function (value) { | ||
items.push(value); | ||
}); | ||
var iterator = { | ||
next: function next() { | ||
var value = items.shift(); | ||
return { done: value === undefined, value: value }; | ||
} | ||
}; | ||
return iterator; | ||
}; | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function () { | ||
return iterator; | ||
}; | ||
} | ||
URLSearchParamsProto.entries = function entries() { | ||
var items = []; | ||
this.forEach(function (value, name) { | ||
items.push([name, value]); | ||
}); | ||
var iterator = { | ||
next: function next() { | ||
var value = items.shift(); | ||
return { done: value === undefined, value: value }; | ||
return iterator; | ||
} | ||
}; | ||
}, { | ||
key: 'entries', | ||
value: function entries() { | ||
var items = []; | ||
this.forEach(function (value, name) { | ||
items.push([name, value]); | ||
}); | ||
var iterator = { | ||
next: function next() { | ||
var value = items.shift(); | ||
return { done: value === undefined, value: value }; | ||
} | ||
}; | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function () { | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function () { | ||
return iterator; | ||
}; | ||
} | ||
return iterator; | ||
}; | ||
} | ||
} | ||
}, { | ||
key: 'toString', | ||
value: function toString() { | ||
var dict = this[secret], | ||
query = [], | ||
i, | ||
key, | ||
name, | ||
value; | ||
for (key in dict) { | ||
name = encode(key); | ||
for (i = 0, value = dict[key]; i < value.length; i++) { | ||
query.push(name + '=' + encode(value[i])); | ||
} | ||
} | ||
return query.join('&'); | ||
} | ||
}]); | ||
return iterator; | ||
}; | ||
return URLSearchParams; | ||
}(); | ||
if (iterable) { | ||
URLSearchParamsProto[Symbol.iterator] = URLSearchParamsProto.entries; | ||
URLSearchParams.prototype[Symbol.iterator] = URLSearchParams.prototype.entries; | ||
} | ||
/* | ||
URLSearchParamsProto.toBody = function() { | ||
return new Blob( | ||
[this.toString()], | ||
{type: 'application/x-www-form-urlencoded'} | ||
); | ||
}; | ||
*/ | ||
URLSearchParamsProto.toJSON = function toJSON() { | ||
return {}; | ||
}; | ||
URLSearchParamsProto.toString = function toString() { | ||
var dict = this[secret], | ||
query = [], | ||
i, | ||
key, | ||
name, | ||
value; | ||
for (key in dict) { | ||
name = encode(key); | ||
for (i = 0, value = dict[key]; i < value.length; i++) { | ||
query.push(name + '=' + encode(value[i])); | ||
} | ||
} | ||
return query.join('&'); | ||
}; | ||
module.exports = URLSearchParams; | ||
@@ -243,0 +251,0 @@ |
'use strict'; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
// https://github.com/WebReflection/url-search-params | ||
@@ -30,21 +34,2 @@ | ||
function URLSearchParams(query) { | ||
this[secret] = Object.create(null); | ||
if (!query) return; | ||
if (query.charAt(0) === '?') { | ||
query = query.slice(1); | ||
} | ||
for (var index, value, pairs = (query || '').split('&'), i = 0, length = pairs.length; i < length; i++) { | ||
value = pairs[i]; | ||
index = value.indexOf('='); | ||
if (-1 < index) { | ||
this.append(decode(value.slice(0, index)), decode(value.slice(index + 1))); | ||
} else if (value.length) { | ||
this.append(decode(value), ''); | ||
} | ||
} | ||
} | ||
var URLSearchParamsProto = URLSearchParams.prototype; | ||
function isIterable() { | ||
@@ -58,138 +43,161 @@ try { | ||
URLSearchParamsProto.append = function append(name, value) { | ||
var dict = this[secret]; | ||
if (name in dict) { | ||
dict[name].push('' + value); | ||
} else { | ||
dict[name] = ['' + value]; | ||
} | ||
}; | ||
var URLSearchParams = function () { | ||
function URLSearchParams(query) { | ||
_classCallCheck(this, URLSearchParams); | ||
URLSearchParamsProto.delete = function del(name) { | ||
delete this[secret][name]; | ||
}; | ||
URLSearchParamsProto.get = function get(name) { | ||
var dict = this[secret]; | ||
return name in dict ? dict[name][0] : null; | ||
}; | ||
URLSearchParamsProto.getAll = function getAll(name) { | ||
var dict = this[secret]; | ||
return name in dict ? dict[name].slice(0) : []; | ||
}; | ||
URLSearchParamsProto.has = function has(name) { | ||
return name in this[secret]; | ||
}; | ||
URLSearchParamsProto.set = function set(name, value) { | ||
this[secret][name] = ['' + value]; | ||
}; | ||
URLSearchParamsProto.forEach = function forEach(callback, thisArg) { | ||
var dict = this[secret]; | ||
Object.getOwnPropertyNames(dict).forEach(function (name) { | ||
dict[name].forEach(function (value) { | ||
callback.call(thisArg, value, name, this); | ||
}, this); | ||
}, this); | ||
}; | ||
URLSearchParamsProto.keys = function keys() { | ||
var items = []; | ||
this.forEach(function (value, name) { | ||
items.push(name); | ||
}); | ||
var iterator = { | ||
next: function next() { | ||
var value = items.shift(); | ||
return { done: value === undefined, value: value }; | ||
this[secret] = Object.create(null); | ||
if (!query) return; | ||
if (query.charAt(0) === '?') { | ||
query = query.slice(1); | ||
} | ||
}; | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function () { | ||
return iterator; | ||
}; | ||
for (var index, value, pairs = (query || '').split('&'), i = 0, length = pairs.length; i < length; i++) { | ||
value = pairs[i]; | ||
index = value.indexOf('='); | ||
if (-1 < index) { | ||
this.append(decode(value.slice(0, index)), decode(value.slice(index + 1))); | ||
} else if (value.length) { | ||
this.append(decode(value), ''); | ||
} | ||
} | ||
} | ||
return iterator; | ||
}; | ||
URLSearchParamsProto.values = function values() { | ||
var items = []; | ||
this.forEach(function (value) { | ||
items.push(value); | ||
}); | ||
var iterator = { | ||
next: function next() { | ||
var value = items.shift(); | ||
return { done: value === undefined, value: value }; | ||
_createClass(URLSearchParams, [{ | ||
key: 'append', | ||
value: function append(name, value) { | ||
var dict = this[secret]; | ||
if (name in dict) { | ||
dict[name].push('' + value); | ||
} else { | ||
dict[name] = ['' + value]; | ||
} | ||
} | ||
}; | ||
}, { | ||
key: 'delete', | ||
value: function _delete(name) { | ||
delete this[secret][name]; | ||
} | ||
}, { | ||
key: 'get', | ||
value: function get(name) { | ||
var dict = this[secret]; | ||
return name in dict ? dict[name][0] : null; | ||
} | ||
}, { | ||
key: 'getAll', | ||
value: function getAll(name) { | ||
var dict = this[secret]; | ||
return name in dict ? dict[name].slice(0) : []; | ||
} | ||
}, { | ||
key: 'has', | ||
value: function has(name) { | ||
return name in this[secret]; | ||
} | ||
}, { | ||
key: 'set', | ||
value: function set(name, value) { | ||
this[secret][name] = ['' + value]; | ||
} | ||
}, { | ||
key: 'forEach', | ||
value: function forEach(callback, thisArg) { | ||
var dict = this[secret]; | ||
Object.getOwnPropertyNames(dict).forEach(function (name) { | ||
dict[name].forEach(function (value) { | ||
callback.call(thisArg, value, name, this); | ||
}, this); | ||
}, this); | ||
} | ||
}, { | ||
key: 'keys', | ||
value: function keys() { | ||
var items = []; | ||
this.forEach(function (value, name) { | ||
items.push(name); | ||
}); | ||
var iterator = { | ||
next: function next() { | ||
var value = items.shift(); | ||
return { done: value === undefined, value: value }; | ||
} | ||
}; | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function () { | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function () { | ||
return iterator; | ||
}; | ||
} | ||
return iterator; | ||
}; | ||
} | ||
} | ||
}, { | ||
key: 'values', | ||
value: function values() { | ||
var items = []; | ||
this.forEach(function (value) { | ||
items.push(value); | ||
}); | ||
var iterator = { | ||
next: function next() { | ||
var value = items.shift(); | ||
return { done: value === undefined, value: value }; | ||
} | ||
}; | ||
return iterator; | ||
}; | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function () { | ||
return iterator; | ||
}; | ||
} | ||
URLSearchParamsProto.entries = function entries() { | ||
var items = []; | ||
this.forEach(function (value, name) { | ||
items.push([name, value]); | ||
}); | ||
var iterator = { | ||
next: function next() { | ||
var value = items.shift(); | ||
return { done: value === undefined, value: value }; | ||
return iterator; | ||
} | ||
}; | ||
}, { | ||
key: 'entries', | ||
value: function entries() { | ||
var items = []; | ||
this.forEach(function (value, name) { | ||
items.push([name, value]); | ||
}); | ||
var iterator = { | ||
next: function next() { | ||
var value = items.shift(); | ||
return { done: value === undefined, value: value }; | ||
} | ||
}; | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function () { | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function () { | ||
return iterator; | ||
}; | ||
} | ||
return iterator; | ||
}; | ||
} | ||
} | ||
}, { | ||
key: 'toString', | ||
value: function toString() { | ||
var dict = this[secret], | ||
query = [], | ||
i, | ||
key, | ||
name, | ||
value; | ||
for (key in dict) { | ||
name = encode(key); | ||
for (i = 0, value = dict[key]; i < value.length; i++) { | ||
query.push(name + '=' + encode(value[i])); | ||
} | ||
} | ||
return query.join('&'); | ||
} | ||
}]); | ||
return iterator; | ||
}; | ||
return URLSearchParams; | ||
}(); | ||
if (iterable) { | ||
URLSearchParamsProto[Symbol.iterator] = URLSearchParamsProto.entries; | ||
URLSearchParams.prototype[Symbol.iterator] = URLSearchParams.prototype.entries; | ||
} | ||
/* | ||
URLSearchParamsProto.toBody = function() { | ||
return new Blob( | ||
[this.toString()], | ||
{type: 'application/x-www-form-urlencoded'} | ||
); | ||
}; | ||
*/ | ||
URLSearchParamsProto.toJSON = function toJSON() { | ||
return {}; | ||
}; | ||
URLSearchParamsProto.toString = function toString() { | ||
var dict = this[secret], | ||
query = [], | ||
i, | ||
key, | ||
name, | ||
value; | ||
for (key in dict) { | ||
name = encode(key); | ||
for (i = 0, value = dict[key]; i < value.length; i++) { | ||
query.push(name + '=' + encode(value[i])); | ||
} | ||
} | ||
return query.join('&'); | ||
}; | ||
module.exports = URLSearchParams; |
{ | ||
"name": "runtime-shared", | ||
"version": "0.0.3", | ||
"description": "Stylesheet loader.", | ||
"version": "0.0.4", | ||
"description": "Shared Runtime.", | ||
"license": "BSD-3-Clause", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
// https://github.com/WebReflection/url-search-params | ||
var | ||
const | ||
find = /[!'\(\)~]|%20|%00/g, | ||
@@ -30,32 +30,2 @@ plus = /\+/g, | ||
function URLSearchParams(query) { | ||
this[secret] = Object.create(null); | ||
if (!query) return; | ||
if (query.charAt(0) === '?') { | ||
query = query.slice(1); | ||
} | ||
for (var | ||
index, value, | ||
pairs = (query || '').split('&'), | ||
i = 0, | ||
length = pairs.length; i < length; i++ | ||
) { | ||
value = pairs[i]; | ||
index = value.indexOf('='); | ||
if (-1 < index) { | ||
this.append( | ||
decode(value.slice(0, index)), | ||
decode(value.slice(index + 1)) | ||
); | ||
} else if (value.length) { | ||
this.append( | ||
decode(value), | ||
'' | ||
); | ||
} | ||
} | ||
} | ||
var URLSearchParamsProto = URLSearchParams.prototype; | ||
function isIterable() { | ||
@@ -69,137 +39,154 @@ try { | ||
URLSearchParamsProto.append = function append(name, value) { | ||
var dict = this[secret]; | ||
if (name in dict) { | ||
dict[name].push('' + value); | ||
} else { | ||
dict[name] = ['' + value]; | ||
class URLSearchParams { | ||
constructor(query) { | ||
this[secret] = Object.create(null); | ||
if (!query) return; | ||
if (query.charAt(0) === '?') { | ||
query = query.slice(1); | ||
} | ||
for (var | ||
index, value, | ||
pairs = (query || '').split('&'), | ||
i = 0, | ||
length = pairs.length; i < length; i++ | ||
) { | ||
value = pairs[i]; | ||
index = value.indexOf('='); | ||
if (-1 < index) { | ||
this.append( | ||
decode(value.slice(0, index)), | ||
decode(value.slice(index + 1)) | ||
); | ||
} else if (value.length) { | ||
this.append( | ||
decode(value), | ||
'' | ||
); | ||
} | ||
} | ||
} | ||
}; | ||
URLSearchParamsProto.delete = function del(name) { | ||
delete this[secret][name]; | ||
}; | ||
append(name, value) { | ||
var dict = this[secret]; | ||
if (name in dict) { | ||
dict[name].push('' + value); | ||
} else { | ||
dict[name] = ['' + value]; | ||
} | ||
} | ||
URLSearchParamsProto.get = function get(name) { | ||
var dict = this[secret]; | ||
return name in dict ? dict[name][0] : null; | ||
}; | ||
delete(name) { | ||
delete this[secret][name]; | ||
} | ||
URLSearchParamsProto.getAll = function getAll(name) { | ||
var dict = this[secret]; | ||
return name in dict ? dict[name].slice(0) : []; | ||
}; | ||
get(name) { | ||
var dict = this[secret]; | ||
return name in dict ? dict[name][0] : null; | ||
} | ||
URLSearchParamsProto.has = function has(name) { | ||
return name in this[secret]; | ||
}; | ||
getAll(name) { | ||
var dict = this[secret]; | ||
return name in dict ? dict[name].slice(0) : []; | ||
} | ||
URLSearchParamsProto.set = function set(name, value) { | ||
this[secret][name] = ['' + value]; | ||
}; | ||
has(name) { | ||
return name in this[secret]; | ||
} | ||
URLSearchParamsProto.forEach = function forEach(callback, thisArg) { | ||
var dict = this[secret]; | ||
Object.getOwnPropertyNames(dict).forEach(function(name) { | ||
dict[name].forEach(function(value) { | ||
callback.call(thisArg, value, name, this); | ||
set(name, value) { | ||
this[secret][name] = ['' + value]; | ||
} | ||
forEach(callback, thisArg) { | ||
var dict = this[secret]; | ||
Object.getOwnPropertyNames(dict).forEach(function(name) { | ||
dict[name].forEach(function(value) { | ||
callback.call(thisArg, value, name, this); | ||
}, this); | ||
}, this); | ||
}, this); | ||
}; | ||
} | ||
URLSearchParamsProto.keys = function keys() { | ||
var items = []; | ||
this.forEach(function(value, name) { | ||
items.push(name); | ||
}); | ||
var iterator = { | ||
next: function() { | ||
var value = items.shift(); | ||
return {done: value === undefined, value: value}; | ||
keys() { | ||
var items = []; | ||
this.forEach(function(value, name) { | ||
items.push(name); | ||
}); | ||
var iterator = { | ||
next: function() { | ||
var value = items.shift(); | ||
return {done: value === undefined, value: value}; | ||
} | ||
}; | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function() { | ||
return iterator; | ||
}; | ||
} | ||
}; | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function() { | ||
return iterator; | ||
}; | ||
return iterator; | ||
} | ||
return iterator; | ||
}; | ||
values() { | ||
var items = []; | ||
this.forEach(function(value) { | ||
items.push(value); | ||
}); | ||
var iterator = { | ||
next: function() { | ||
var value = items.shift(); | ||
return {done: value === undefined, value: value}; | ||
} | ||
}; | ||
URLSearchParamsProto.values = function values() { | ||
var items = []; | ||
this.forEach(function(value) { | ||
items.push(value); | ||
}); | ||
var iterator = { | ||
next: function() { | ||
var value = items.shift(); | ||
return {done: value === undefined, value: value}; | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function() { | ||
return iterator; | ||
}; | ||
} | ||
}; | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function() { | ||
return iterator; | ||
}; | ||
return iterator; | ||
} | ||
return iterator; | ||
}; | ||
entries() { | ||
var items = []; | ||
this.forEach(function(value, name) { | ||
items.push([name, value]); | ||
}); | ||
var iterator = { | ||
next: function() { | ||
var value = items.shift(); | ||
return {done: value === undefined, value: value}; | ||
} | ||
}; | ||
URLSearchParamsProto.entries = function entries() { | ||
var items = []; | ||
this.forEach(function(value, name) { | ||
items.push([name, value]); | ||
}); | ||
var iterator = { | ||
next: function() { | ||
var value = items.shift(); | ||
return {done: value === undefined, value: value}; | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function() { | ||
return iterator; | ||
}; | ||
} | ||
}; | ||
if (iterable) { | ||
iterator[Symbol.iterator] = function() { | ||
return iterator; | ||
}; | ||
return iterator; | ||
} | ||
return iterator; | ||
}; | ||
toString() { | ||
var dict = this[secret], query = [], i, key, name, value; | ||
for (key in dict) { | ||
name = encode(key); | ||
for ( | ||
i = 0, | ||
value = dict[key]; | ||
i < value.length; i++ | ||
) { | ||
query.push(name + '=' + encode(value[i])); | ||
} | ||
} | ||
return query.join('&'); | ||
} | ||
} | ||
if (iterable) { | ||
URLSearchParamsProto[Symbol.iterator] = URLSearchParamsProto.entries; | ||
URLSearchParams.prototype[Symbol.iterator] = URLSearchParams.prototype.entries; | ||
} | ||
/* | ||
URLSearchParamsProto.toBody = function() { | ||
return new Blob( | ||
[this.toString()], | ||
{type: 'application/x-www-form-urlencoded'} | ||
); | ||
}; | ||
*/ | ||
URLSearchParamsProto.toJSON = function toJSON() { | ||
return {}; | ||
}; | ||
URLSearchParamsProto.toString = function toString() { | ||
var dict = this[secret], query = [], i, key, name, value; | ||
for (key in dict) { | ||
name = encode(key); | ||
for ( | ||
i = 0, | ||
value = dict[key]; | ||
i < value.length; i++ | ||
) { | ||
query.push(name + '=' + encode(value[i])); | ||
} | ||
} | ||
return query.join('&'); | ||
}; | ||
module.exports = URLSearchParams; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
229133
3843