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 isValidUrl = (function() { | |
| var protocols = ["http", "https", "ftp"]; | |
| var requireProtocol = false; | |
| var requireTLD = true; | |
| var pattern = new RegExp('^(?!mailto:)(?:(?:' + protocols.join('|') + ')://)' + (requireProtocol ? '' : '?') + '(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))' + (requireTLD ? '' : '?') + ')|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$', 'i'); | |
| return function(str) { | |
| return (typeof str === "string") && str.length < 2083 && pattern.test(str); | |
| } | |
| }()); |
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
| location.search.substr(1).split("&").reduce(function(o, pair) { | |
| pair = pair.split("="); | |
| o[pair[0]] = pair[1] && decodeURIComponent(pair[1]); | |
| return o; | |
| }, {}); |
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 require = (function() { | |
| var rComments = /((\/\/.*$)|(\/\*[\s\S]*?\*\/)|(\s))/mg; | |
| var rArguments = /^function\s*[^\(]*\(\s*([^\)]*)\)/m; | |
| var getArguments = function(fn) { | |
| // https://gist.github.com/thebyrd/6924190 | |
| var argNames = fn.toString().replace(rComments,'').match(rArguments)[1]; | |
| return argNames ? argNames.split(/,/) : []; | |
| }; | |
| return function(dependencies, fn) { |
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 path = require('path'); | |
| var fs = require('fs'); | |
| var cheerio = require('cheerio'); | |
| var createTemplate = function(id, markup) { | |
| var $ = cheerio.load('<script type="text/ng-template"></script>'); | |
| $('script').attr('id', id).html(markup).html(); | |
| return $.html(); | |
| }; |
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 url = require('url'); | |
| app.use(function(req, res, next) { | |
| req.generateLink = function(pathname) { | |
| return url.format({ | |
| protocol: req.protocol, | |
| host: req.get('Host'), | |
| pathname: pathname | |
| }); | |
| }; | |
| next(); |
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 create(proto, obj) { | |
| var descriptor = {}; | |
| Object.keys(Object(obj)).forEach(function(prop) { | |
| descriptor[prop] = Object.getOwnPropertyDescriptor(obj, prop); | |
| }); | |
| return Object.create(proto || null, descriptor); | |
| } |
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 exec = require('child_process').exec; | |
| var rForbidden = /(["'#&;`\|\*\?~<>\^\(\)\[\]\{\}\$\\\x0A\xFF])/g; | |
| var isWindows = process.platform === 'win32'; | |
| module.exports = function(cmd, options, callback) { | |
| cmd = cmd.replace(rForbidden, isWindows ? '^$1': '\\$1'); | |
| return exec(cmd, options, callback); | |
| }; |
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 Promise = require('bluebird'); | |
| var fs = require('fs'); | |
| var noop = function(){}; | |
| var DEFAULT_TIMEOUT = 60 * 2 * 1000; | |
| module.exports = function watch(fileName, until, timeout) { | |
| var watcher; | |
| if (typeof until !== 'function') until = noop; | |
| timeout = Number(timeout) || DEFAULT_TIMEOUT; |
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() { | |
| let props = $$('*') | |
| .filter(x => Object.keys(x.dataset).length) | |
| .reduce((o,x) => { | |
| Object.keys(x.dataset).forEach(key => { | |
| o[key] = key.replace(/[A-Z]/g, y => '-' + y.toLowerCase()); | |
| }); | |
| return o; | |
| }, {}); |
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
| module.exports = { | |
| name: 'StarRating', | |
| functional: true, | |
| props: { | |
| stars: { | |
| type: Number, | |
| default: 0 | |
| }, | |
| tag: { | |
| type: String, |