Skip to content

Commit

Permalink
Remove more browsers and the AMD malarkey
Browse files Browse the repository at this point in the history
  • Loading branch information
grncdr committed Oct 24, 2013
1 parent ad5dbbc commit f195ac0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 50 deletions.
48 changes: 22 additions & 26 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
if (typeof define !== 'function') { var define = require('amdefine')(module) }

define(function () {
return function pctEncode(regexp) {
regexp = regexp || /\W/g;
return function encode(string) {
string = String(string);
return string.replace(regexp, function (m) {
var c = m[0].charCodeAt(0)
, encoded = [];
if (c < 128) {
encoded.push(c);
} else if ((128 <= c && c < 2048)) {
encoded.push((c >> 6) | 192);
encoded.push((c & 63) | 128);
} else {
encoded.push((c >> 12) | 224);
encoded.push(((c >> 6) & 63) | 128);
encoded.push((c & 63) | 128);
}
return encoded.map(function (c) {
return '%' + c.toString(16).toUpperCase();
}).join('');
})
}
module.exports = function pctEncode(regexp) {
regexp = regexp || /\W/g;
return function encode(string) {
string = String(string);
return string.replace(regexp, function (m) {
var c = m[0].charCodeAt(0)
, encoded = [];
if (c < 128) {
encoded.push(c);
} else if ((128 <= c && c < 2048)) {
encoded.push((c >> 6) | 192);
encoded.push((c & 63) | 128);
} else {
encoded.push((c >> 12) | 224);
encoded.push(((c >> 6) & 63) | 128);
encoded.push((c & 63) | 128);
}
return encoded.map(function (c) {
return '%' + c.toString(16).toUpperCase();
}).join('');
})
}
})
}
35 changes: 11 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,18 @@
"license": "BSD",
"testling": {
"files": "test.js",
"browsers": [
"iexplore/6.0",
"iexplore/7.0",
"iexplore/8.0",
"iexplore/9.0",
"iexplore/10.0",
"chrome/24.0",
"chrome/25.0",
"firefox/18.0",
"firefox/19.0",
"opera/11.6",
"opera/12.0",
"iphone/6.0",
"ipad/6.0",
"safari/6.0",
"android-browser/4.2",
"firefox/nightly",
"opera/next",
"chrome/canary"
]
"browsers": {
"iexplore": [ 8, 9, 10 ],
"chrome": [ "canary" ],
"firefox": [ "nightly" ],
"opera": [ "next" ],
"iphone": [ "6.0" ],
"ipad": [ "6.0" ],
"safari": [ "6.0" ],
"android-browser": [ "4.2" ]
}
},
"devDependencies": {
"tape": "~1.0.2"
},
"dependencies": {
"amdefine": "0.0.5"
"tape": "~2.0.0"
}
}

0 comments on commit f195ac0

Please sign in to comment.