This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//remove the starting '?' and split options | |
location.search.slice(1).split("&").forEach(function(opt) { | |
opt = opt.split('='); | |
console.log(opt); // ['arg1','val1'] ['arg2','val2'] | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//from https://github.com/achohq/acho/blob/0a57c8450e781ca69c248103f48a24818dca695b/lib/Constants.coffee | |
'use strict' | |
figure = | |
false: | |
info : 'ℹ' | |
success : '✔' | |
warning : '⚠' | |
error : '✖' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _get(property, defaultValue) { | |
var path = property.split(/[\.\["'\]]+/); | |
return function(obj) { | |
return typeof obj === 'object' ? path.reduce(function (acc, key) { | |
var value = acc && acc[key]; | |
// should allow null and falsy values. | |
return (value || (value !== undefined)) ? | |
value : | |
defaultValue; | |
}, obj) : |
OlderNewer