repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
briancsparks/serverassist
lib/client.js
function() { const query = {clientId}; var body = sg.extend({partnerId, version, sessionId}, {rsvr}); self.POST('hq', '/clientStart', query, body, function(err, config) { //console.log('clientStart-object', query, body, err, config); if (sg.ok(err, config)) { self.config = sg.deepCo...
javascript
function() { const query = {clientId}; var body = sg.extend({partnerId, version, sessionId}, {rsvr}); self.POST('hq', '/clientStart', query, body, function(err, config) { //console.log('clientStart-object', query, body, err, config); if (sg.ok(err, config)) { self.config = sg.deepCo...
[ "function", "(", ")", "{", "const", "query", "=", "{", "clientId", "}", ";", "var", "body", "=", "sg", ".", "extend", "(", "{", "partnerId", ",", "version", ",", "sessionId", "}", ",", "{", "rsvr", "}", ")", ";", "self", ".", "POST", "(", "'hq'",...
main for ClientStart ctor
[ "main", "for", "ClientStart", "ctor" ]
f966832aae287f502cce53a71f5129b962ada8a3
https://github.com/briancsparks/serverassist/blob/f966832aae287f502cce53a71f5129b962ada8a3/lib/client.js#L50-L74
train
tmorin/ceb
dist/systemjs/helper/arrays.js
flatten
function flatten(array) { return array.reduce(function (a, b) { return isArray(b) ? a.concat(flatten(b)) : a.concat(b); }, []); }
javascript
function flatten(array) { return array.reduce(function (a, b) { return isArray(b) ? a.concat(flatten(b)) : a.concat(b); }, []); }
[ "function", "flatten", "(", "array", ")", "{", "return", "array", ".", "reduce", "(", "function", "(", "a", ",", "b", ")", "{", "return", "isArray", "(", "b", ")", "?", "a", ".", "concat", "(", "flatten", "(", "b", ")", ")", ":", "a", ".", "con...
Flattens a nested array. @param {!Array} array the array to flatten @returns {Array} the new flattened array
[ "Flattens", "a", "nested", "array", "." ]
7cc0904b482aa99e5123302c5de4401f7a80af02
https://github.com/tmorin/ceb/blob/7cc0904b482aa99e5123302c5de4401f7a80af02/dist/systemjs/helper/arrays.js#L14-L18
train
haraldrudell/nodegod
lib/master/masterserver.js
handleConnection
function handleConnection(socket) { // server 'connect' socket.setEncoding('utf-8') socket.on('data', requestResponder) function requestResponder(data) { socket.end(String(process.pid)) self.emit('data', data) } }
javascript
function handleConnection(socket) { // server 'connect' socket.setEncoding('utf-8') socket.on('data', requestResponder) function requestResponder(data) { socket.end(String(process.pid)) self.emit('data', data) } }
[ "function", "handleConnection", "(", "socket", ")", "{", "// server 'connect'", "socket", ".", "setEncoding", "(", "'utf-8'", ")", "socket", ".", "on", "(", "'data'", ",", "requestResponder", ")", "function", "requestResponder", "(", "data", ")", "{", "socket", ...
manage a connection, reponding to requests
[ "manage", "a", "connection", "reponding", "to", "requests" ]
3be4fb280fb18e0ec0a1c1a8fea3254d92f00b21
https://github.com/haraldrudell/nodegod/blob/3be4fb280fb18e0ec0a1c1a8fea3254d92f00b21/lib/master/masterserver.js#L88-L96
train
marknotton/env
index.js
getVariable
function getVariable(variable) { if ( cached.data == null ) { getData(); } if (variable.toUpperCase() in cached.data ) { return cached.data[variable.toUpperCase()]; } else if (variable in cached.data) { return cached.data[variable]; } }
javascript
function getVariable(variable) { if ( cached.data == null ) { getData(); } if (variable.toUpperCase() in cached.data ) { return cached.data[variable.toUpperCase()]; } else if (variable in cached.data) { return cached.data[variable]; } }
[ "function", "getVariable", "(", "variable", ")", "{", "if", "(", "cached", ".", "data", "==", "null", ")", "{", "getData", "(", ")", ";", "}", "if", "(", "variable", ".", "toUpperCase", "(", ")", "in", "cached", ".", "data", ")", "{", "return", "ca...
Get a specific variable @param {string} variable Enter the variable you want to get @return {string}
[ "Get", "a", "specific", "variable" ]
13d9aaf4b060de4d3e09b221b191e65c463526ae
https://github.com/marknotton/env/blob/13d9aaf4b060de4d3e09b221b191e65c463526ae/index.js#L161-L172
train
MiguelCastillo/bit-loader
example/asyncfile/src/resolvePath.js
resolve
function resolve(moduleMeta, options) { function setPath(path) { return { path: path }; } return resolvePath(moduleMeta, options).then(setPath, log2console); }
javascript
function resolve(moduleMeta, options) { function setPath(path) { return { path: path }; } return resolvePath(moduleMeta, options).then(setPath, log2console); }
[ "function", "resolve", "(", "moduleMeta", ",", "options", ")", "{", "function", "setPath", "(", "path", ")", "{", "return", "{", "path", ":", "path", "}", ";", "}", "return", "resolvePath", "(", "moduleMeta", ",", "options", ")", ".", "then", "(", "set...
Convert module name to full module path
[ "Convert", "module", "name", "to", "full", "module", "path" ]
da9d18952d87014fdb09e7a8320a24cbf1c2b436
https://github.com/MiguelCastillo/bit-loader/blob/da9d18952d87014fdb09e7a8320a24cbf1c2b436/example/asyncfile/src/resolvePath.js#L36-L44
train
MiguelCastillo/bit-loader
example/asyncfile/src/resolvePath.js
resolvePath
function resolvePath(moduleMeta, options) { var parentPath = getParentPath(moduleMeta, options); var filePath = path.resolve(path.dirname(options.baseUrl), moduleMeta.name); if (fs.existsSync(filePath)) { return Promise.resolve(filePath); } return new Promise(function(resolve, reject) { browserResol...
javascript
function resolvePath(moduleMeta, options) { var parentPath = getParentPath(moduleMeta, options); var filePath = path.resolve(path.dirname(options.baseUrl), moduleMeta.name); if (fs.existsSync(filePath)) { return Promise.resolve(filePath); } return new Promise(function(resolve, reject) { browserResol...
[ "function", "resolvePath", "(", "moduleMeta", ",", "options", ")", "{", "var", "parentPath", "=", "getParentPath", "(", "moduleMeta", ",", "options", ")", ";", "var", "filePath", "=", "path", ".", "resolve", "(", "path", ".", "dirname", "(", "options", "."...
Figures out the path for the moduleMeta so that the module file can be loaded from storage. We use browser-resolve to do the heavy lifting for us, so all this module is really doing is wrapping browser-resolve so that it can be used by bit loader in a convenient way.
[ "Figures", "out", "the", "path", "for", "the", "moduleMeta", "so", "that", "the", "module", "file", "can", "be", "loaded", "from", "storage", "." ]
da9d18952d87014fdb09e7a8320a24cbf1c2b436
https://github.com/MiguelCastillo/bit-loader/blob/da9d18952d87014fdb09e7a8320a24cbf1c2b436/example/asyncfile/src/resolvePath.js#L53-L71
train
MiguelCastillo/bit-loader
example/asyncfile/src/resolvePath.js
getParentPath
function getParentPath(moduleMeta, options) { var referrer = moduleMeta.referrer; return (referrer && moduleMeta !== referrer) ? referrer.path : options.baseUrl; }
javascript
function getParentPath(moduleMeta, options) { var referrer = moduleMeta.referrer; return (referrer && moduleMeta !== referrer) ? referrer.path : options.baseUrl; }
[ "function", "getParentPath", "(", "moduleMeta", ",", "options", ")", "{", "var", "referrer", "=", "moduleMeta", ".", "referrer", ";", "return", "(", "referrer", "&&", "moduleMeta", "!==", "referrer", ")", "?", "referrer", ".", "path", ":", "options", ".", ...
Gets the path for the module requesting the moduleMeta being resolved. This is what happens when a dependency is loaded.
[ "Gets", "the", "path", "for", "the", "module", "requesting", "the", "moduleMeta", "being", "resolved", ".", "This", "is", "what", "happens", "when", "a", "dependency", "is", "loaded", "." ]
da9d18952d87014fdb09e7a8320a24cbf1c2b436
https://github.com/MiguelCastillo/bit-loader/blob/da9d18952d87014fdb09e7a8320a24cbf1c2b436/example/asyncfile/src/resolvePath.js#L78-L81
train
feilaoda/power
public/javascripts/vendor/javascripts/geolib.js
function(point) { var latitude = point.hasOwnProperty('lat') ? 'lat' : 'latitude'; var longitude = (point.hasOwnProperty('lng') ? 'lng' : false) || (point.hasOwnProperty('long') ? 'long' : false) || 'longitude'; var elevation = (point.hasOwnProperty('alt') ? 'alt' : false) || (...
javascript
function(point) { var latitude = point.hasOwnProperty('lat') ? 'lat' : 'latitude'; var longitude = (point.hasOwnProperty('lng') ? 'lng' : false) || (point.hasOwnProperty('long') ? 'long' : false) || 'longitude'; var elevation = (point.hasOwnProperty('alt') ? 'alt' : false) || (...
[ "function", "(", "point", ")", "{", "var", "latitude", "=", "point", ".", "hasOwnProperty", "(", "'lat'", ")", "?", "'lat'", ":", "'latitude'", ";", "var", "longitude", "=", "(", "point", ".", "hasOwnProperty", "(", "'lng'", ")", "?", "'lng'", ":", "fa...
Get the key names for a geo point. @param object Point position {latitude: 123, longitude: 123, elevation: 123} @return object { longitude: 'lng|long|longitude', latitude: 'lat|latitude', elevation: 'alt|altitude|elev|elevation' }
[ "Get", "the", "key", "names", "for", "a", "geo", "point", "." ]
89432e5b8e455eceef5f5098d479ad94c88acc59
https://github.com/feilaoda/power/blob/89432e5b8e455eceef5f5098d479ad94c88acc59/public/javascripts/vendor/javascripts/geolib.js#L36-L50
train
feilaoda/power
public/javascripts/vendor/javascripts/geolib.js
function(start, end, accuracy) { var keys = geolib.getKeys(start); var latitude = keys.latitude; var longitude = keys.longitude; accuracy = Math.floor(accuracy) || 1; var coord1 = {}, coord2 = {}; coord1[latitude] = parseFloat(geolib.useDecimal(start[latitude])).toRad(); coord1[longitude] = pars...
javascript
function(start, end, accuracy) { var keys = geolib.getKeys(start); var latitude = keys.latitude; var longitude = keys.longitude; accuracy = Math.floor(accuracy) || 1; var coord1 = {}, coord2 = {}; coord1[latitude] = parseFloat(geolib.useDecimal(start[latitude])).toRad(); coord1[longitude] = pars...
[ "function", "(", "start", ",", "end", ",", "accuracy", ")", "{", "var", "keys", "=", "geolib", ".", "getKeys", "(", "start", ")", ";", "var", "latitude", "=", "keys", ".", "latitude", ";", "var", "longitude", "=", "keys", ".", "longitude", ";", "accu...
Calculates the distance between two spots. This method is more simple but also more inaccurate @param object Start position {latitude: 123, longitude: 123} @param object End position {latitude: 123, longitude: 123} @param integer Accuracy (in meters) @return integer Distance (in meters)
[ "Calculates", "the", "distance", "between", "two", "spots", ".", "This", "method", "is", "more", "simple", "but", "also", "more", "inaccurate" ]
89432e5b8e455eceef5f5098d479ad94c88acc59
https://github.com/feilaoda/power/blob/89432e5b8e455eceef5f5098d479ad94c88acc59/public/javascripts/vendor/javascripts/geolib.js#L212-L250
train
feilaoda/power
public/javascripts/vendor/javascripts/geolib.js
function(coords) { if (!coords.length) { return false; } var keys = geolib.getKeys(coords[0]); var latitude = keys.latitude; var longitude = keys.longitude; var max = function( array ){ return Math.max.apply( Math, array ); }; var min = function( array ){ return Math.min.apply( M...
javascript
function(coords) { if (!coords.length) { return false; } var keys = geolib.getKeys(coords[0]); var latitude = keys.latitude; var longitude = keys.longitude; var max = function( array ){ return Math.max.apply( Math, array ); }; var min = function( array ){ return Math.min.apply( M...
[ "function", "(", "coords", ")", "{", "if", "(", "!", "coords", ".", "length", ")", "{", "return", "false", ";", "}", "var", "keys", "=", "geolib", ".", "getKeys", "(", "coords", "[", "0", "]", ")", ";", "var", "latitude", "=", "keys", ".", "latit...
Calculates the center of a collection of geo coordinates @param array Collection of coords [{latitude: 51.510, longitude: 7.1321}, {latitude: 49.1238, longitude: "8° 30' W"}, ...] @return object {latitude: centerLat, longitude: centerLng, distance: diagonalDistance}
[ "Calculates", "the", "center", "of", "a", "collection", "of", "geo", "coordinates" ]
89432e5b8e455eceef5f5098d479ad94c88acc59
https://github.com/feilaoda/power/blob/89432e5b8e455eceef5f5098d479ad94c88acc59/public/javascripts/vendor/javascripts/geolib.js#L259-L297
train
feilaoda/power
public/javascripts/vendor/javascripts/geolib.js
function(latlng, coords) { var keys = geolib.getKeys(latlng); var latitude = keys.latitude; var longitude = keys.longitude; for(var c = false, i = -1, l = coords.length, j = l - 1; ++i < l; j = i) { ( (coords[i][longitude] <= latlng[longitude] && latlng[longitude] < coords[j][longitude]) || ...
javascript
function(latlng, coords) { var keys = geolib.getKeys(latlng); var latitude = keys.latitude; var longitude = keys.longitude; for(var c = false, i = -1, l = coords.length, j = l - 1; ++i < l; j = i) { ( (coords[i][longitude] <= latlng[longitude] && latlng[longitude] < coords[j][longitude]) || ...
[ "function", "(", "latlng", ",", "coords", ")", "{", "var", "keys", "=", "geolib", ".", "getKeys", "(", "latlng", ")", ";", "var", "latitude", "=", "keys", ".", "latitude", ";", "var", "longitude", "=", "keys", ".", "longitude", ";", "for", "(", "var"...
Checks whether a point is inside of a polygon or not. Note that the polygon coords must be in correct order! @param object coordinate to check e.g. {latitude: 51.5023, longitude: 7.3815} @param array array with coords e.g. [{latitude: 51.5143, longitude: 7.4138}, {latitude: 123, longitude: 123}, ...] @return bool...
[ "Checks", "whether", "a", "point", "is", "inside", "of", "a", "polygon", "or", "not", ".", "Note", "that", "the", "polygon", "coords", "must", "be", "in", "correct", "order!" ]
89432e5b8e455eceef5f5098d479ad94c88acc59
https://github.com/feilaoda/power/blob/89432e5b8e455eceef5f5098d479ad94c88acc59/public/javascripts/vendor/javascripts/geolib.js#L353-L374
train
feilaoda/power
public/javascripts/vendor/javascripts/geolib.js
function(originLL, destLL) { var keys = geolib.getKeys(originLL); var latitude = keys.latitude; var longitude = keys.longitude; destLL[latitude] = geolib.useDecimal(destLL[latitude]); destLL[longitude] = geolib.useDecimal(destLL[longitude]); originLL[latitude] = geolib.useDecimal(originLL[latitude])...
javascript
function(originLL, destLL) { var keys = geolib.getKeys(originLL); var latitude = keys.latitude; var longitude = keys.longitude; destLL[latitude] = geolib.useDecimal(destLL[latitude]); destLL[longitude] = geolib.useDecimal(destLL[longitude]); originLL[latitude] = geolib.useDecimal(originLL[latitude])...
[ "function", "(", "originLL", ",", "destLL", ")", "{", "var", "keys", "=", "geolib", ".", "getKeys", "(", "originLL", ")", ";", "var", "latitude", "=", "keys", ".", "latitude", ";", "var", "longitude", "=", "keys", ".", "longitude", ";", "destLL", "[", ...
Gets great circle bearing of two points. See description of getRhumbLineBearing for more information @param object origin coordinate (e.g. {latitude: 51.5023, longitude: 7.3815}) @param object destination coordinate @return integer calculated bearing
[ "Gets", "great", "circle", "bearing", "of", "two", "points", ".", "See", "description", "of", "getRhumbLineBearing", "for", "more", "information" ]
89432e5b8e455eceef5f5098d479ad94c88acc59
https://github.com/feilaoda/power/blob/89432e5b8e455eceef5f5098d479ad94c88acc59/public/javascripts/vendor/javascripts/geolib.js#L440-L482
train
feilaoda/power
public/javascripts/vendor/javascripts/geolib.js
function(originLL, destLL, bearingMode) { var direction; if(bearingMode == 'circle') { // use great circle bearing var bearing = geolib.getBearing(originLL, destLL); } else { // default is rhumb line bearing var bearing = geolib.getRhumbLineBearing(originLL, destLL); } switch(Math.round(bearing...
javascript
function(originLL, destLL, bearingMode) { var direction; if(bearingMode == 'circle') { // use great circle bearing var bearing = geolib.getBearing(originLL, destLL); } else { // default is rhumb line bearing var bearing = geolib.getRhumbLineBearing(originLL, destLL); } switch(Math.round(bearing...
[ "function", "(", "originLL", ",", "destLL", ",", "bearingMode", ")", "{", "var", "direction", ";", "if", "(", "bearingMode", "==", "'circle'", ")", "{", "// use great circle bearing", "var", "bearing", "=", "geolib", ".", "getBearing", "(", "originLL", ",", ...
Gets the compass direction from an origin coordinate to a destination coordinate. @param object origin coordinate (e.g. {latitude: 51.5023, longitude: 7.3815}) @param object destination coordinate @param string Bearing mode. Can be either circle or rhumbline @return object Returns an object with a rough (NESW)...
[ "Gets", "the", "compass", "direction", "from", "an", "origin", "coordinate", "to", "a", "destination", "coordinate", "." ]
89432e5b8e455eceef5f5098d479ad94c88acc59
https://github.com/feilaoda/power/blob/89432e5b8e455eceef5f5098d479ad94c88acc59/public/javascripts/vendor/javascripts/geolib.js#L493-L554
train
feilaoda/power
public/javascripts/vendor/javascripts/geolib.js
function(latlng, coords) { var keys = geolib.getKeys(latlng); var latitude = keys.latitude; var longitude = keys.longitude; var coordsArray = []; for(var coord in coords) { var d = geolib.getDistance(latlng, coords[coord]); coordsArray.push({key: coord, latitude: coords[coord][latitude], longit...
javascript
function(latlng, coords) { var keys = geolib.getKeys(latlng); var latitude = keys.latitude; var longitude = keys.longitude; var coordsArray = []; for(var coord in coords) { var d = geolib.getDistance(latlng, coords[coord]); coordsArray.push({key: coord, latitude: coords[coord][latitude], longit...
[ "function", "(", "latlng", ",", "coords", ")", "{", "var", "keys", "=", "geolib", ".", "getKeys", "(", "latlng", ")", ";", "var", "latitude", "=", "keys", ".", "latitude", ";", "var", "longitude", "=", "keys", ".", "longitude", ";", "var", "coordsArray...
Sorts an array of coords by distance from a reference coordinate @param object reference coordinate e.g. {latitude: 51.5023, longitude: 7.3815} @param mixed array or object with coords [{latitude: 51.5143, longitude: 7.4138}, {latitude: 123, longitude: 123}, ...] @return array ordered array
[ "Sorts", "an", "array", "of", "coords", "by", "distance", "from", "a", "reference", "coordinate" ]
89432e5b8e455eceef5f5098d479ad94c88acc59
https://github.com/feilaoda/power/blob/89432e5b8e455eceef5f5098d479ad94c88acc59/public/javascripts/vendor/javascripts/geolib.js#L564-L578
train
feilaoda/power
public/javascripts/vendor/javascripts/geolib.js
function(latlng, coords, offset) { offset = offset || 0; var ordered = geolib.orderByDistance(latlng, coords); return ordered[offset]; }
javascript
function(latlng, coords, offset) { offset = offset || 0; var ordered = geolib.orderByDistance(latlng, coords); return ordered[offset]; }
[ "function", "(", "latlng", ",", "coords", ",", "offset", ")", "{", "offset", "=", "offset", "||", "0", ";", "var", "ordered", "=", "geolib", ".", "orderByDistance", "(", "latlng", ",", "coords", ")", ";", "return", "ordered", "[", "offset", "]", ";", ...
Finds the nearest coordinate to a reference coordinate @param object reference coordinate e.g. {latitude: 51.5023, longitude: 7.3815} @param mixed array or object with coords [{latitude: 51.5143, longitude: 7.4138}, {latitude: 123, longitude: 123}, ...] @return array ordered array
[ "Finds", "the", "nearest", "coordinate", "to", "a", "reference", "coordinate" ]
89432e5b8e455eceef5f5098d479ad94c88acc59
https://github.com/feilaoda/power/blob/89432e5b8e455eceef5f5098d479ad94c88acc59/public/javascripts/vendor/javascripts/geolib.js#L588-L594
train
feilaoda/power
public/javascripts/vendor/javascripts/geolib.js
function(coords) { var dist = 0, last; for (var i = 0, l = coords.length; i < l; ++i) { if(last) { dist += geolib.getDistance(coords[i], last); } last = coords[i]; } return dist; }
javascript
function(coords) { var dist = 0, last; for (var i = 0, l = coords.length; i < l; ++i) { if(last) { dist += geolib.getDistance(coords[i], last); } last = coords[i]; } return dist; }
[ "function", "(", "coords", ")", "{", "var", "dist", "=", "0", ",", "last", ";", "for", "(", "var", "i", "=", "0", ",", "l", "=", "coords", ".", "length", ";", "i", "<", "l", ";", "++", "i", ")", "{", "if", "(", "last", ")", "{", "dist", "...
Calculates the length of a given path @param mixed array or object with coords [{latitude: 51.5143, longitude: 7.4138}, {latitude: 123, longitude: 123}, ...] @return integer length of the path (in meters)
[ "Calculates", "the", "length", "of", "a", "given", "path" ]
89432e5b8e455eceef5f5098d479ad94c88acc59
https://github.com/feilaoda/power/blob/89432e5b8e455eceef5f5098d479ad94c88acc59/public/javascripts/vendor/javascripts/geolib.js#L603-L615
train
feilaoda/power
public/javascripts/vendor/javascripts/geolib.js
function(unit, distance, round) { if(distance == 0 || typeof distance == 'undefined') { if(geolib.distance == 0) { // throw 'No distance given.'; return 0; } else { distance = geolib.distance; } } unit = unit || 'm'; round = (null == round ? 4 : round); switch(unit) { ...
javascript
function(unit, distance, round) { if(distance == 0 || typeof distance == 'undefined') { if(geolib.distance == 0) { // throw 'No distance given.'; return 0; } else { distance = geolib.distance; } } unit = unit || 'm'; round = (null == round ? 4 : round); switch(unit) { ...
[ "function", "(", "unit", ",", "distance", ",", "round", ")", "{", "if", "(", "distance", "==", "0", "||", "typeof", "distance", "==", "'undefined'", ")", "{", "if", "(", "geolib", ".", "distance", "==", "0", ")", "{", "// throw 'No distance given.';", "r...
Converts a distance from meters to km, mm, cm, mi, ft, in or yd @param string Format to be converted in @param float Distance in meters @param float Decimal places for rounding (default: 4) @return float Converted distance
[ "Converts", "a", "distance", "from", "meters", "to", "km", "mm", "cm", "mi", "ft", "in", "or", "yd" ]
89432e5b8e455eceef5f5098d479ad94c88acc59
https://github.com/feilaoda/power/blob/89432e5b8e455eceef5f5098d479ad94c88acc59/public/javascripts/vendor/javascripts/geolib.js#L746-L795
train
feilaoda/power
public/javascripts/vendor/javascripts/geolib.js
function(value) { value = value.toString().replace(/\s*/, ''); // looks silly but works as expected // checks if value is in decimal format if (!isNaN(parseFloat(value)) && parseFloat(value).toString() == value) { return parseFloat(value); // checks if it's sexagesimal format (HHH° MM' SS" (NES...
javascript
function(value) { value = value.toString().replace(/\s*/, ''); // looks silly but works as expected // checks if value is in decimal format if (!isNaN(parseFloat(value)) && parseFloat(value).toString() == value) { return parseFloat(value); // checks if it's sexagesimal format (HHH° MM' SS" (NES...
[ "function", "(", "value", ")", "{", "value", "=", "value", ".", "toString", "(", ")", ".", "replace", "(", "/", "\\s*", "/", ",", "''", ")", ";", "// looks silly but works as expected", "// checks if value is in decimal format", "if", "(", "!", "isNaN", "(", ...
Checks if a value is in decimal format or, if neccessary, converts to decimal @param mixed Value to be checked/converted @return float Coordinate in decimal format
[ "Checks", "if", "a", "value", "is", "in", "decimal", "format", "or", "if", "neccessary", "converts", "to", "decimal" ]
89432e5b8e455eceef5f5098d479ad94c88acc59
https://github.com/feilaoda/power/blob/89432e5b8e455eceef5f5098d479ad94c88acc59/public/javascripts/vendor/javascripts/geolib.js#L804-L819
train
feilaoda/power
public/javascripts/vendor/javascripts/geolib.js
function(dec) { if (dec in geolib.sexagesimal) { return geolib.sexagesimal[dec]; } var tmp = dec.toString().split('.'); var deg = Math.abs(tmp[0]); var min = ('0.' + tmp[1])*60; var sec = min.toString().split('.'); min = Math.floor(min); sec = (('0.' + sec[1]) * 60).toFixed(2); geoli...
javascript
function(dec) { if (dec in geolib.sexagesimal) { return geolib.sexagesimal[dec]; } var tmp = dec.toString().split('.'); var deg = Math.abs(tmp[0]); var min = ('0.' + tmp[1])*60; var sec = min.toString().split('.'); min = Math.floor(min); sec = (('0.' + sec[1]) * 60).toFixed(2); geoli...
[ "function", "(", "dec", ")", "{", "if", "(", "dec", "in", "geolib", ".", "sexagesimal", ")", "{", "return", "geolib", ".", "sexagesimal", "[", "dec", "]", ";", "}", "var", "tmp", "=", "dec", ".", "toString", "(", ")", ".", "split", "(", "'.'", ")...
Converts a decimal coordinate value to sexagesimal format @param float decimal @return string Sexagesimal value (XX° YY' ZZ")
[ "Converts", "a", "decimal", "coordinate", "value", "to", "sexagesimal", "format" ]
89432e5b8e455eceef5f5098d479ad94c88acc59
https://github.com/feilaoda/power/blob/89432e5b8e455eceef5f5098d479ad94c88acc59/public/javascripts/vendor/javascripts/geolib.js#L828-L847
train
feilaoda/power
public/javascripts/vendor/javascripts/geolib.js
function(sexagesimal) { if (sexagesimal in geolib.decimal) { return geolib.decimal[sexagesimal]; } var regEx = new RegExp(sexagesimalPattern); var data = regEx.exec(sexagesimal); if(data) { var min = parseFloat(data[2]/60); var sec = parseFloat(data[4]/3600) || 0; } var dec = ((pars...
javascript
function(sexagesimal) { if (sexagesimal in geolib.decimal) { return geolib.decimal[sexagesimal]; } var regEx = new RegExp(sexagesimalPattern); var data = regEx.exec(sexagesimal); if(data) { var min = parseFloat(data[2]/60); var sec = parseFloat(data[4]/3600) || 0; } var dec = ((pars...
[ "function", "(", "sexagesimal", ")", "{", "if", "(", "sexagesimal", "in", "geolib", ".", "decimal", ")", "{", "return", "geolib", ".", "decimal", "[", "sexagesimal", "]", ";", "}", "var", "regEx", "=", "new", "RegExp", "(", "sexagesimalPattern", ")", ";"...
Converts a sexagesimal coordinate to decimal format @param float Sexagesimal coordinate @return string Decimal value (XX.XXXXXXXX)
[ "Converts", "a", "sexagesimal", "coordinate", "to", "decimal", "format" ]
89432e5b8e455eceef5f5098d479ad94c88acc59
https://github.com/feilaoda/power/blob/89432e5b8e455eceef5f5098d479ad94c88acc59/public/javascripts/vendor/javascripts/geolib.js#L856-L878
train
douglascvas/jsonutils
src/main/jsonUtils.js
function (jsonObject, path, force, value) { if (!path) { return; } var newValue, obj; obj = jsonObject || {}; path.trim().split('.').some(function (key, index, array) { if (!key && key !== 0) { return false; } newValue = obj[key]; if (index == array.length - 1) { if (value === ...
javascript
function (jsonObject, path, force, value) { if (!path) { return; } var newValue, obj; obj = jsonObject || {}; path.trim().split('.').some(function (key, index, array) { if (!key && key !== 0) { return false; } newValue = obj[key]; if (index == array.length - 1) { if (value === ...
[ "function", "(", "jsonObject", ",", "path", ",", "force", ",", "value", ")", "{", "if", "(", "!", "path", ")", "{", "return", ";", "}", "var", "newValue", ",", "obj", ";", "obj", "=", "jsonObject", "||", "{", "}", ";", "path", ".", "trim", "(", ...
Sets the value in the JSON object or create the path. @method setValue @private
[ "Sets", "the", "value", "in", "the", "JSON", "object", "or", "create", "the", "path", "." ]
44c2f77252467d2d4ab8daa616115b81dda31dd3
https://github.com/douglascvas/jsonutils/blob/44c2f77252467d2d4ab8daa616115b81dda31dd3/src/main/jsonUtils.js#L18-L47
train
odogono/elsinore-js
src/query/index.js
gatherEntityFilters
function gatherEntityFilters(context, expression) { let ii, len, bf, result, obj; let filter = expression[0]; result = EntityFilter.create(); switch (filter) { case ANY: case ANY_FILTER: case ALL: case ALL_FILTER: case NONE: case NONE_FILTER: cas...
javascript
function gatherEntityFilters(context, expression) { let ii, len, bf, result, obj; let filter = expression[0]; result = EntityFilter.create(); switch (filter) { case ANY: case ANY_FILTER: case ALL: case ALL_FILTER: case NONE: case NONE_FILTER: cas...
[ "function", "gatherEntityFilters", "(", "context", ",", "expression", ")", "{", "let", "ii", ",", "len", ",", "bf", ",", "result", ",", "obj", ";", "let", "filter", "=", "expression", "[", "0", "]", ";", "result", "=", "EntityFilter", ".", "create", "(...
Query functions for the memory based entity set. Some inspiration taken from https://github.com/aaronpowell/db.js
[ "Query", "functions", "for", "the", "memory", "based", "entity", "set", "." ]
1ecce67ad0022646419a740def029b1ba92dd558
https://github.com/odogono/elsinore-js/blob/1ecce67ad0022646419a740def029b1ba92dd558/src/query/index.js#L389-L455
train
nodejitsu/contour
pagelets/nodejitsu/creditcard/base.js
initialize
function initialize() { var creditcard; // [square] @import "creditcard/index.js" this.lib = creditcard; // // Create references to elements. // this.number = this.$('input[name="full_number"]'); this.cvv = this.$('input[name="cvv"]'); this.year = this.$('select[name="expiration_yea...
javascript
function initialize() { var creditcard; // [square] @import "creditcard/index.js" this.lib = creditcard; // // Create references to elements. // this.number = this.$('input[name="full_number"]'); this.cvv = this.$('input[name="cvv"]'); this.year = this.$('select[name="expiration_yea...
[ "function", "initialize", "(", ")", "{", "var", "creditcard", ";", "// [square] @import \"creditcard/index.js\"", "this", ".", "lib", "=", "creditcard", ";", "//", "// Create references to elements.", "//", "this", ".", "number", "=", "this", ".", "$", "(", "'inpu...
Import the credit card library and store a reference in lib. @api private
[ "Import", "the", "credit", "card", "library", "and", "store", "a", "reference", "in", "lib", "." ]
0828e9bd25ef1eeb97ea231c447118d9867021b6
https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/nodejitsu/creditcard/base.js#L36-L54
train
nodejitsu/contour
pagelets/nodejitsu/creditcard/base.js
digit
function digit(event) { var element = event.element , code = event.keyCode || event.which , result; result = (code >= 48 && code <= 57) || code === 8 || code === 46; if (!result) event.preventDefault(); return { allowed: result, code: code, removal: code === 8 || code ===...
javascript
function digit(event) { var element = event.element , code = event.keyCode || event.which , result; result = (code >= 48 && code <= 57) || code === 8 || code === 46; if (!result) event.preventDefault(); return { allowed: result, code: code, removal: code === 8 || code ===...
[ "function", "digit", "(", "event", ")", "{", "var", "element", "=", "event", ".", "element", ",", "code", "=", "event", ".", "keyCode", "||", "event", ".", "which", ",", "result", ";", "result", "=", "(", "code", ">=", "48", "&&", "code", "<=", "57...
Only allow numbers in the number field. @api private
[ "Only", "allow", "numbers", "in", "the", "number", "field", "." ]
0828e9bd25ef1eeb97ea231c447118d9867021b6
https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/nodejitsu/creditcard/base.js#L61-L74
train
nodejitsu/contour
pagelets/nodejitsu/creditcard/base.js
date
function date(event) { var result = this.lib.expiry(this.month.get('value'), this.year.get('value')) , className = result ? 'valid' : 'invalid'; // // Update both select boxes. // this.month.removeClass('invalid').addClass(className); this.year.removeClass('invalid').addClass(className); ...
javascript
function date(event) { var result = this.lib.expiry(this.month.get('value'), this.year.get('value')) , className = result ? 'valid' : 'invalid'; // // Update both select boxes. // this.month.removeClass('invalid').addClass(className); this.year.removeClass('invalid').addClass(className); ...
[ "function", "date", "(", "event", ")", "{", "var", "result", "=", "this", ".", "lib", ".", "expiry", "(", "this", ".", "month", ".", "get", "(", "'value'", ")", ",", "this", ".", "year", ".", "get", "(", "'value'", ")", ")", ",", "className", "="...
On date changes, year or month, check expiration date. @param {Event} event @api private
[ "On", "date", "changes", "year", "or", "month", "check", "expiration", "date", "." ]
0828e9bd25ef1eeb97ea231c447118d9867021b6
https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/nodejitsu/creditcard/base.js#L82-L91
train
nodejitsu/contour
pagelets/nodejitsu/creditcard/base.js
number
function number(event) { var element = event.element , value = element.value , key = this.digit(event) , valid; // // Input must be numerical. // if (!key.allowed && event.type !== 'blur') return; // // Always format if the event is of type blur. This will ensure the inpu...
javascript
function number(event) { var element = event.element , value = element.value , key = this.digit(event) , valid; // // Input must be numerical. // if (!key.allowed && event.type !== 'blur') return; // // Always format if the event is of type blur. This will ensure the inpu...
[ "function", "number", "(", "event", ")", "{", "var", "element", "=", "event", ".", "element", ",", "value", "=", "element", ".", "value", ",", "key", "=", "this", ".", "digit", "(", "event", ")", ",", "valid", ";", "//", "// Input must be numerical.", ...
On credit card number changes, add spaces and check validaty. @param {Event} event @api private
[ "On", "credit", "card", "number", "changes", "add", "spaces", "and", "check", "validaty", "." ]
0828e9bd25ef1eeb97ea231c447118d9867021b6
https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/nodejitsu/creditcard/base.js#L99-L148
train
nodejitsu/contour
pagelets/nodejitsu/creditcard/base.js
cvv
function cvv(event) { var element = event.element , value = element.value , key = this.digit(event); // // Input must be numerical. // if (!key.allowed && event.type !== 'blur') return; // // Check if the number is valid. // if (this.validate && (value.length >= 3 || ke...
javascript
function cvv(event) { var element = event.element , value = element.value , key = this.digit(event); // // Input must be numerical. // if (!key.allowed && event.type !== 'blur') return; // // Check if the number is valid. // if (this.validate && (value.length >= 3 || ke...
[ "function", "cvv", "(", "event", ")", "{", "var", "element", "=", "event", ".", "element", ",", "value", "=", "element", ".", "value", ",", "key", "=", "this", ".", "digit", "(", "event", ")", ";", "//", "// Input must be numerical.", "//", "if", "(", ...
On cvv changes check the content and validate. @param {Event} event @api private
[ "On", "cvv", "changes", "check", "the", "content", "and", "validate", "." ]
0828e9bd25ef1eeb97ea231c447118d9867021b6
https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/nodejitsu/creditcard/base.js#L156-L175
train
unshiftio/window.name
index.js
removeItem
function removeItem(key) { delete storage[key]; window.name = qs.stringify(storage, prefix); windowStorage.length--; }
javascript
function removeItem(key) { delete storage[key]; window.name = qs.stringify(storage, prefix); windowStorage.length--; }
[ "function", "removeItem", "(", "key", ")", "{", "delete", "storage", "[", "key", "]", ";", "window", ".", "name", "=", "qs", ".", "stringify", "(", "storage", ",", "prefix", ")", ";", "windowStorage", ".", "length", "--", ";", "}" ]
Remove a single item from the storage. @param {String} key Name of the value we need to remove. @returns {Undefined} @api pubilc
[ "Remove", "a", "single", "item", "from", "the", "storage", "." ]
525819d37de60aefc27b7307101888723cb31d3e
https://github.com/unshiftio/window.name/blob/525819d37de60aefc27b7307101888723cb31d3e/index.js#L81-L86
train
supersoaker/Grunt-RegPack
lib/packer.js
function(input, options) { this.preprocess(input, options); for (var inputIndex=0; inputIndex < this.inputList.length; ++inputIndex) { this.input = this.inputList[inputIndex][1][1].replace(/\\/g,'\\\\'); // first stage : configurable crusher var output = this.findRedundancies(options); this.inputL...
javascript
function(input, options) { this.preprocess(input, options); for (var inputIndex=0; inputIndex < this.inputList.length; ++inputIndex) { this.input = this.inputList[inputIndex][1][1].replace(/\\/g,'\\\\'); // first stage : configurable crusher var output = this.findRedundancies(options); this.inputL...
[ "function", "(", "input", ",", "options", ")", "{", "this", ".", "preprocess", "(", "input", ",", "options", ")", ";", "for", "(", "var", "inputIndex", "=", "0", ";", "inputIndex", "<", "this", ".", "inputList", ".", "length", ";", "++", "inputIndex", ...
Main entry point for RegPack
[ "Main", "entry", "point", "for", "RegPack" ]
848d995c673e7c6bd99188f4e37b6a02151ae884
https://github.com/supersoaker/Grunt-RegPack/blob/848d995c673e7c6bd99188f4e37b6a02151ae884/lib/packer.js#L90-L109
train
supersoaker/Grunt-RegPack
lib/packer.js
function(matchIndex) { var oldToken = this.matchesLookup[matchIndex].token; for (var j=0;j<this.matchesLookup.length;++j) { this.matchesLookup[j].usedBy = this.matchesLookup[j].usedBy.split(oldToken).join(""); } this.matchesLookup[matchIndex].cleared=true; }
javascript
function(matchIndex) { var oldToken = this.matchesLookup[matchIndex].token; for (var j=0;j<this.matchesLookup.length;++j) { this.matchesLookup[j].usedBy = this.matchesLookup[j].usedBy.split(oldToken).join(""); } this.matchesLookup[matchIndex].cleared=true; }
[ "function", "(", "matchIndex", ")", "{", "var", "oldToken", "=", "this", ".", "matchesLookup", "[", "matchIndex", "]", ".", "token", ";", "for", "(", "var", "j", "=", "0", ";", "j", "<", "this", ".", "matchesLookup", ".", "length", ";", "++", "j", ...
Clears a match from matchesLookup for dependencies
[ "Clears", "a", "match", "from", "matchesLookup", "for", "dependencies" ]
848d995c673e7c6bd99188f4e37b6a02151ae884
https://github.com/supersoaker/Grunt-RegPack/blob/848d995c673e7c6bd99188f4e37b6a02151ae884/lib/packer.js#L863-L869
train
octet-stream/object-deep-from-entries
getTag.js
getTag
function getTag(val) { const tag = Object.prototype.toString.call(val).slice(8, -1) if (basicTypes.includes(tag.toLowerCase())) { return tag.toLowerCase() } return tag }
javascript
function getTag(val) { const tag = Object.prototype.toString.call(val).slice(8, -1) if (basicTypes.includes(tag.toLowerCase())) { return tag.toLowerCase() } return tag }
[ "function", "getTag", "(", "val", ")", "{", "const", "tag", "=", "Object", ".", "prototype", ".", "toString", ".", "call", "(", "val", ")", ".", "slice", "(", "8", ",", "-", "1", ")", "if", "(", "basicTypes", ".", "includes", "(", "tag", ".", "to...
Get a string with type name of the given value @param {any} val @return {string} @api private
[ "Get", "a", "string", "with", "type", "name", "of", "the", "given", "value" ]
ea0c889c659150aeee6855f03ce7fbfba04ad99a
https://github.com/octet-stream/object-deep-from-entries/blob/ea0c889c659150aeee6855f03ce7fbfba04ad99a/getTag.js#L21-L29
train
jonschlinkert/question-cache
lib/question.js
Question
function Question(name, message, options) { if (utils.isObject(name)) { options = utils.merge({}, message, name); message = options.message; name = options.name; } if (utils.isObject(message)) { options = utils.merge({}, options, message); message = options.message; } utils.define(this, ...
javascript
function Question(name, message, options) { if (utils.isObject(name)) { options = utils.merge({}, message, name); message = options.message; name = options.name; } if (utils.isObject(message)) { options = utils.merge({}, options, message); message = options.message; } utils.define(this, ...
[ "function", "Question", "(", "name", ",", "message", ",", "options", ")", "{", "if", "(", "utils", ".", "isObject", "(", "name", ")", ")", "{", "options", "=", "utils", ".", "merge", "(", "{", "}", ",", "message", ",", "name", ")", ";", "message", ...
Create new `Question` store `name`, with the given `options`. ```js var question = new Question(name, options); ``` @param {String} `name` The question property name. @param {Object} `options` Store options @api public
[ "Create", "new", "Question", "store", "name", "with", "the", "given", "options", "." ]
85e4f1e00be1f230c435101f70c5da4227ce51ff
https://github.com/jonschlinkert/question-cache/blob/85e4f1e00be1f230c435101f70c5da4227ce51ff/lib/question.js#L25-L51
train
jonschlinkert/question-cache
lib/question.js
createNext
function createNext(question) { if (!question.options.next) return; if (typeof question.options.next === 'function') { question.next = function() { question.options.next.apply(question, arguments); }; return; } if (typeof question.options.next === 'string') { question.type = 'confirm'; ...
javascript
function createNext(question) { if (!question.options.next) return; if (typeof question.options.next === 'function') { question.next = function() { question.options.next.apply(question, arguments); }; return; } if (typeof question.options.next === 'string') { question.type = 'confirm'; ...
[ "function", "createNext", "(", "question", ")", "{", "if", "(", "!", "question", ".", "options", ".", "next", ")", "return", ";", "if", "(", "typeof", "question", ".", "options", ".", "next", "===", "'function'", ")", "{", "question", ".", "next", "=",...
Create the next question to ask, if `next` is passed on the options. @param {Object} `app` question instance
[ "Create", "the", "next", "question", "to", "ask", "if", "next", "is", "passed", "on", "the", "options", "." ]
85e4f1e00be1f230c435101f70c5da4227ce51ff
https://github.com/jonschlinkert/question-cache/blob/85e4f1e00be1f230c435101f70c5da4227ce51ff/lib/question.js#L60-L80
train
Whitebolt/require-extra
src/eval.js
_parseConfig
function _parseConfig(config) { const _config = Object.assign({}, { filename:module.parent.filename, scope: settings.get('scope') || {}, includeGlobals:false, proxyGlobal:true, useSandbox: settings.get('useSandbox') || false, workspace: [workspaces.DEFAULT_WORKSPACE], squashErrors: !!(conf...
javascript
function _parseConfig(config) { const _config = Object.assign({}, { filename:module.parent.filename, scope: settings.get('scope') || {}, includeGlobals:false, proxyGlobal:true, useSandbox: settings.get('useSandbox') || false, workspace: [workspaces.DEFAULT_WORKSPACE], squashErrors: !!(conf...
[ "function", "_parseConfig", "(", "config", ")", "{", "const", "_config", "=", "Object", ".", "assign", "(", "{", "}", ",", "{", "filename", ":", "module", ".", "parent", ".", "filename", ",", "scope", ":", "settings", ".", "get", "(", "'scope'", ")", ...
Parse a config, adding defaults. @private @param {Object} config Config to parse. @returns {Object} Parsed config.
[ "Parse", "a", "config", "adding", "defaults", "." ]
2a8f737aab67305c9fda3ee56aa7953e97cee859
https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/eval.js#L23-L37
train
Whitebolt/require-extra
src/eval.js
_createOptions
function _createOptions(config) { return { filename:config.filename, displayErrors:true, timeout: config.timeout || 20*1000 }; }
javascript
function _createOptions(config) { return { filename:config.filename, displayErrors:true, timeout: config.timeout || 20*1000 }; }
[ "function", "_createOptions", "(", "config", ")", "{", "return", "{", "filename", ":", "config", ".", "filename", ",", "displayErrors", ":", "true", ",", "timeout", ":", "config", ".", "timeout", "||", "20", "*", "1000", "}", ";", "}" ]
Given a config object create an options object for sandboxing operations. @private @param {Object} config Config for this creation. @returns {Object} Options for sandboxing operations.
[ "Given", "a", "config", "object", "create", "an", "options", "object", "for", "sandboxing", "operations", "." ]
2a8f737aab67305c9fda3ee56aa7953e97cee859
https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/eval.js#L62-L68
train
Whitebolt/require-extra
src/eval.js
_createScript
function _createScript(config, options, scope={}) { if (!isString(config.content)) return config.content; const stringScript = wrap(config.content.replace(/^\#\!.*/, ''), scope); try { return new vm.Script(stringScript, options); } catch(error) { // These are not squashed as not evaluation errors but someth...
javascript
function _createScript(config, options, scope={}) { if (!isString(config.content)) return config.content; const stringScript = wrap(config.content.replace(/^\#\!.*/, ''), scope); try { return new vm.Script(stringScript, options); } catch(error) { // These are not squashed as not evaluation errors but someth...
[ "function", "_createScript", "(", "config", ",", "options", ",", "scope", "=", "{", "}", ")", "{", "if", "(", "!", "isString", "(", "config", ".", "content", ")", ")", "return", "config", ".", "content", ";", "const", "stringScript", "=", "wrap", "(", ...
Given a config and some options create a script ready for vm sandboxing. @param {Object} config Config for this operation. @param {options} options Options for the script. @returns {VMScript} New script ready to use.
[ "Given", "a", "config", "and", "some", "options", "create", "a", "script", "ready", "for", "vm", "sandboxing", "." ]
2a8f737aab67305c9fda3ee56aa7953e97cee859
https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/eval.js#L77-L85
train
Whitebolt/require-extra
src/eval.js
wrap
function wrap(content, scope) { const scopeParams = Object.keys(scope).join(','); const comma = ((scopeParams !== '')?', ':''); return `(function (exports, require, module, __filename, __dirname${comma}${scopeParams}) { ${content} });` }
javascript
function wrap(content, scope) { const scopeParams = Object.keys(scope).join(','); const comma = ((scopeParams !== '')?', ':''); return `(function (exports, require, module, __filename, __dirname${comma}${scopeParams}) { ${content} });` }
[ "function", "wrap", "(", "content", ",", "scope", ")", "{", "const", "scopeParams", "=", "Object", ".", "keys", "(", "scope", ")", ".", "join", "(", "','", ")", ";", "const", "comma", "=", "(", "(", "scopeParams", "!==", "''", ")", "?", "', '", ":"...
Wrap the script content with scape parameters, including optional extra ones. @param {string} content Content to wrap. @param {Object} scope Scope parameters to add. @returns {string} Wrapped script content.
[ "Wrap", "the", "script", "content", "with", "scape", "parameters", "including", "optional", "extra", "ones", "." ]
2a8f737aab67305c9fda3ee56aa7953e97cee859
https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/eval.js#L94-L100
train
Whitebolt/require-extra
src/eval.js
_getScopeParams
function _getScopeParams(config, module, scope={}) { return [ module.exports, module.require, module, module.filename, config.basedir || path.dirname(module.filename), ...values(scope) ]; }
javascript
function _getScopeParams(config, module, scope={}) { return [ module.exports, module.require, module, module.filename, config.basedir || path.dirname(module.filename), ...values(scope) ]; }
[ "function", "_getScopeParams", "(", "config", ",", "module", ",", "scope", "=", "{", "}", ")", "{", "return", "[", "module", ".", "exports", ",", "module", ".", "require", ",", "module", ",", "module", ".", "filename", ",", "config", ".", "basedir", "|...
Get scoped parameters to pass to wrap function. @private @param {Object} config The config options. @param {Module} module The module. @returns {Array.<*>} Parameters.
[ "Get", "scoped", "parameters", "to", "pass", "to", "wrap", "function", "." ]
2a8f737aab67305c9fda3ee56aa7953e97cee859
https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/eval.js#L110-L119
train
Whitebolt/require-extra
src/eval.js
_runError
function _runError(error, module) { const _error = new emitter.Error({ target:module.filename, source:(module.parent || module).filename, error }); module.exports = _error; emitter.emit('error', _error); return (!!_error.ignore || (_error.ignore && isFunction(_error.ignore) && _error.ignore())); }
javascript
function _runError(error, module) { const _error = new emitter.Error({ target:module.filename, source:(module.parent || module).filename, error }); module.exports = _error; emitter.emit('error', _error); return (!!_error.ignore || (_error.ignore && isFunction(_error.ignore) && _error.ignore())); }
[ "function", "_runError", "(", "error", ",", "module", ")", "{", "const", "_error", "=", "new", "emitter", ".", "Error", "(", "{", "target", ":", "module", ".", "filename", ",", "source", ":", "(", "module", ".", "parent", "||", "module", ")", ".", "f...
Handle run errors. @private @param {Error} error The error thrown. @param {Module} module The module.
[ "Handle", "run", "errors", "." ]
2a8f737aab67305c9fda3ee56aa7953e97cee859
https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/eval.js#L128-L137
train
Whitebolt/require-extra
src/eval.js
_runScript
function _runScript(config, options) { const useSandbox = ((isFunction(config.useSandbox)) ? _config.useSandbox(_config) || false : config.useSandbox); const module = new Module(config); const scopeParams = _getScopeParams(config, module, config.scope); const script = _createScript(config, options, config.scope...
javascript
function _runScript(config, options) { const useSandbox = ((isFunction(config.useSandbox)) ? _config.useSandbox(_config) || false : config.useSandbox); const module = new Module(config); const scopeParams = _getScopeParams(config, module, config.scope); const script = _createScript(config, options, config.scope...
[ "function", "_runScript", "(", "config", ",", "options", ")", "{", "const", "useSandbox", "=", "(", "(", "isFunction", "(", "config", ".", "useSandbox", ")", ")", "?", "_config", ".", "useSandbox", "(", "_config", ")", "||", "false", ":", "config", ".", ...
Run the given script in the given sandbox, according to the given config and options. @private @param {Object} config Config to use. @param {Object} options Options for running. @returns {Module} The module created.
[ "Run", "the", "given", "script", "in", "the", "given", "sandbox", "according", "to", "the", "given", "config", "and", "options", "." ]
2a8f737aab67305c9fda3ee56aa7953e97cee859
https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/eval.js#L147-L169
train
Whitebolt/require-extra
src/eval.js
evaluate
function evaluate(config) { const _config = _parseConfig(config); const options = _createOptions(_config); return _runScript(_config, options); }
javascript
function evaluate(config) { const _config = _parseConfig(config); const options = _createOptions(_config); return _runScript(_config, options); }
[ "function", "evaluate", "(", "config", ")", "{", "const", "_config", "=", "_parseConfig", "(", "config", ")", ";", "const", "options", "=", "_createOptions", "(", "_config", ")", ";", "return", "_runScript", "(", "_config", ",", "options", ")", ";", "}" ]
Given a config object, evaluate the given content in a sandbox according to the config. Return the module. @param {Object} config Config to use. @returns {Module}
[ "Given", "a", "config", "object", "evaluate", "the", "given", "content", "in", "a", "sandbox", "according", "to", "the", "config", ".", "Return", "the", "module", "." ]
2a8f737aab67305c9fda3ee56aa7953e97cee859
https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/eval.js#L179-L183
train
jriecken/asset-smasher
lib/discovery/manifest.js
hasFileType
function hasFileType(file, fileExt) { file = path.basename(file); var ext = path.extname(file); do { if (ext === fileExt) { return true; } else { file = path.basename(file, ext); ext = path.extname(file); } } while (ext); return false; }
javascript
function hasFileType(file, fileExt) { file = path.basename(file); var ext = path.extname(file); do { if (ext === fileExt) { return true; } else { file = path.basename(file, ext); ext = path.extname(file); } } while (ext); return false; }
[ "function", "hasFileType", "(", "file", ",", "fileExt", ")", "{", "file", "=", "path", ".", "basename", "(", "file", ")", ";", "var", "ext", "=", "path", ".", "extname", "(", "file", ")", ";", "do", "{", "if", "(", "ext", "===", "fileExt", ")", "...
Checks that the file has the specified type in one of its extensions E.g. hasFileType('foo.js.dust.ejs', '.js') => true hasFileType('foo.css.less', '.js') => false hasFileType('foo.css.less', '.css') => true
[ "Checks", "that", "the", "file", "has", "the", "specified", "type", "in", "one", "of", "its", "extensions" ]
c627449b01f5da892683895915f74baa9994a475
https://github.com/jriecken/asset-smasher/blob/c627449b01f5da892683895915f74baa9994a475/lib/discovery/manifest.js#L50-L62
train
jriecken/asset-smasher
lib/discovery/manifest.js
function (contents, wfCb) { async.eachSeries(contents.split('\n'), function (line, eachCb) { setImmediateCompat(function() { if (line && line.indexOf('#') !== 0) { var directive = line.match(DIRECTIVE_REGEX); if (!directive) { eachCb(new Error('B...
javascript
function (contents, wfCb) { async.eachSeries(contents.split('\n'), function (line, eachCb) { setImmediateCompat(function() { if (line && line.indexOf('#') !== 0) { var directive = line.match(DIRECTIVE_REGEX); if (!directive) { eachCb(new Error('B...
[ "function", "(", "contents", ",", "wfCb", ")", "{", "async", ".", "eachSeries", "(", "contents", ".", "split", "(", "'\\n'", ")", ",", "function", "(", "line", ",", "eachCb", ")", "{", "setImmediateCompat", "(", "function", "(", ")", "{", "if", "(", ...
For each line, process the directive on that line
[ "For", "each", "line", "process", "the", "directive", "on", "that", "line" ]
c627449b01f5da892683895915f74baa9994a475
https://github.com/jriecken/asset-smasher/blob/c627449b01f5da892683895915f74baa9994a475/lib/discovery/manifest.js#L125-L146
train
IonicaBizau/namy
lib/index.js
Namy
function Namy(input, callback) { if (/package.json$/.test(input)) { return ReadJson(input, function (err, data) { if (err) { return callback(err); } if (!data.main) { return callback(new Error("Cannot find the main field in package.json")); } N...
javascript
function Namy(input, callback) { if (/package.json$/.test(input)) { return ReadJson(input, function (err, data) { if (err) { return callback(err); } if (!data.main) { return callback(new Error("Cannot find the main field in package.json")); } N...
[ "function", "Namy", "(", "input", ",", "callback", ")", "{", "if", "(", "/", "package.json$", "/", ".", "test", "(", "input", ")", ")", "{", "return", "ReadJson", "(", "input", ",", "function", "(", "err", ",", "data", ")", "{", "if", "(", "err", ...
Namy Gets the name of the exported function. @name Namy @function @param {String} input The path to the package.json, directory or the file. @param {Function} callback The callback function.
[ "Namy", "Gets", "the", "name", "of", "the", "exported", "function", "." ]
0b3d44680d3fb1ae1cefe4339e7f96c6abfb014f
https://github.com/IonicaBizau/namy/blob/0b3d44680d3fb1ae1cefe4339e7f96c6abfb014f/lib/index.js#L13-L54
train
anseki/grunt-task-helper
tasks/task_helper.js
function(srcArray, dest, options) { if (!srcArray.length) { // both no data, don't add to filesArray. (Don't return undefined.) return typeof dest === 'string' && fileUpdates.isNew(dest, options); // But filesArray isn't usable for 'files', 'cause Grunt doesn't support empt...
javascript
function(srcArray, dest, options) { if (!srcArray.length) { // both no data, don't add to filesArray. (Don't return undefined.) return typeof dest === 'string' && fileUpdates.isNew(dest, options); // But filesArray isn't usable for 'files', 'cause Grunt doesn't support empt...
[ "function", "(", "srcArray", ",", "dest", ",", "options", ")", "{", "if", "(", "!", "srcArray", ".", "length", ")", "{", "// both no data, don't add to filesArray. (Don't return undefined.)", "return", "typeof", "dest", "===", "'string'", "&&", "fileUpdates", ".", ...
'new' is keyword of language.
[ "new", "is", "keyword", "of", "language", "." ]
2954fa23ed01942fc09a69c6d98d98fecf729562
https://github.com/anseki/grunt-task-helper/blob/2954fa23ed01942fc09a69c6d98d98fecf729562/tasks/task_helper.js#L30-L52
train
anseki/grunt-task-helper
tasks/task_helper.js
function(filepath) { return grunt.file.exists(filepath) ? Math.floor(fs.statSync(filepath).mtime.getTime() / 1000) : 0; // mtime before epochtime isn't supported. }
javascript
function(filepath) { return grunt.file.exists(filepath) ? Math.floor(fs.statSync(filepath).mtime.getTime() / 1000) : 0; // mtime before epochtime isn't supported. }
[ "function", "(", "filepath", ")", "{", "return", "grunt", ".", "file", ".", "exists", "(", "filepath", ")", "?", "Math", ".", "floor", "(", "fs", ".", "statSync", "(", "filepath", ")", ".", "mtime", ".", "getTime", "(", ")", "/", "1000", ")", ":", ...
retrieve mtime as seconds.
[ "retrieve", "mtime", "as", "seconds", "." ]
2954fa23ed01942fc09a69c6d98d98fecf729562
https://github.com/anseki/grunt-task-helper/blob/2954fa23ed01942fc09a69c6d98d98fecf729562/tasks/task_helper.js#L72-L76
train
anseki/grunt-task-helper
tasks/task_helper.js
function(filepath, options) { // options.mtimeOffset: 3 default if (!fileUpdates.offset) { fileUpdates.offset = options.mtimeOffset || 3; } if (!fileUpdates.storeData) { // Initialize data. if (grunt.file.exists(fileUpdates.storeDataPath)) { fileUpdates.storeData ...
javascript
function(filepath, options) { // options.mtimeOffset: 3 default if (!fileUpdates.offset) { fileUpdates.offset = options.mtimeOffset || 3; } if (!fileUpdates.storeData) { // Initialize data. if (grunt.file.exists(fileUpdates.storeDataPath)) { fileUpdates.storeData ...
[ "function", "(", "filepath", ",", "options", ")", "{", "// options.mtimeOffset: 3 default", "if", "(", "!", "fileUpdates", ".", "offset", ")", "{", "fileUpdates", ".", "offset", "=", "options", ".", "mtimeOffset", "||", "3", ";", "}", "if", "(", "!", "file...
retrieve last update of file.
[ "retrieve", "last", "update", "of", "file", "." ]
2954fa23ed01942fc09a69c6d98d98fecf729562
https://github.com/anseki/grunt-task-helper/blob/2954fa23ed01942fc09a69c6d98d98fecf729562/tasks/task_helper.js#L78-L99
train
angular-template/ng1-template-gulp
lib/tasks/setup.js
createSymlinks
function createSymlinks(symlinks) { let path = require('path'); let fs = require('fs'); let del = require('del'); del.sync(symlinks.map(sl => sl.dest)); try { symlinks.forEach(sl => { let src = path.resolve(sl.src); fs.symlinkSync(src, sl.dest); }); } cat...
javascript
function createSymlinks(symlinks) { let path = require('path'); let fs = require('fs'); let del = require('del'); del.sync(symlinks.map(sl => sl.dest)); try { symlinks.forEach(sl => { let src = path.resolve(sl.src); fs.symlinkSync(src, sl.dest); }); } cat...
[ "function", "createSymlinks", "(", "symlinks", ")", "{", "let", "path", "=", "require", "(", "'path'", ")", ";", "let", "fs", "=", "require", "(", "'fs'", ")", ";", "let", "del", "=", "require", "(", "'del'", ")", ";", "del", ".", "sync", "(", "sym...
Creates one or more symbolic links. @param {Object[]} symlinks - Symlink details @param {string} symlinks[].src - Source file path @param {string} symlinks[].dest - Symbolic link file path
[ "Creates", "one", "or", "more", "symbolic", "links", "." ]
ea3b85db2d2f184e56e4ba9cdbf30d286c3986b4
https://github.com/angular-template/ng1-template-gulp/blob/ea3b85db2d2f184e56e4ba9cdbf30d286c3986b4/lib/tasks/setup.js#L22-L41
train
Submersible/node-staticfile
index.js
crawlDirectoryWithFS
function crawlDirectoryWithFS(parent, sync) { return fsCmd('readdir', sync, parent).then(function (things) { return Q.all(things.map(function (file) { file = path.join(parent, file); return Q.all([file, fsCmd('stat', sync, file)]); })); }).then(function (stats) { ...
javascript
function crawlDirectoryWithFS(parent, sync) { return fsCmd('readdir', sync, parent).then(function (things) { return Q.all(things.map(function (file) { file = path.join(parent, file); return Q.all([file, fsCmd('stat', sync, file)]); })); }).then(function (stats) { ...
[ "function", "crawlDirectoryWithFS", "(", "parent", ",", "sync", ")", "{", "return", "fsCmd", "(", "'readdir'", ",", "sync", ",", "parent", ")", ".", "then", "(", "function", "(", "things", ")", "{", "return", "Q", ".", "all", "(", "things", ".", "map",...
Recursively crawl a directory for all of it's files.
[ "Recursively", "crawl", "a", "directory", "for", "all", "of", "it", "s", "files", "." ]
40a060488fff32dee6c655408ad3f84d076764e9
https://github.com/Submersible/node-staticfile/blob/40a060488fff32dee6c655408ad3f84d076764e9/index.js#L33-L50
train
Submersible/node-staticfile
index.js
crawlDirectory
function crawlDirectory(parent, sync) { if (sync) { return crawlDirectory(parent, sync); } /* Use `find` if available, because it's fast! */ return exec('find ' + parent + ' -not -type d').spread(function (stdin) { return stdin.split('\n').filter(function (file) { return !!fi...
javascript
function crawlDirectory(parent, sync) { if (sync) { return crawlDirectory(parent, sync); } /* Use `find` if available, because it's fast! */ return exec('find ' + parent + ' -not -type d').spread(function (stdin) { return stdin.split('\n').filter(function (file) { return !!fi...
[ "function", "crawlDirectory", "(", "parent", ",", "sync", ")", "{", "if", "(", "sync", ")", "{", "return", "crawlDirectory", "(", "parent", ",", "sync", ")", ";", "}", "/* Use `find` if available, because it's fast! */", "return", "exec", "(", "'find '", "+", ...
Crawl a directory for all of it's files!
[ "Crawl", "a", "directory", "for", "all", "of", "it", "s", "files!" ]
40a060488fff32dee6c655408ad3f84d076764e9
https://github.com/Submersible/node-staticfile/blob/40a060488fff32dee6c655408ad3f84d076764e9/index.js#L55-L67
train
mesmotronic/conbo
src/conbo/binding/AttributeBindings.js
function(el, value) { !conbo.isEmpty(value) ? el.classList.add('cb-hide') : el.classList.remove('cb-hide'); }
javascript
function(el, value) { !conbo.isEmpty(value) ? el.classList.add('cb-hide') : el.classList.remove('cb-hide'); }
[ "function", "(", "el", ",", "value", ")", "{", "!", "conbo", ".", "isEmpty", "(", "value", ")", "?", "el", ".", "classList", ".", "add", "(", "'cb-hide'", ")", ":", "el", ".", "classList", ".", "remove", "(", "'cb-hide'", ")", ";", "}" ]
Hides an element by making it invisible, but does not remove if from the layout of the page, meaning a blank space will remain @param {HTMLElement} el - DOM element to which the attribute applies @param {*} value - The value referenced by the attribute @returns {void} @example <div cb-hide="propertyName"></di...
[ "Hides", "an", "element", "by", "making", "it", "invisible", "but", "does", "not", "remove", "if", "from", "the", "layout", "of", "the", "page", "meaning", "a", "blank", "space", "will", "remain" ]
339df613eefc48e054e115337079573ad842f717
https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/src/conbo/binding/AttributeBindings.js#L70-L75
train
mesmotronic/conbo
src/conbo/binding/AttributeBindings.js
function(el, value, options, styleName) { if (!styleName) { conbo.warn('cb-style attributes must specify one or more styles in the format cb-style="myProperty:style-name"'); } styleName = conbo.toCamelCase(styleName); el.style[styleName] = value; }
javascript
function(el, value, options, styleName) { if (!styleName) { conbo.warn('cb-style attributes must specify one or more styles in the format cb-style="myProperty:style-name"'); } styleName = conbo.toCamelCase(styleName); el.style[styleName] = value; }
[ "function", "(", "el", ",", "value", ",", "options", ",", "styleName", ")", "{", "if", "(", "!", "styleName", ")", "{", "conbo", ".", "warn", "(", "'cb-style attributes must specify one or more styles in the format cb-style=\"myProperty:style-name\"'", ")", ";", "}", ...
Apply styles from a variable @param {HTMLElement} el - DOM element to which the attribute applies @param {*} value - The value referenced by the attribute @param {Object} options - Options relating to this binding @param {string} styleName - The name of the style to bind @returns {void} @example <div ...
[ "Apply", "styles", "from", "a", "variable" ]
339df613eefc48e054e115337079573ad842f717
https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/src/conbo/binding/AttributeBindings.js#L223-L232
train
mesmotronic/conbo
src/conbo/binding/AttributeBindings.js
function(el, value, options) { var view = options.view; var states = value.split(' '); var stateChangeHandler = (function() { this.cbInclude(el, states.indexOf(view.currentState) != -1); }).bind(this); view.addEventListener('change:currentState', stateChangeHandler, this); stateChange...
javascript
function(el, value, options) { var view = options.view; var states = value.split(' '); var stateChangeHandler = (function() { this.cbInclude(el, states.indexOf(view.currentState) != -1); }).bind(this); view.addEventListener('change:currentState', stateChangeHandler, this); stateChange...
[ "function", "(", "el", ",", "value", ",", "options", ")", "{", "var", "view", "=", "options", ".", "view", ";", "var", "states", "=", "value", ".", "split", "(", "' '", ")", ";", "var", "stateChangeHandler", "=", "(", "function", "(", ")", "{", "th...
Only includes the specified element in the layout when the View's `currentState` matches one of the states listed in the attribute's value; multiple states should be separated by spaces @param {HTMLElement} el - DOM element to which the attribute applies @param {*} value - The value referenced by the attribute ...
[ "Only", "includes", "the", "specified", "element", "in", "the", "layout", "when", "the", "View", "s", "currentState", "matches", "one", "of", "the", "states", "listed", "in", "the", "attribute", "s", "value", ";", "multiple", "states", "should", "be", "separ...
339df613eefc48e054e115337079573ad842f717
https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/src/conbo/binding/AttributeBindings.js#L437-L449
train
mesmotronic/conbo
src/conbo/binding/AttributeBindings.js
function(el, value, options) { var view = options.view; var states = value.split(' '); var stateChangeHandler = function() { this.cbExclude(el, states.indexOf(view.currentState) != -1); }; view.addEventListener('change:currentState', stateChangeHandler, this); stateChangeHandler.call(...
javascript
function(el, value, options) { var view = options.view; var states = value.split(' '); var stateChangeHandler = function() { this.cbExclude(el, states.indexOf(view.currentState) != -1); }; view.addEventListener('change:currentState', stateChangeHandler, this); stateChangeHandler.call(...
[ "function", "(", "el", ",", "value", ",", "options", ")", "{", "var", "view", "=", "options", ".", "view", ";", "var", "states", "=", "value", ".", "split", "(", "' '", ")", ";", "var", "stateChangeHandler", "=", "function", "(", ")", "{", "this", ...
Removes the specified element from the layout when the View's `currentState` matches one of the states listed in the attribute's value; multiple states should be separated by spaces @param {HTMLElement} el - DOM element to which the attribute applies @param {*} value - The value referenced by the attribute @par...
[ "Removes", "the", "specified", "element", "from", "the", "layout", "when", "the", "View", "s", "currentState", "matches", "one", "of", "the", "states", "listed", "in", "the", "attribute", "s", "value", ";", "multiple", "states", "should", "be", "separated", ...
339df613eefc48e054e115337079573ad842f717
https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/src/conbo/binding/AttributeBindings.js#L464-L476
train
mesmotronic/conbo
src/conbo/binding/AttributeBindings.js
function(el) { if (el.tagName == 'A') { el.onclick = function(event) { window.location = el.href; event.preventDefault(); return false; }; } }
javascript
function(el) { if (el.tagName == 'A') { el.onclick = function(event) { window.location = el.href; event.preventDefault(); return false; }; } }
[ "function", "(", "el", ")", "{", "if", "(", "el", ".", "tagName", "==", "'A'", ")", "{", "el", ".", "onclick", "=", "function", "(", "event", ")", "{", "window", ".", "location", "=", "el", ".", "href", ";", "event", ".", "preventDefault", "(", "...
Uses JavaScript to open an anchor's HREF so that the link will open in an iOS WebView instead of Safari @param {HTMLElement} el - DOM element to which the attribute applies @returns {void} @example <div cb-jshref="propertyName"></div>
[ "Uses", "JavaScript", "to", "open", "an", "anchor", "s", "HREF", "so", "that", "the", "link", "will", "open", "in", "an", "iOS", "WebView", "instead", "of", "Safari" ]
339df613eefc48e054e115337079573ad842f717
https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/src/conbo/binding/AttributeBindings.js#L542-L553
train
mesmotronic/conbo
src/conbo/binding/AttributeBindings.js
function(el, validator) { var validateFunction; switch (true) { case conbo.isFunction(validator): { validateFunction = validator; break; } case conbo.isString(validator): { validator = new RegExp(validator); } case conbo.isRegExp(validator): { ...
javascript
function(el, validator) { var validateFunction; switch (true) { case conbo.isFunction(validator): { validateFunction = validator; break; } case conbo.isString(validator): { validator = new RegExp(validator); } case conbo.isRegExp(validator): { ...
[ "function", "(", "el", ",", "validator", ")", "{", "var", "validateFunction", ";", "switch", "(", "true", ")", "{", "case", "conbo", ".", "isFunction", "(", "validator", ")", ":", "{", "validateFunction", "=", "validator", ";", "break", ";", "}", "case",...
Use a method or regex to validate a form element and apply a cb-valid or cb-invalid CSS class based on the outcome @param {HTMLElement} el - DOM element to which the attribute applies @param {Function} validator - The function referenced by the attribute @returns {void} @example <div cb-validate="functionName"...
[ "Use", "a", "method", "or", "regex", "to", "validate", "a", "form", "element", "and", "apply", "a", "cb", "-", "valid", "or", "cb", "-", "invalid", "CSS", "class", "based", "on", "the", "outcome" ]
339df613eefc48e054e115337079573ad842f717
https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/src/conbo/binding/AttributeBindings.js#L612-L716
train
mesmotronic/conbo
src/conbo/binding/AttributeBindings.js
function(el, value) { // TODO Restrict to text input fields? if (el.cbRestrict) { el.removeEventListener('keypress', el.cbRestrict); } el.cbRestrict = function(event) { if (event.ctrlKey) { return; } var code = event.keyCode || event.which; var char = event....
javascript
function(el, value) { // TODO Restrict to text input fields? if (el.cbRestrict) { el.removeEventListener('keypress', el.cbRestrict); } el.cbRestrict = function(event) { if (event.ctrlKey) { return; } var code = event.keyCode || event.which; var char = event....
[ "function", "(", "el", ",", "value", ")", "{", "// TODO Restrict to text input fields?\r", "if", "(", "el", ".", "cbRestrict", ")", "{", "el", ".", "removeEventListener", "(", "'keypress'", ",", "el", ".", "cbRestrict", ")", ";", "}", "el", ".", "cbRestrict"...
Restricts text input to the specified characters @param {HTMLElement} el - DOM element to which the attribute applies @param {string} value - The value referenced by the attribute @returns {void} @example <div cb-restrict="propertyName"></div>
[ "Restricts", "text", "input", "to", "the", "specified", "characters" ]
339df613eefc48e054e115337079573ad842f717
https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/src/conbo/binding/AttributeBindings.js#L728-L760
train
mesmotronic/conbo
src/conbo/binding/AttributeBindings.js
function(el, value) { // TODO Restrict to text input fields? if (el.cbMaxChars) { el.removeEventListener('keypress', el.cbMaxChars); } el.cbMaxChars = function(event) { if ((el.value || el.innerHTML).length >= value) { event.preventDefault(); } }; el.addEventLi...
javascript
function(el, value) { // TODO Restrict to text input fields? if (el.cbMaxChars) { el.removeEventListener('keypress', el.cbMaxChars); } el.cbMaxChars = function(event) { if ((el.value || el.innerHTML).length >= value) { event.preventDefault(); } }; el.addEventLi...
[ "function", "(", "el", ",", "value", ")", "{", "// TODO Restrict to text input fields?\r", "if", "(", "el", ".", "cbMaxChars", ")", "{", "el", ".", "removeEventListener", "(", "'keypress'", ",", "el", ".", "cbMaxChars", ")", ";", "}", "el", ".", "cbMaxChars"...
Limits the number of characters that can be entered into input and other form fields @param {HTMLElement} el - DOM element to which the attribute applies @param {string} value - The value referenced by the attribute @returns {void} @example <div cb-max-chars="propertyName"></div>
[ "Limits", "the", "number", "of", "characters", "that", "can", "be", "entered", "into", "input", "and", "other", "form", "fields" ]
339df613eefc48e054e115337079573ad842f717
https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/src/conbo/binding/AttributeBindings.js#L773-L791
train
unshiftio/strategy
index.js
Policy
function Policy(name, Transport, options) { var policy = this; if ('string' !== typeof name) { options = Transport; Transport = name; name = undefined; } if ('function' !== typeof Transport) { throw new Error('Transport should be a constructor.'); } policy.name = (name || Transport.protot...
javascript
function Policy(name, Transport, options) { var policy = this; if ('string' !== typeof name) { options = Transport; Transport = name; name = undefined; } if ('function' !== typeof Transport) { throw new Error('Transport should be a constructor.'); } policy.name = (name || Transport.protot...
[ "function", "Policy", "(", "name", ",", "Transport", ",", "options", ")", "{", "var", "policy", "=", "this", ";", "if", "(", "'string'", "!==", "typeof", "name", ")", "{", "options", "=", "Transport", ";", "Transport", "=", "name", ";", "name", "=", ...
Representation of one single transport policy. @constructor @param {String} name Name of the policy @param {TransportLayer} Transport Constructor of a TransportLayer. @param {Object} options Options for the transport & strategy instructions. @api public
[ "Representation", "of", "one", "single", "transport", "policy", "." ]
61cda48f08c6479593caf5ea5675d5b8fd4b8c3c
https://github.com/unshiftio/strategy/blob/61cda48f08c6479593caf5ea5675d5b8fd4b8c3c/index.js#L12-L29
train
unshiftio/strategy
index.js
Strategy
function Strategy(transports, options) { var strategy = this; if (!(strategy instanceof Strategy)) return new Strategy(transports, options); if (Object.prototype.toString.call(transports) !== '[object Array]') { options = transports; transports = []; } strategy.transports = []; // List of active...
javascript
function Strategy(transports, options) { var strategy = this; if (!(strategy instanceof Strategy)) return new Strategy(transports, options); if (Object.prototype.toString.call(transports) !== '[object Array]') { options = transports; transports = []; } strategy.transports = []; // List of active...
[ "function", "Strategy", "(", "transports", ",", "options", ")", "{", "var", "strategy", "=", "this", ";", "if", "(", "!", "(", "strategy", "instanceof", "Strategy", ")", ")", "return", "new", "Strategy", "(", "transports", ",", "options", ")", ";", "if",...
Transport selection strategy. @constructor @param {Array} transports Array of transports that should be added. @param {Object} options Optional configuration. @api public
[ "Transport", "selection", "strategy", "." ]
61cda48f08c6479593caf5ea5675d5b8fd4b8c3c
https://github.com/unshiftio/strategy/blob/61cda48f08c6479593caf5ea5675d5b8fd4b8c3c/index.js#L39-L56
train
noderaider/react-load
lib/components/createSpinner.js
Segment
function Segment(props) { var segmentStyle = props.segmentStyle; var fillStyle = props.fillStyle; var commonStyle = { position: 'absolute' }; return React.createElement( 'div', { style: _extends({}, commonStyle, segmentStyle) }, React.createElement('div', { style: _extends({}, commonS...
javascript
function Segment(props) { var segmentStyle = props.segmentStyle; var fillStyle = props.fillStyle; var commonStyle = { position: 'absolute' }; return React.createElement( 'div', { style: _extends({}, commonStyle, segmentStyle) }, React.createElement('div', { style: _extends({}, commonS...
[ "function", "Segment", "(", "props", ")", "{", "var", "segmentStyle", "=", "props", ".", "segmentStyle", ";", "var", "fillStyle", "=", "props", ".", "fillStyle", ";", "var", "commonStyle", "=", "{", "position", ":", "'absolute'", "}", ";", "return", "React...
React component for segments
[ "React", "component", "for", "segments" ]
70c4b42202c108aea99b1186e2a9f672dd10b26f
https://github.com/noderaider/react-load/blob/70c4b42202c108aea99b1186e2a9f672dd10b26f/lib/components/createSpinner.js#L75-L85
train
rasouli100/twimap
examples/thanker.js
load_followers_priodically
function load_followers_priodically() { try{ twimap.followersAsync(last_check, function(result) { if(typeof result != "undefined" && result.length >=1){ //save it in our variable _followers_list = result; last_check = now(); msg_followers_thanks(); } },function (err){ ...
javascript
function load_followers_priodically() { try{ twimap.followersAsync(last_check, function(result) { if(typeof result != "undefined" && result.length >=1){ //save it in our variable _followers_list = result; last_check = now(); msg_followers_thanks(); } },function (err){ ...
[ "function", "load_followers_priodically", "(", ")", "{", "try", "{", "twimap", ".", "followersAsync", "(", "last_check", ",", "function", "(", "result", ")", "{", "if", "(", "typeof", "result", "!=", "\"undefined\"", "&&", "result", ".", "length", ">=", "1",...
call this function periodically to get new followers callback is called when new information is available
[ "call", "this", "function", "periodically", "to", "get", "new", "followers", "callback", "is", "called", "when", "new", "information", "is", "available" ]
90a93fda604ab3af6b25bddcfe3dd71dc19ac1f7
https://github.com/rasouli100/twimap/blob/90a93fda604ab3af6b25bddcfe3dd71dc19ac1f7/examples/thanker.js#L40-L63
train
rasouli100/twimap
examples/thanker.js
msg_followers_thanks
function msg_followers_thanks(){ //move cursor _current_index++; //if there is no followers OR finished messaging followers stop if(_current_index >= _followers_list.length ){ _current_index = -1; _followe_list = null; return; } //otherwise get user name from twitter twit_cli.get("users/show",{scree...
javascript
function msg_followers_thanks(){ //move cursor _current_index++; //if there is no followers OR finished messaging followers stop if(_current_index >= _followers_list.length ){ _current_index = -1; _followe_list = null; return; } //otherwise get user name from twitter twit_cli.get("users/show",{scree...
[ "function", "msg_followers_thanks", "(", ")", "{", "//move cursor", "_current_index", "++", ";", "//if there is no followers OR finished messaging followers stop", "if", "(", "_current_index", ">=", "_followers_list", ".", "length", ")", "{", "_current_index", "=", "-", "...
this function iterates through followers listed in variable _followers_list
[ "this", "function", "iterates", "through", "followers", "listed", "in", "variable", "_followers_list" ]
90a93fda604ab3af6b25bddcfe3dd71dc19ac1f7
https://github.com/rasouli100/twimap/blob/90a93fda604ab3af6b25bddcfe3dd71dc19ac1f7/examples/thanker.js#L69-L96
train
rasouli100/twimap
examples/thanker.js
filter_name
function filter_name(name){ if ( typeof name == "undefined" || name=="" || name==null) name = "my friend"; if(name.length > 40 ) name = name.substr(0,40); return name; }
javascript
function filter_name(name){ if ( typeof name == "undefined" || name=="" || name==null) name = "my friend"; if(name.length > 40 ) name = name.substr(0,40); return name; }
[ "function", "filter_name", "(", "name", ")", "{", "if", "(", "typeof", "name", "==", "\"undefined\"", "||", "name", "==", "\"\"", "||", "name", "==", "null", ")", "name", "=", "\"my friend\"", ";", "if", "(", "name", ".", "length", ">", "40", ")", "n...
cut names bigger that 40 characters
[ "cut", "names", "bigger", "that", "40", "characters" ]
90a93fda604ab3af6b25bddcfe3dd71dc19ac1f7
https://github.com/rasouli100/twimap/blob/90a93fda604ab3af6b25bddcfe3dd71dc19ac1f7/examples/thanker.js#L99-L103
train
rasouli100/twimap
examples/thanker.js
random_msg
function random_msg(name){ name = filter_name(name); return util.format(thanks_temp[Math.floor(Math.random()*10)%(thanks_temp.length-1)] , name); }
javascript
function random_msg(name){ name = filter_name(name); return util.format(thanks_temp[Math.floor(Math.random()*10)%(thanks_temp.length-1)] , name); }
[ "function", "random_msg", "(", "name", ")", "{", "name", "=", "filter_name", "(", "name", ")", ";", "return", "util", ".", "format", "(", "thanks_temp", "[", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", "10", ")", "%", "(", "tha...
generate a random message
[ "generate", "a", "random", "message" ]
90a93fda604ab3af6b25bddcfe3dd71dc19ac1f7
https://github.com/rasouli100/twimap/blob/90a93fda604ab3af6b25bddcfe3dd71dc19ac1f7/examples/thanker.js#L107-L110
train
DynoSRC/dynosrc
lib/patchit.js
function(next) { var source = config.getSource(asset.source); async.parallel([ getFromSource.bind(null, source, asset, fromVersion, config), getFromSource.bind(null, source, asset, toVersion, config) ], next); }
javascript
function(next) { var source = config.getSource(asset.source); async.parallel([ getFromSource.bind(null, source, asset, fromVersion, config), getFromSource.bind(null, source, asset, toVersion, config) ], next); }
[ "function", "(", "next", ")", "{", "var", "source", "=", "config", ".", "getSource", "(", "asset", ".", "source", ")", ";", "async", ".", "parallel", "(", "[", "getFromSource", ".", "bind", "(", "null", ",", "source", ",", "asset", ",", "fromVersion", ...
get the source files to compare
[ "get", "the", "source", "files", "to", "compare" ]
1a763c9310b719a51b0df56387970ecd3f08c438
https://github.com/DynoSRC/dynosrc/blob/1a763c9310b719a51b0df56387970ecd3f08c438/lib/patchit.js#L183-L190
train
DynoSRC/dynosrc
lib/patchit.js
function(files, next) { var fromFile = files[0], toFile = files[1]; differ(id, fromFile, toFile, next); }
javascript
function(files, next) { var fromFile = files[0], toFile = files[1]; differ(id, fromFile, toFile, next); }
[ "function", "(", "files", ",", "next", ")", "{", "var", "fromFile", "=", "files", "[", "0", "]", ",", "toFile", "=", "files", "[", "1", "]", ";", "differ", "(", "id", ",", "fromFile", ",", "toFile", ",", "next", ")", ";", "}" ]
generate the patch
[ "generate", "the", "patch" ]
1a763c9310b719a51b0df56387970ecd3f08c438
https://github.com/DynoSRC/dynosrc/blob/1a763c9310b719a51b0df56387970ecd3f08c438/lib/patchit.js#L192-L197
train
DynoSRC/dynosrc
lib/patchit.js
function(patch, next) { var patchObj = toPatchObject(id, fromVersion, toVersion, patch); //cache it cacheCb(patchObj); next(null, patchObj); }
javascript
function(patch, next) { var patchObj = toPatchObject(id, fromVersion, toVersion, patch); //cache it cacheCb(patchObj); next(null, patchObj); }
[ "function", "(", "patch", ",", "next", ")", "{", "var", "patchObj", "=", "toPatchObject", "(", "id", ",", "fromVersion", ",", "toVersion", ",", "patch", ")", ";", "//cache it", "cacheCb", "(", "patchObj", ")", ";", "next", "(", "null", ",", "patchObj", ...
output in structured format
[ "output", "in", "structured", "format" ]
1a763c9310b719a51b0df56387970ecd3f08c438
https://github.com/DynoSRC/dynosrc/blob/1a763c9310b719a51b0df56387970ecd3f08c438/lib/patchit.js#L199-L204
train
borela/themeable
src/__mocks__/data.js
combinedData
function combinedData(flairs, presenters) { let result = [] for (let [ flairPattern, normalizedFlair ] of flairs) { for (let [ presenterPattern, presenter ] of presenters) result.push([ `${flairPattern}!${presenterPattern}`, normalizedFlair, presenter ]) } return result }
javascript
function combinedData(flairs, presenters) { let result = [] for (let [ flairPattern, normalizedFlair ] of flairs) { for (let [ presenterPattern, presenter ] of presenters) result.push([ `${flairPattern}!${presenterPattern}`, normalizedFlair, presenter ]) } return result }
[ "function", "combinedData", "(", "flairs", ",", "presenters", ")", "{", "let", "result", "=", "[", "]", "for", "(", "let", "[", "flairPattern", ",", "normalizedFlair", "]", "of", "flairs", ")", "{", "for", "(", "let", "[", "presenterPattern", ",", "prese...
Generate a dataset combining the flairs and presenters patterns.
[ "Generate", "a", "dataset", "combining", "the", "flairs", "and", "presenters", "patterns", "." ]
728b1216a925210687e4dd6f0c73f7ff5c795224
https://github.com/borela/themeable/blob/728b1216a925210687e4dd6f0c73f7ff5c795224/src/__mocks__/data.js#L44-L51
train
borela/themeable
src/__mocks__/data.js
joinFlairs
function joinFlairs(data) { let result = [] for (let [ targetStringArray, ...rest ] of data) { // Raw flair containing only one flair don’t need to be modified. if (targetStringArray.length < 2) { result.push([ targetStringArray, ...rest ]) continue } // Concatenate the flairs using one,...
javascript
function joinFlairs(data) { let result = [] for (let [ targetStringArray, ...rest ] of data) { // Raw flair containing only one flair don’t need to be modified. if (targetStringArray.length < 2) { result.push([ targetStringArray, ...rest ]) continue } // Concatenate the flairs using one,...
[ "function", "joinFlairs", "(", "data", ")", "{", "let", "result", "=", "[", "]", "for", "(", "let", "[", "targetStringArray", ",", "...", "rest", "]", "of", "data", ")", "{", "// Raw flair containing only one flair don’t need to be modified.", "if", "(", "target...
Used to join the raw flairs and generate the full data set.
[ "Used", "to", "join", "the", "raw", "flairs", "and", "generate", "the", "full", "data", "set", "." ]
728b1216a925210687e4dd6f0c73f7ff5c795224
https://github.com/borela/themeable/blob/728b1216a925210687e4dd6f0c73f7ff5c795224/src/__mocks__/data.js#L54-L69
train
borela/themeable
src/__mocks__/data.js
padData
function padData(data) { let result = [] for (let [ targetString, ...rest ] of data) { // We are testing for up to 3 spaces and for empty strings we’ll use this // condition to prevent duplicates. if (targetString === '') { result.push([ ' ', ...rest ]) result.push([ ' ', ...rest ]) r...
javascript
function padData(data) { let result = [] for (let [ targetString, ...rest ] of data) { // We are testing for up to 3 spaces and for empty strings we’ll use this // condition to prevent duplicates. if (targetString === '') { result.push([ ' ', ...rest ]) result.push([ ' ', ...rest ]) r...
[ "function", "padData", "(", "data", ")", "{", "let", "result", "=", "[", "]", "for", "(", "let", "[", "targetString", ",", "...", "rest", "]", "of", "data", ")", "{", "// We are testing for up to 3 spaces and for empty strings we’ll use this", "// condition to preve...
Used to add spaces around the pattern.
[ "Used", "to", "add", "spaces", "around", "the", "pattern", "." ]
728b1216a925210687e4dd6f0c73f7ff5c795224
https://github.com/borela/themeable/blob/728b1216a925210687e4dd6f0c73f7ff5c795224/src/__mocks__/data.js#L72-L93
train
nodejitsu/contour
pagelets/footer.js
column
function column(options) { return this.navigation.slice(0, 5).reduce(function reduce(columns, section) { return columns + options.fn(section); }, ''); }
javascript
function column(options) { return this.navigation.slice(0, 5).reduce(function reduce(columns, section) { return columns + options.fn(section); }, ''); }
[ "function", "column", "(", "options", ")", "{", "return", "this", ".", "navigation", ".", "slice", "(", "0", ",", "5", ")", ".", "reduce", "(", "function", "reduce", "(", "columns", ",", "section", ")", "{", "return", "columns", "+", "options", ".", ...
Show the first five columns as footer sections. @param {Object} options @returns {String} rendered content @api public
[ "Show", "the", "first", "five", "columns", "as", "footer", "sections", "." ]
0828e9bd25ef1eeb97ea231c447118d9867021b6
https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/footer.js#L66-L70
train
nodejitsu/contour
pagelets/creditcard.js
month
function month(options) { var content = '' , m = this.month; while(++m <= 12) { content += options.fn({ month: m, selected: +this.expiration_month === m ? ' selected' : '', fullMonth: this.months[m - 1] }); } return content; }
javascript
function month(options) { var content = '' , m = this.month; while(++m <= 12) { content += options.fn({ month: m, selected: +this.expiration_month === m ? ' selected' : '', fullMonth: this.months[m - 1] }); } return content; }
[ "function", "month", "(", "options", ")", "{", "var", "content", "=", "''", ",", "m", "=", "this", ".", "month", ";", "while", "(", "++", "m", "<=", "12", ")", "{", "content", "+=", "options", ".", "fn", "(", "{", "month", ":", "m", ",", "selec...
Handblebar helper to generate month dropdown select options. @param {Object} options @return {String} generated template @api private
[ "Handblebar", "helper", "to", "generate", "month", "dropdown", "select", "options", "." ]
0828e9bd25ef1eeb97ea231c447118d9867021b6
https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/creditcard.js#L46-L59
train
nodejitsu/contour
pagelets/creditcard.js
year
function year(options) { var content = '' , y = this.year; while(++y < this.max_year) { content += options.fn({ year: y, selected: +this.expiration_year === y ? ' selected' : '', }); } return content; }
javascript
function year(options) { var content = '' , y = this.year; while(++y < this.max_year) { content += options.fn({ year: y, selected: +this.expiration_year === y ? ' selected' : '', }); } return content; }
[ "function", "year", "(", "options", ")", "{", "var", "content", "=", "''", ",", "y", "=", "this", ".", "year", ";", "while", "(", "++", "y", "<", "this", ".", "max_year", ")", "{", "content", "+=", "options", ".", "fn", "(", "{", "year", ":", "...
Handblebar helper to generate year dropdown select options. @param {Object} options @return {String} generated template @api private
[ "Handblebar", "helper", "to", "generate", "year", "dropdown", "select", "options", "." ]
0828e9bd25ef1eeb97ea231c447118d9867021b6
https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/creditcard.js#L68-L80
train
opensoars/f_
lib/getConstructor/index.js
f_Constructor
function f_Constructor(ins_o) { var self = this; // Sanitize instance options if (!ins_o || typeof ins_o !== 'object') { ins_o = {}; } if (!ins_o.custom_data || typeof ins_o.custom_data !== 'object') { ins_o.custom_data = {}; } // Apply instance modules and properties for (...
javascript
function f_Constructor(ins_o) { var self = this; // Sanitize instance options if (!ins_o || typeof ins_o !== 'object') { ins_o = {}; } if (!ins_o.custom_data || typeof ins_o.custom_data !== 'object') { ins_o.custom_data = {}; } // Apply instance modules and properties for (...
[ "function", "f_Constructor", "(", "ins_o", ")", "{", "var", "self", "=", "this", ";", "// Sanitize instance options", "if", "(", "!", "ins_o", "||", "typeof", "ins_o", "!==", "'object'", ")", "{", "ins_o", "=", "{", "}", ";", "}", "if", "(", "!", "ins_...
The constructor returned when getConstructor is called. @TODO Module this, split split! @constructor @param {object} ins_o - Instance options @example new f_Constructor({ a: 'b' }) // { a: 'b' }
[ "The", "constructor", "returned", "when", "getConstructor", "is", "called", "." ]
d96545de56d41db3d978dffd81b179f3ad5a62a6
https://github.com/opensoars/f_/blob/d96545de56d41db3d978dffd81b179f3ad5a62a6/lib/getConstructor/index.js#L40-L95
train
odogono/elsinore-js
src/query/limit.js
compile
function compile(context, commands) { let ii, cmd, limitOptions; // log.debug('limit: in-compile cmds:', commands); // look for the limit commands within the commands for (ii = commands.length - 1; ii >= 0; ii--) { cmd = commands[ii]; if (cmd[0] === LIMIT) { // cmdLimit = c...
javascript
function compile(context, commands) { let ii, cmd, limitOptions; // log.debug('limit: in-compile cmds:', commands); // look for the limit commands within the commands for (ii = commands.length - 1; ii >= 0; ii--) { cmd = commands[ii]; if (cmd[0] === LIMIT) { // cmdLimit = c...
[ "function", "compile", "(", "context", ",", "commands", ")", "{", "let", "ii", ",", "cmd", ",", "limitOptions", ";", "// log.debug('limit: in-compile cmds:', commands);", "// look for the limit commands within the commands", "for", "(", "ii", "=", "commands", ".", "leng...
Compilation involves altering the previous entityfilter so that it receives the limit arguments
[ "Compilation", "involves", "altering", "the", "previous", "entityfilter", "so", "that", "it", "receives", "the", "limit", "arguments" ]
1ecce67ad0022646419a740def029b1ba92dd558
https://github.com/odogono/elsinore-js/blob/1ecce67ad0022646419a740def029b1ba92dd558/src/query/limit.js#L59-L89
train
bminer/stride
stride.js
emitDone
function emitDone(rawArgs) { if(EventEmitter.listenerCount(emitter, "done") > 0) { var args = new Array(rawArgs.length + 1); args[0] = "done"; for(var i = 0; i < rawArgs.length; i++) args[i + 1] = rawArgs[i]; process.nextTick(function() { emitter.emit.apply(emitter, args); }); } }
javascript
function emitDone(rawArgs) { if(EventEmitter.listenerCount(emitter, "done") > 0) { var args = new Array(rawArgs.length + 1); args[0] = "done"; for(var i = 0; i < rawArgs.length; i++) args[i + 1] = rawArgs[i]; process.nextTick(function() { emitter.emit.apply(emitter, args); }); } }
[ "function", "emitDone", "(", "rawArgs", ")", "{", "if", "(", "EventEmitter", ".", "listenerCount", "(", "emitter", ",", "\"done\"", ")", ">", "0", ")", "{", "var", "args", "=", "new", "Array", "(", "rawArgs", ".", "length", "+", "1", ")", ";", "args"...
Add function to the end to emit "done" event
[ "Add", "function", "to", "the", "end", "to", "emit", "done", "event" ]
62ba73ba09595e452563f59c77473fc33204880b
https://github.com/bminer/stride/blob/62ba73ba09595e452563f59c77473fc33204880b/stride.js#L270-L280
train
onecommons/base
lib/errorhandler.js
errorHandler
function errorHandler(err, req, res, next){ if (!req.suppressErrorHandlerConsole && !req.app.suppressErrorHandlerConsole) { if (req.log) { req.log.error(err, "Unhandled Error"); } else { console.log("Unhandled error"); console.log(err.stack || err); } } if (err.status) res.statusCode...
javascript
function errorHandler(err, req, res, next){ if (!req.suppressErrorHandlerConsole && !req.app.suppressErrorHandlerConsole) { if (req.log) { req.log.error(err, "Unhandled Error"); } else { console.log("Unhandled error"); console.log(err.stack || err); } } if (err.status) res.statusCode...
[ "function", "errorHandler", "(", "err", ",", "req", ",", "res", ",", "next", ")", "{", "if", "(", "!", "req", ".", "suppressErrorHandlerConsole", "&&", "!", "req", ".", "app", ".", "suppressErrorHandlerConsole", ")", "{", "if", "(", "req", ".", "log", ...
derived from "errorhandler" package
[ "derived", "from", "errorhandler", "package" ]
4f35d9f714d0367b0622a3504802363404290246
https://github.com/onecommons/base/blob/4f35d9f714d0367b0622a3504802363404290246/lib/errorhandler.js#L4-L36
train
vid/SenseBase
index.js
setup
function setup(context) { if (GLOBAL.config) { console.log('already configured'); console.trace(); return; } if (!context) { context = require('./config.js'); } GLOBAL.config = context.config; var svc = { pubsub: pubsub, auth: auth, indexer: indexer, pageCache: pageCache }; GLOBAL.svc =...
javascript
function setup(context) { if (GLOBAL.config) { console.log('already configured'); console.trace(); return; } if (!context) { context = require('./config.js'); } GLOBAL.config = context.config; var svc = { pubsub: pubsub, auth: auth, indexer: indexer, pageCache: pageCache }; GLOBAL.svc =...
[ "function", "setup", "(", "context", ")", "{", "if", "(", "GLOBAL", ".", "config", ")", "{", "console", ".", "log", "(", "'already configured'", ")", ";", "console", ".", "trace", "(", ")", ";", "return", ";", "}", "if", "(", "!", "context", ")", "...
Set up the GLOBAL environment with configuration and services Defaults to directory config and users if no context is passed. pubsub will need to be started on its own.
[ "Set", "up", "the", "GLOBAL", "environment", "with", "configuration", "and", "services", "Defaults", "to", "directory", "config", "and", "users", "if", "no", "context", "is", "passed", ".", "pubsub", "will", "need", "to", "be", "started", "on", "its", "own",...
d60bcf28239e7dde437d8a6bdae41a6921dcd05b
https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/index.js#L65-L81
train
pierrec/node-ekam
lib/include.js
setParents
function setParents () { var q = async.queue(processFile, 1) q.drain = function () { self.emit('drain') } // Process files with no dependency first self.nodeps.forEach( q.push ) function processFile (item, cb) { debug('dep:', item.id) // Add files with no dependency left to be processed self.deps ...
javascript
function setParents () { var q = async.queue(processFile, 1) q.drain = function () { self.emit('drain') } // Process files with no dependency first self.nodeps.forEach( q.push ) function processFile (item, cb) { debug('dep:', item.id) // Add files with no dependency left to be processed self.deps ...
[ "function", "setParents", "(", ")", "{", "var", "q", "=", "async", ".", "queue", "(", "processFile", ",", "1", ")", "q", ".", "drain", "=", "function", "(", ")", "{", "self", ".", "emit", "(", "'drain'", ")", "}", "// Process files with no dependency fir...
Once all files are loaded, set their parents
[ "Once", "all", "files", "are", "loaded", "set", "their", "parents" ]
fd36038231c4f49ecae36e25352138cba0ac11aa
https://github.com/pierrec/node-ekam/blob/fd36038231c4f49ecae36e25352138cba0ac11aa/lib/include.js#L71-L92
train
theworkers/W.js
build/W.node.js
bind
function bind( fn, scope ) { var bound, args; if ( fn.bind === nativeBind && nativeBind ) return nativeBind.apply( fn, Array.prototype.slice.call( arguments, 1 ) ); args = Array.prototype.slice.call( arguments, 2 ); // @todo: don't link this bound = function() { if ( !(this instanceof bound)...
javascript
function bind( fn, scope ) { var bound, args; if ( fn.bind === nativeBind && nativeBind ) return nativeBind.apply( fn, Array.prototype.slice.call( arguments, 1 ) ); args = Array.prototype.slice.call( arguments, 2 ); // @todo: don't link this bound = function() { if ( !(this instanceof bound)...
[ "function", "bind", "(", "fn", ",", "scope", ")", "{", "var", "bound", ",", "args", ";", "if", "(", "fn", ".", "bind", "===", "nativeBind", "&&", "nativeBind", ")", "return", "nativeBind", ".", "apply", "(", "fn", ",", "Array", ".", "prototype", ".",...
Bind function to scope. Useful for events. @param {Function} fn function @param {Object} scope Scope of the function to be executed in @example $("div").fadeIn(100, W.bind(this, this.transitionDidFinish));
[ "Bind", "function", "to", "scope", ".", "Useful", "for", "events", "." ]
25a11baf8edb27c306f2baf6438bed2faf935bc6
https://github.com/theworkers/W.js/blob/25a11baf8edb27c306f2baf6438bed2faf935bc6/build/W.node.js#L17-L31
train
theworkers/W.js
build/W.node.js
Route
function Route(method, path, callbacks, options) { options = options || {}; this.path = path; this.method = method; this.callbacks = callbacks; this.regexp = pathRegexp(path, this.keys = [], options.sensitive, options.strict); }
javascript
function Route(method, path, callbacks, options) { options = options || {}; this.path = path; this.method = method; this.callbacks = callbacks; this.regexp = pathRegexp(path, this.keys = [], options.sensitive, options.strict); }
[ "function", "Route", "(", "method", ",", "path", ",", "callbacks", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "this", ".", "path", "=", "path", ";", "this", ".", "method", "=", "method", ";", "this", ".", "callbacks", ...
Initialize `Route` with the given HTTP `method`, `path`, and an array of `callbacks` and `options`. Options: - `sensitive` enable case-sensitive routes - `strict` enable strict matching for trailing slashes @param {String} method @param {String} path @param {Array} callbacks @param {Object} options. @api pr...
[ "Initialize", "Route", "with", "the", "given", "HTTP", "method", "path", "and", "an", "array", "of", "callbacks", "and", "options", "." ]
25a11baf8edb27c306f2baf6438bed2faf935bc6
https://github.com/theworkers/W.js/blob/25a11baf8edb27c306f2baf6438bed2faf935bc6/build/W.node.js#L923-L929
train
theworkers/W.js
build/W.node.js
function () { if (this._intervalId) { clearInterval(this._intervalId); this._intervalId = undefined; this.trigger(this.options.stoppedEventName, this); return true; } return false; }
javascript
function () { if (this._intervalId) { clearInterval(this._intervalId); this._intervalId = undefined; this.trigger(this.options.stoppedEventName, this); return true; } return false; }
[ "function", "(", ")", "{", "if", "(", "this", ".", "_intervalId", ")", "{", "clearInterval", "(", "this", ".", "_intervalId", ")", ";", "this", ".", "_intervalId", "=", "undefined", ";", "this", ".", "trigger", "(", "this", ".", "options", ".", "stoppe...
Blackberry uses stop
[ "Blackberry", "uses", "stop" ]
25a11baf8edb27c306f2baf6438bed2faf935bc6
https://github.com/theworkers/W.js/blob/25a11baf8edb27c306f2baf6438bed2faf935bc6/build/W.node.js#L1132-L1140
train
vail-systems/node-signal-windows
src/framer.js
function(bufferOrArray, callback) { var self = this, ix = this.offset, frame = [], isArray = Object.prototype.toString.call( bufferOrArray) === '[object Array]'; self.frameIx = 0; while (ix < bufferOrArray.length) { var value = isArray ? bufferOrArray[ix] : bufferOrArray['rea...
javascript
function(bufferOrArray, callback) { var self = this, ix = this.offset, frame = [], isArray = Object.prototype.toString.call( bufferOrArray) === '[object Array]'; self.frameIx = 0; while (ix < bufferOrArray.length) { var value = isArray ? bufferOrArray[ix] : bufferOrArray['rea...
[ "function", "(", "bufferOrArray", ",", "callback", ")", "{", "var", "self", "=", "this", ",", "ix", "=", "this", ".", "offset", ",", "frame", "=", "[", "]", ",", "isArray", "=", "Object", ".", "prototype", ".", "toString", ".", "call", "(", "bufferOr...
Frames a buffer of single-byte char values or an array of Numbers into windows of the specified size.
[ "Frames", "a", "buffer", "of", "single", "-", "byte", "char", "values", "or", "an", "array", "of", "Numbers", "into", "windows", "of", "the", "specified", "size", "." ]
b6ad09e6a735b69cbe5ed4e6def4b1d00e1d7256
https://github.com/vail-systems/node-signal-windows/blob/b6ad09e6a735b69cbe5ed4e6def4b1d00e1d7256/src/framer.js#L24-L58
train
yawetse/bindie
lib/bindie.js
function (options) { events.EventEmitter.call(this); var defaultOptions = { ejsdelimiter: '?', strictbinding:false }; this.options = extend(defaultOptions, options); ejs.delimiter = this.options.ejsdelimiter; this.binders = {}; this.update = this._update; this.render = this._render; this.addBinder = this...
javascript
function (options) { events.EventEmitter.call(this); var defaultOptions = { ejsdelimiter: '?', strictbinding:false }; this.options = extend(defaultOptions, options); ejs.delimiter = this.options.ejsdelimiter; this.binders = {}; this.update = this._update; this.render = this._render; this.addBinder = this...
[ "function", "(", "options", ")", "{", "events", ".", "EventEmitter", ".", "call", "(", "this", ")", ";", "var", "defaultOptions", "=", "{", "ejsdelimiter", ":", "'?'", ",", "strictbinding", ":", "false", "}", ";", "this", ".", "options", "=", "extend", ...
A module that represents a bindie object, a componentTab is a page composition tool. @{@link https://github.com/typesettin/bindie} @author Yaw Joseph Etse @copyright Copyright (c) 2014 Typesettin. All rights reserved. @license MIT @constructor bindie @requires module:ejs @requires module:events @requires module:util-ex...
[ "A", "module", "that", "represents", "a", "bindie", "object", "a", "componentTab", "is", "a", "page", "composition", "tool", "." ]
83173e654e210953636fa86d1b7a3b1b6a92f2ed
https://github.com/yawetse/bindie/blob/83173e654e210953636fa86d1b7a3b1b6a92f2ed/lib/bindie.js#L28-L42
train
Stitchuuuu/thread-promisify
util.js
copyArguments
function copyArguments(args) { var copy = []; for (var i = 0; i < args.length; i++) { copy.push(args[i]); } return copy; }
javascript
function copyArguments(args) { var copy = []; for (var i = 0; i < args.length; i++) { copy.push(args[i]); } return copy; }
[ "function", "copyArguments", "(", "args", ")", "{", "var", "copy", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "copy", ".", "push", "(", "args", "[", "i", "]", ")", "...
Copy arguments in a clean classic array
[ "Copy", "arguments", "in", "a", "clean", "classic", "array" ]
5c6fc0b481520049e2078461693ceee7c27ddd53
https://github.com/Stitchuuuu/thread-promisify/blob/5c6fc0b481520049e2078461693ceee7c27ddd53/util.js#L98-L104
train
Stitchuuuu/thread-promisify
util.js
executeSerializedFunction
function executeSerializedFunction(id, args) { SerializedFunctions.forEach(function(sf) { if (sf.id == id) { sf.func.apply(null, args); } }); }
javascript
function executeSerializedFunction(id, args) { SerializedFunctions.forEach(function(sf) { if (sf.id == id) { sf.func.apply(null, args); } }); }
[ "function", "executeSerializedFunction", "(", "id", ",", "args", ")", "{", "SerializedFunctions", ".", "forEach", "(", "function", "(", "sf", ")", "{", "if", "(", "sf", ".", "id", "==", "id", ")", "{", "sf", ".", "func", ".", "apply", "(", "null", ",...
Execute a serialized function with an id Those are for progress functions, don't use Promise it will not be checked
[ "Execute", "a", "serialized", "function", "with", "an", "id", "Those", "are", "for", "progress", "functions", "don", "t", "use", "Promise", "it", "will", "not", "be", "checked" ]
5c6fc0b481520049e2078461693ceee7c27ddd53
https://github.com/Stitchuuuu/thread-promisify/blob/5c6fc0b481520049e2078461693ceee7c27ddd53/util.js#L110-L116
train
socialally/air
lib/air/hidden.js
hidden
function hidden(val) { // return whether the first element in the set // is hidden if(val === undefined) { return this.attr(attr); // hide on truthy }else if(val) { this.attr(attr, '1'); // show on falsey }else{ this.attr(attr, null); } return this; }
javascript
function hidden(val) { // return whether the first element in the set // is hidden if(val === undefined) { return this.attr(attr); // hide on truthy }else if(val) { this.attr(attr, '1'); // show on falsey }else{ this.attr(attr, null); } return this; }
[ "function", "hidden", "(", "val", ")", "{", "// return whether the first element in the set", "// is hidden", "if", "(", "val", "===", "undefined", ")", "{", "return", "this", ".", "attr", "(", "attr", ")", ";", "// hide on truthy", "}", "else", "if", "(", "va...
Modify the hidden attribute.
[ "Modify", "the", "hidden", "attribute", "." ]
a3d94de58aaa4930a425fbcc7266764bf6ca8ca6
https://github.com/socialally/air/blob/a3d94de58aaa4930a425fbcc7266764bf6ca8ca6/lib/air/hidden.js#L6-L19
train
nodejitsu/contour
pagelets/nodejitsu/tooltip/base.js
function (element) { var left = 0 , top = 0; do { left += element.offsetLeft; top += element.offsetTop; } while (element = element.offsetParent); return { left: left, top: top }; }
javascript
function (element) { var left = 0 , top = 0; do { left += element.offsetLeft; top += element.offsetTop; } while (element = element.offsetParent); return { left: left, top: top }; }
[ "function", "(", "element", ")", "{", "var", "left", "=", "0", ",", "top", "=", "0", ";", "do", "{", "left", "+=", "element", ".", "offsetLeft", ";", "top", "+=", "element", ".", "offsetTop", ";", "}", "while", "(", "element", "=", "element", ".", ...
Calculate the position of the current element that acted as trigger. Used for proper position of the tooltip. @param {Object} element @return {Object} offsets top and left @api private
[ "Calculate", "the", "position", "of", "the", "current", "element", "that", "acted", "as", "trigger", ".", "Used", "for", "proper", "position", "of", "the", "tooltip", "." ]
0828e9bd25ef1eeb97ea231c447118d9867021b6
https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/nodejitsu/tooltip/base.js#L70-L83
train
nodejitsu/contour
pagelets/nodejitsu/tooltip/base.js
trigger
function trigger(event, target) { target = target || event.type; if (target === 'mouseout') target = 'mouseover'; return target === $(event.element).get('data-trigger'); }
javascript
function trigger(event, target) { target = target || event.type; if (target === 'mouseout') target = 'mouseover'; return target === $(event.element).get('data-trigger'); }
[ "function", "trigger", "(", "event", ",", "target", ")", "{", "target", "=", "target", "||", "event", ".", "type", ";", "if", "(", "target", "===", "'mouseout'", ")", "target", "=", "'mouseover'", ";", "return", "target", "===", "$", "(", "event", ".",...
Should this event trigger the tooltip? @param {Event} event @param {String} target compare to type of target @returns {Boolean} @api private
[ "Should", "this", "event", "trigger", "the", "tooltip?" ]
0828e9bd25ef1eeb97ea231c447118d9867021b6
https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/nodejitsu/tooltip/base.js#L93-L98
train
nodejitsu/contour
pagelets/nodejitsu/tooltip/base.js
create
function create(event) { if (!this.trigger(event)) return; if ('preventDefault' in event) event.preventDefault(); if (this.trigger(event, 'click') && this.remove(event)) return; // // Create a new tooltip, but make sure to destroy remaining ones before. // this.timer = setTimeout(function e...
javascript
function create(event) { if (!this.trigger(event)) return; if ('preventDefault' in event) event.preventDefault(); if (this.trigger(event, 'click') && this.remove(event)) return; // // Create a new tooltip, but make sure to destroy remaining ones before. // this.timer = setTimeout(function e...
[ "function", "create", "(", "event", ")", "{", "if", "(", "!", "this", ".", "trigger", "(", "event", ")", ")", "return", ";", "if", "(", "'preventDefault'", "in", "event", ")", "event", ".", "preventDefault", "(", ")", ";", "if", "(", "this", ".", "...
Trigger rendering of the tooltip after a slight delay, less twitchy more user friendly. @param {Event} event @api public
[ "Trigger", "rendering", "of", "the", "tooltip", "after", "a", "slight", "delay", "less", "twitchy", "more", "user", "friendly", "." ]
0828e9bd25ef1eeb97ea231c447118d9867021b6
https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/nodejitsu/tooltip/base.js#L107-L118
train
nodejitsu/contour
pagelets/nodejitsu/tooltip/base.js
remove
function remove(event) { // // Current event is not set as trigger (e.g. mouse click vs. hover). // if (!this.trigger(event)) return false; if ('preventDefault' in event) event.preventDefault(); clearTimeout(this.timer); var id = document.getElementById('tooltip'); return id ? !!documen...
javascript
function remove(event) { // // Current event is not set as trigger (e.g. mouse click vs. hover). // if (!this.trigger(event)) return false; if ('preventDefault' in event) event.preventDefault(); clearTimeout(this.timer); var id = document.getElementById('tooltip'); return id ? !!documen...
[ "function", "remove", "(", "event", ")", "{", "//", "// Current event is not set as trigger (e.g. mouse click vs. hover).", "//", "if", "(", "!", "this", ".", "trigger", "(", "event", ")", ")", "return", "false", ";", "if", "(", "'preventDefault'", "in", "event", ...
Remove the tooltip, can only be triggered if it actually exists. @returns {Boolean} was tooltip removed or not @api public
[ "Remove", "the", "tooltip", "can", "only", "be", "triggered", "if", "it", "actually", "exists", "." ]
0828e9bd25ef1eeb97ea231c447118d9867021b6
https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/nodejitsu/tooltip/base.js#L126-L136
train
nodejitsu/contour
pagelets/nodejitsu/tooltip/base.js
render
function render(event) { var tooltip = document.createElement('div') , element = $(event.element) , pos = element.get('data-placement') , offset = this.offset(event.element) , placement; // // Create the tooltip with the proper content and insert. // tooltip.id = "tooltip"; ...
javascript
function render(event) { var tooltip = document.createElement('div') , element = $(event.element) , pos = element.get('data-placement') , offset = this.offset(event.element) , placement; // // Create the tooltip with the proper content and insert. // tooltip.id = "tooltip"; ...
[ "function", "render", "(", "event", ")", "{", "var", "tooltip", "=", "document", ".", "createElement", "(", "'div'", ")", ",", "element", "=", "$", "(", "event", ".", "element", ")", ",", "pos", "=", "element", ".", "get", "(", "'data-placement'", ")",...
Render the tooltip. @param {Event} event @api private
[ "Render", "the", "tooltip", "." ]
0828e9bd25ef1eeb97ea231c447118d9867021b6
https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/nodejitsu/tooltip/base.js#L144-L170
train
assemble/grunt-assemble-lunr
index.js
function () { addCacheItem(params.context.page); params.context.lunr = params.context.lunr || {}; params.context.lunr.dataPath = params.context.lunr.dataPath || 'search_index.json'; }
javascript
function () { addCacheItem(params.context.page); params.context.lunr = params.context.lunr || {}; params.context.lunr.dataPath = params.context.lunr.dataPath || 'search_index.json'; }
[ "function", "(", ")", "{", "addCacheItem", "(", "params", ".", "context", ".", "page", ")", ";", "params", ".", "context", ".", "lunr", "=", "params", ".", "context", ".", "lunr", "||", "{", "}", ";", "params", ".", "context", ".", "lunr", ".", "da...
call before each page is rendered to get information from the context
[ "call", "before", "each", "page", "is", "rendered", "to", "get", "information", "from", "the", "context" ]
1477e95d1cb98e65448790f7fdc031418a4b51dd
https://github.com/assemble/grunt-assemble-lunr/blob/1477e95d1cb98e65448790f7fdc031418a4b51dd/index.js#L61-L65
train
termi/ASTQuery
src/matchSelector.js
getPathValue
function getPathValue(node, path) { let names = path.split("."), name; while ( name = names.shift() ) { if (node == null) { return names.length ? void 0 : null; } node = node[name]; } return node; }
javascript
function getPathValue(node, path) { let names = path.split("."), name; while ( name = names.shift() ) { if (node == null) { return names.length ? void 0 : null; } node = node[name]; } return node; }
[ "function", "getPathValue", "(", "node", ",", "path", ")", "{", "let", "names", "=", "path", ".", "split", "(", "\".\"", ")", ",", "name", ";", "while", "(", "name", "=", "names", ".", "shift", "(", ")", ")", "{", "if", "(", "node", "==", "null",...
Get the value of a property which may be multiple levels down in the object.
[ "Get", "the", "value", "of", "a", "property", "which", "may", "be", "multiple", "levels", "down", "in", "the", "object", "." ]
992fe7998eb768eddf8a4dc07fa169c1a3e461f1
https://github.com/termi/ASTQuery/blob/992fe7998eb768eddf8a4dc07fa169c1a3e461f1/src/matchSelector.js#L8-L19
train
ratnam99/Angular2-JWTSession
angular2-jwt.js
tokenNotExpired
function tokenNotExpired(tokenName, jwt) { if (tokenName === void 0) { tokenName = AuthConfigConsts.DEFAULT_TOKEN_NAME; } var token = jwt || localStorage.getItem(tokenName) || sessionStorage.getItem(tokenName); var jwtHelper = new JwtHelper(); return token != null && !jwtHelper.isTokenExpired(token); }
javascript
function tokenNotExpired(tokenName, jwt) { if (tokenName === void 0) { tokenName = AuthConfigConsts.DEFAULT_TOKEN_NAME; } var token = jwt || localStorage.getItem(tokenName) || sessionStorage.getItem(tokenName); var jwtHelper = new JwtHelper(); return token != null && !jwtHelper.isTokenExpired(token); }
[ "function", "tokenNotExpired", "(", "tokenName", ",", "jwt", ")", "{", "if", "(", "tokenName", "===", "void", "0", ")", "{", "tokenName", "=", "AuthConfigConsts", ".", "DEFAULT_TOKEN_NAME", ";", "}", "var", "token", "=", "jwt", "||", "localStorage", ".", "...
Checks for presence of token and that token hasn't expired. For use with the @CanActivate router decorator and NgIf
[ "Checks", "for", "presence", "of", "token", "and", "that", "token", "hasn", "t", "expired", ".", "For", "use", "with", "the" ]
ddc53b07f61d3504bc9b9bbff9762f44bf638a56
https://github.com/ratnam99/Angular2-JWTSession/blob/ddc53b07f61d3504bc9b9bbff9762f44bf638a56/angular2-jwt.js#L276-L281
train
socialally/air
lib/air/attr.js
attr
function attr(key, val) { var i, attrs, map = {}; if(!this.length || key !== undefined && !Boolean(key)) { return this; } if(key === undefined && val === undefined) { // no args, get all attributes for first element as object attrs = this.dom[0].attributes; // convert NamedNodeMap to plain obje...
javascript
function attr(key, val) { var i, attrs, map = {}; if(!this.length || key !== undefined && !Boolean(key)) { return this; } if(key === undefined && val === undefined) { // no args, get all attributes for first element as object attrs = this.dom[0].attributes; // convert NamedNodeMap to plain obje...
[ "function", "attr", "(", "key", ",", "val", ")", "{", "var", "i", ",", "attrs", ",", "map", "=", "{", "}", ";", "if", "(", "!", "this", ".", "length", "||", "key", "!==", "undefined", "&&", "!", "Boolean", "(", "key", ")", ")", "{", "return", ...
Get the value of an attribute for the first element in the set of matched elements or set one or more attributes for every matched element.
[ "Get", "the", "value", "of", "an", "attribute", "for", "the", "first", "element", "in", "the", "set", "of", "matched", "elements", "or", "set", "one", "or", "more", "attributes", "for", "every", "matched", "element", "." ]
a3d94de58aaa4930a425fbcc7266764bf6ca8ca6
https://github.com/socialally/air/blob/a3d94de58aaa4930a425fbcc7266764bf6ca8ca6/lib/air/attr.js#L5-L47
train
sakunyo/grunt-pandoc
tasks/PandocRun.js
function (type) { var exec = []; switch (type || this.configs["publish"]) { case "EPUB": this.publishEPUB(exec); break; case "LATEX": this.publishLatex(exec); break; case "HTML": this.publishHTML(exec); default: ...
javascript
function (type) { var exec = []; switch (type || this.configs["publish"]) { case "EPUB": this.publishEPUB(exec); break; case "LATEX": this.publishLatex(exec); break; case "HTML": this.publishHTML(exec); default: ...
[ "function", "(", "type", ")", "{", "var", "exec", "=", "[", "]", ";", "switch", "(", "type", "||", "this", ".", "configs", "[", "\"publish\"", "]", ")", "{", "case", "\"EPUB\"", ":", "this", ".", "publishEPUB", "(", "exec", ")", ";", "break", ";", ...
getEXEC Choice Publish Format @param type @returns {string}
[ "getEXEC", "Choice", "Publish", "Format" ]
448b81beca6dec84c55448c47edaab5d43093844
https://github.com/sakunyo/grunt-pandoc/blob/448b81beca6dec84c55448c47edaab5d43093844/tasks/PandocRun.js#L44-L60
train
btholt/generator-mdpress
app/templates/_ignite.js
waitAndAdvance
function waitAndAdvance(step, steps) { setTimeout(function(){ if (step < steps - 1) { api.next(); waitAndAdvance(step+1, steps); } else { // after 15 seconds on last slide, exit fullscreen if(document.cancelFullScreen) { document.cancelFullScreen(); ...
javascript
function waitAndAdvance(step, steps) { setTimeout(function(){ if (step < steps - 1) { api.next(); waitAndAdvance(step+1, steps); } else { // after 15 seconds on last slide, exit fullscreen if(document.cancelFullScreen) { document.cancelFullScreen(); ...
[ "function", "waitAndAdvance", "(", "step", ",", "steps", ")", "{", "setTimeout", "(", "function", "(", ")", "{", "if", "(", "step", "<", "steps", "-", "1", ")", "{", "api", ".", "next", "(", ")", ";", "waitAndAdvance", "(", "step", "+", "1", ",", ...
recursive function to wait seconds before advancing
[ "recursive", "function", "to", "wait", "seconds", "before", "advancing" ]
712d77e1812be9e0705e3056ca3d0e513c1baa81
https://github.com/btholt/generator-mdpress/blob/712d77e1812be9e0705e3056ca3d0e513c1baa81/app/templates/_ignite.js#L47-L64
train
thii/abbajs
index.js
function(zCriticalValue) { var baselineP = this.baseline.pEstimate(zCriticalValue); var variationP = this.variation.pEstimate(zCriticalValue); var difference = variationP.value - baselineP.value; var standardError = Math.sqrt(Math.pow(baselineP.error, 2) + Math.pow(variationP.error, 2));...
javascript
function(zCriticalValue) { var baselineP = this.baseline.pEstimate(zCriticalValue); var variationP = this.variation.pEstimate(zCriticalValue); var difference = variationP.value - baselineP.value; var standardError = Math.sqrt(Math.pow(baselineP.error, 2) + Math.pow(variationP.error, 2));...
[ "function", "(", "zCriticalValue", ")", "{", "var", "baselineP", "=", "this", ".", "baseline", ".", "pEstimate", "(", "zCriticalValue", ")", ";", "var", "variationP", "=", "this", ".", "variation", ".", "pEstimate", "(", "zCriticalValue", ")", ";", "var", ...
Generate an estimate of the difference in success rates between the variation and the baseline.
[ "Generate", "an", "estimate", "of", "the", "difference", "in", "success", "rates", "between", "the", "variation", "and", "the", "baseline", "." ]
b75b5d4f0cb6bf920cdec36814b72be1e30cf908
https://github.com/thii/abbajs/blob/b75b5d4f0cb6bf920cdec36814b72be1e30cf908/index.js#L175-L181
train