id
int32
0
58k
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
20,700
trustnote/trustnote-pow-common
pow/pow_service.js
connectToServer
function connectToServer( oOptions ) { let sUrl; let oWs; if ( 'object' !== typeof oOptions ) { throw new Error( 'call connectToServer with invalid oOptions' ); } if ( 'string' !== typeof oOptions.minerGateway || 0 === oOptions.minerGateway.length ) { throw new Error( 'call connectToServer with invalid oO...
javascript
function connectToServer( oOptions ) { let sUrl; let oWs; if ( 'object' !== typeof oOptions ) { throw new Error( 'call connectToServer with invalid oOptions' ); } if ( 'string' !== typeof oOptions.minerGateway || 0 === oOptions.minerGateway.length ) { throw new Error( 'call connectToServer with invalid oO...
[ "function", "connectToServer", "(", "oOptions", ")", "{", "let", "sUrl", ";", "let", "oWs", ";", "if", "(", "'object'", "!==", "typeof", "oOptions", ")", "{", "throw", "new", "Error", "(", "'call connectToServer with invalid oOptions'", ")", ";", "}", "if", ...
CLIENT connect to server @public @param {object} oOptions @param {string} oOptions.minerGateway e.g. : wss://1.miner.trustnote.org @param {function} oOptions.onOpen( err, oWsClient ) @param {function} oOptions.onMessage( oWsClient, sMessage ) @param {function} oOptions.onError( oWsClient, vError ) @param {function} ...
[ "CLIENT", "connect", "to", "server" ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/pow/pow_service.js#L199-L304
20,701
trustnote/trustnote-pow-common
pow/pow_service.js
sendMessageOnce
function sendMessageOnce( oWs, sCommand, jsonMessage ) { // ... sendMessage( oWs, sCommand, jsonMessage ); // ... let nCheckInterval = setInterval( () => { if ( 0 === oWs.bufferedAmount ) { // Im' not busy anymore - set a flag or something like that clearInterval( nCheckInterval ); nCheckInterval = n...
javascript
function sendMessageOnce( oWs, sCommand, jsonMessage ) { // ... sendMessage( oWs, sCommand, jsonMessage ); // ... let nCheckInterval = setInterval( () => { if ( 0 === oWs.bufferedAmount ) { // Im' not busy anymore - set a flag or something like that clearInterval( nCheckInterval ); nCheckInterval = n...
[ "function", "sendMessageOnce", "(", "oWs", ",", "sCommand", ",", "jsonMessage", ")", "{", "//\t...", "sendMessage", "(", "oWs", ",", "sCommand", ",", "jsonMessage", ")", ";", "//\t...", "let", "nCheckInterval", "=", "setInterval", "(", "(", ")", "=>", "{", ...
send message and then close the socket @public @param {object} oWs @param {string} sCommand @param {object} jsonMessage @return {boolean}
[ "send", "message", "and", "then", "close", "the", "socket" ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/pow/pow_service.js#L363-L381
20,702
trustnote/trustnote-pow-common
pow/pow_service.js
_cacheGetHandleByUrl
function _cacheGetHandleByUrl( sUrl ) { let oRet; let arrResult; if ( 'string' !== typeof sUrl || 0 === sUrl.length ) { return null; } // ... oRet = null; sUrl = sUrl.trim().toLowerCase(); arrResult = m_arrCacheOutboundPeers.filter( oSocket => oSocket.peer === sUrl ); if ( Array.isArray( arrResult ) && ...
javascript
function _cacheGetHandleByUrl( sUrl ) { let oRet; let arrResult; if ( 'string' !== typeof sUrl || 0 === sUrl.length ) { return null; } // ... oRet = null; sUrl = sUrl.trim().toLowerCase(); arrResult = m_arrCacheOutboundPeers.filter( oSocket => oSocket.peer === sUrl ); if ( Array.isArray( arrResult ) && ...
[ "function", "_cacheGetHandleByUrl", "(", "sUrl", ")", "{", "let", "oRet", ";", "let", "arrResult", ";", "if", "(", "'string'", "!==", "typeof", "sUrl", "||", "0", "===", "sUrl", ".", "length", ")", "{", "return", "null", ";", "}", "//\t...", "oRet", "=...
get socket handle by url @private @param {string} sUrl @returns {null}
[ "get", "socket", "handle", "by", "url" ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/pow/pow_service.js#L393-L413
20,703
trustnote/trustnote-pow-common
pow/pow_service.js
_cacheAddHandle
function _cacheAddHandle( oSocket ) { if ( ! oSocket ) { return false; } // ... _cacheRemoveHandle( oSocket ); m_arrCacheOutboundPeers.push( oSocket ); return true; }
javascript
function _cacheAddHandle( oSocket ) { if ( ! oSocket ) { return false; } // ... _cacheRemoveHandle( oSocket ); m_arrCacheOutboundPeers.push( oSocket ); return true; }
[ "function", "_cacheAddHandle", "(", "oSocket", ")", "{", "if", "(", "!", "oSocket", ")", "{", "return", "false", ";", "}", "//\t...", "_cacheRemoveHandle", "(", "oSocket", ")", ";", "m_arrCacheOutboundPeers", ".", "push", "(", "oSocket", ")", ";", "return", ...
add new socket handle by url @private @param {object} oSocket @returns {boolean}
[ "add", "new", "socket", "handle", "by", "url" ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/pow/pow_service.js#L422-L433
20,704
trustnote/trustnote-pow-common
pow/pow_service.js
_cacheRemoveHandle
function _cacheRemoveHandle( oSocket ) { let bRet; let nIndex; if ( ! oSocket ) { return false; } // ... bRet = false; nIndex = m_arrCacheOutboundPeers.indexOf( oSocket ); if ( -1 !== nIndex ) { bRet = true; m_arrCacheOutboundPeers.splice( nIndex, 1 ); } return bRet; }
javascript
function _cacheRemoveHandle( oSocket ) { let bRet; let nIndex; if ( ! oSocket ) { return false; } // ... bRet = false; nIndex = m_arrCacheOutboundPeers.indexOf( oSocket ); if ( -1 !== nIndex ) { bRet = true; m_arrCacheOutboundPeers.splice( nIndex, 1 ); } return bRet; }
[ "function", "_cacheRemoveHandle", "(", "oSocket", ")", "{", "let", "bRet", ";", "let", "nIndex", ";", "if", "(", "!", "oSocket", ")", "{", "return", "false", ";", "}", "//\t...", "bRet", "=", "false", ";", "nIndex", "=", "m_arrCacheOutboundPeers", ".", "...
remove socket handle by url @private @param {object} oSocket @returns {boolean}
[ "remove", "socket", "handle", "by", "url" ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/pow/pow_service.js#L442-L462
20,705
trustnote/trustnote-pow-common
pow/pow_service.js
_getHostByPeerUrl
function _getHostByPeerUrl( sUrl ) { let arrMatches; // // this regex will match wss://xxx and ws://xxx // arrMatches = sUrl.match( /^wss?:\/\/(.*)$/i ); if ( Array.isArray( arrMatches ) && arrMatches.length >= 1 ) { sUrl = arrMatches[ 1 ]; } // ... arrMatches = sUrl.match( /^(.*?)[:\/]/ ); return ( Arra...
javascript
function _getHostByPeerUrl( sUrl ) { let arrMatches; // // this regex will match wss://xxx and ws://xxx // arrMatches = sUrl.match( /^wss?:\/\/(.*)$/i ); if ( Array.isArray( arrMatches ) && arrMatches.length >= 1 ) { sUrl = arrMatches[ 1 ]; } // ... arrMatches = sUrl.match( /^(.*?)[:\/]/ ); return ( Arra...
[ "function", "_getHostByPeerUrl", "(", "sUrl", ")", "{", "let", "arrMatches", ";", "//", "//\tthis regex will match wss://xxx and ws://xxx", "//", "arrMatches", "=", "sUrl", ".", "match", "(", "/", "^wss?:\\/\\/(.*)$", "/", "i", ")", ";", "if", "(", "Array", ".",...
get host by peer url @private @param {string} sUrl @return {string}
[ "get", "host", "by", "peer", "url" ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/pow/pow_service.js#L472-L488
20,706
trustnote/trustnote-pow-common
pow/pow_service.js
_getRemoteAddress
function _getRemoteAddress( oSocket ) { let sRet; if ( 'object' !== typeof oSocket ) { return null; } // ... sRet = oSocket.upgradeReq.connection.remoteAddress; if ( sRet ) { // // check for proxy // ONLY VALID FOR 127.0.0.1 and resources addresses // if ( oSocket.upgradeReq.headers[ 'x-real-ip' ]...
javascript
function _getRemoteAddress( oSocket ) { let sRet; if ( 'object' !== typeof oSocket ) { return null; } // ... sRet = oSocket.upgradeReq.connection.remoteAddress; if ( sRet ) { // // check for proxy // ONLY VALID FOR 127.0.0.1 and resources addresses // if ( oSocket.upgradeReq.headers[ 'x-real-ip' ]...
[ "function", "_getRemoteAddress", "(", "oSocket", ")", "{", "let", "sRet", ";", "if", "(", "'object'", "!==", "typeof", "oSocket", ")", "{", "return", "null", ";", "}", "//\t...", "sRet", "=", "oSocket", ".", "upgradeReq", ".", "connection", ".", "remoteAdd...
get remote address @private @param {object} oSocket
[ "get", "remote", "address" ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/pow/pow_service.js#L497-L522
20,707
trustnote/trustnote-pow-common
witness/witness_pow_proof.js
validateUnit
function validateUnit( objUnit, bRequireDefinitionOrChange, cb2 ) { let bFound = false; _async.eachSeries ( objUnit.authors, function( author, cb3 ) { let sAddress = author.address; if ( -1 === arrFoundTrustMEAuthors.indexOf( sAddress ) ) { // not a witness - skip it return cb3(); ...
javascript
function validateUnit( objUnit, bRequireDefinitionOrChange, cb2 ) { let bFound = false; _async.eachSeries ( objUnit.authors, function( author, cb3 ) { let sAddress = author.address; if ( -1 === arrFoundTrustMEAuthors.indexOf( sAddress ) ) { // not a witness - skip it return cb3(); ...
[ "function", "validateUnit", "(", "objUnit", ",", "bRequireDefinitionOrChange", ",", "cb2", ")", "{", "let", "bFound", "=", "false", ";", "_async", ".", "eachSeries", "(", "objUnit", ".", "authors", ",", "function", "(", "author", ",", "cb3", ")", "{", "let...
checks signatures and updates definitions
[ "checks", "signatures", "and", "updates", "definitions" ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/witness/witness_pow_proof.js#L207-L324
20,708
trustnote/trustnote-pow-common
sc/deposit.js
isDepositDefinition
function isDepositDefinition(arrDefinition){ if (!validationUtils.isArrayOfLength(arrDefinition, 2)) return false; if (arrDefinition[0] !== 'or') return false; if (!validationUtils.isArrayOfLength(arrDefinition[1], 2)) return false; if (!validationUtils.isArrayOfLength(arrDefinit...
javascript
function isDepositDefinition(arrDefinition){ if (!validationUtils.isArrayOfLength(arrDefinition, 2)) return false; if (arrDefinition[0] !== 'or') return false; if (!validationUtils.isArrayOfLength(arrDefinition[1], 2)) return false; if (!validationUtils.isArrayOfLength(arrDefinit...
[ "function", "isDepositDefinition", "(", "arrDefinition", ")", "{", "if", "(", "!", "validationUtils", ".", "isArrayOfLength", "(", "arrDefinition", ",", "2", ")", ")", "return", "false", ";", "if", "(", "arrDefinition", "[", "0", "]", "!==", "'or'", ")", "...
verify if a deposit definition is valid. @param {Array} arrDefinition @return {boolean}
[ "verify", "if", "a", "deposit", "definition", "is", "valid", "." ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/sc/deposit.js#L18-L35
20,709
trustnote/trustnote-pow-common
sc/deposit.js
hasInvalidUnitsFromHistory
function hasInvalidUnitsFromHistory(conn, address, cb){ var conn = conn || db; if(!validationUtils.isNonemptyString(address)) return cb("param address is null or empty string"); if(!validationUtils.isValidAddress(address)) return cb("param address is not a valid address"); conn.query( ...
javascript
function hasInvalidUnitsFromHistory(conn, address, cb){ var conn = conn || db; if(!validationUtils.isNonemptyString(address)) return cb("param address is null or empty string"); if(!validationUtils.isValidAddress(address)) return cb("param address is not a valid address"); conn.query( ...
[ "function", "hasInvalidUnitsFromHistory", "(", "conn", ",", "address", ",", "cb", ")", "{", "var", "conn", "=", "conn", "||", "db", ";", "if", "(", "!", "validationUtils", ".", "isNonemptyString", "(", "address", ")", ")", "return", "cb", "(", "\"param add...
Check if an address has sent invalid unit. @param {obj} conn if conn is null, use db query, otherwise use conn. @param {string} address @param {function} cb( err, hasInvalidUnits ) callback function If there's error, err is the error message and hasInvalidUnits is null. If there's no error and there's invalid...
[ "Check", "if", "an", "address", "has", "sent", "invalid", "unit", "." ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/sc/deposit.js#L46-L60
20,710
trustnote/trustnote-pow-common
sc/deposit.js
getBalanceOfDepositContract
function getBalanceOfDepositContract(conn, depositAddress, roundIndex, cb){ var conn = conn || db; if(!validationUtils.isNonemptyString(depositAddress)) return cb("param depositAddress is null or empty string"); if(!validationUtils.isValidAddress(depositAddress)) return cb("param depositAddr...
javascript
function getBalanceOfDepositContract(conn, depositAddress, roundIndex, cb){ var conn = conn || db; if(!validationUtils.isNonemptyString(depositAddress)) return cb("param depositAddress is null or empty string"); if(!validationUtils.isValidAddress(depositAddress)) return cb("param depositAddr...
[ "function", "getBalanceOfDepositContract", "(", "conn", ",", "depositAddress", ",", "roundIndex", ",", "cb", ")", "{", "var", "conn", "=", "conn", "||", "db", ";", "if", "(", "!", "validationUtils", ".", "isNonemptyString", "(", "depositAddress", ")", ")", "...
Returns deposit address stable balance, Before the roundIndex @param {obj} conn if conn is null, use db query, otherwise use conn. @param {String} depositAddress @param {String} roundIndex @param {function} cb( err, balance ) callback function If address is invalid, then returns err "invalid addre...
[ "Returns", "deposit", "address", "stable", "balance", "Before", "the", "roundIndex" ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/sc/deposit.js#L74-L117
20,711
trustnote/trustnote-pow-common
sc/deposit.js
getBalanceOfAllDepositContract
function getBalanceOfAllDepositContract(conn, roundIndex, cb){ var conn = conn || db; if(!validationUtils.isPositiveInteger(roundIndex)) return cb("param roundIndex is not a positive integer"); round.getMaxMciByRoundIndex(conn, roundIndex, function(lastRoundMaxMci){ conn.query("SELECT deposi...
javascript
function getBalanceOfAllDepositContract(conn, roundIndex, cb){ var conn = conn || db; if(!validationUtils.isPositiveInteger(roundIndex)) return cb("param roundIndex is not a positive integer"); round.getMaxMciByRoundIndex(conn, roundIndex, function(lastRoundMaxMci){ conn.query("SELECT deposi...
[ "function", "getBalanceOfAllDepositContract", "(", "conn", ",", "roundIndex", ",", "cb", ")", "{", "var", "conn", "=", "conn", "||", "db", ";", "if", "(", "!", "validationUtils", ".", "isPositiveInteger", "(", "roundIndex", ")", ")", "return", "cb", "(", "...
Get all deposit address stable balance, Before the roundIndex @param {obj} conn if conn is null, use db query, otherwise use conn. @param {String} roundIndex @param {function} cb( err, balance ) callback function @return {"base":{"stable":{Integer},"pending":{Integer}}} balance
[ "Get", "all", "deposit", "address", "stable", "balance", "Before", "the", "roundIndex" ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/sc/deposit.js#L129-L151
20,712
trustnote/trustnote-pow-common
sc/deposit.js
getDepositAddressBySafeAddress
function getDepositAddressBySafeAddress(conn, safeAddress, cb){ var conn = conn || db; if(!validationUtils.isNonemptyString(safeAddress)) return cb("param safeAddress is null or empty string"); if(!validationUtils.isValidAddress(safeAddress)) return cb("param safeAddress is not a valid addre...
javascript
function getDepositAddressBySafeAddress(conn, safeAddress, cb){ var conn = conn || db; if(!validationUtils.isNonemptyString(safeAddress)) return cb("param safeAddress is null or empty string"); if(!validationUtils.isValidAddress(safeAddress)) return cb("param safeAddress is not a valid addre...
[ "function", "getDepositAddressBySafeAddress", "(", "conn", ",", "safeAddress", ",", "cb", ")", "{", "var", "conn", "=", "conn", "||", "db", ";", "if", "(", "!", "validationUtils", ".", "isNonemptyString", "(", "safeAddress", ")", ")", "return", "cb", "(", ...
Returns deposit address by supernode safe address. @param {obj} conn if conn is null, use db query, otherwise use conn. @param {String} safeAddress @param {function} cb( err, depositAddress ) callback function If address is invalid, then returns err "invalid address". If can not find the address, then ...
[ "Returns", "deposit", "address", "by", "supernode", "safe", "address", "." ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/sc/deposit.js#L162-L182
20,713
trustnote/trustnote-pow-common
sc/deposit.js
getDepositAddressBySupernodeAddress
function getDepositAddressBySupernodeAddress(conn, supernodeAddress, cb){ var conn = conn || db; if(!validationUtils.isNonemptyString(supernodeAddress)) return cb("param supernodeAddress is null or empty string"); if(!validationUtils.isValidAddress(supernodeAddress)) return cb("param superno...
javascript
function getDepositAddressBySupernodeAddress(conn, supernodeAddress, cb){ var conn = conn || db; if(!validationUtils.isNonemptyString(supernodeAddress)) return cb("param supernodeAddress is null or empty string"); if(!validationUtils.isValidAddress(supernodeAddress)) return cb("param superno...
[ "function", "getDepositAddressBySupernodeAddress", "(", "conn", ",", "supernodeAddress", ",", "cb", ")", "{", "var", "conn", "=", "conn", "||", "db", ";", "if", "(", "!", "validationUtils", ".", "isNonemptyString", "(", "supernodeAddress", ")", ")", "return", ...
Returns deposit address by supernode address. @param {obj} conn if conn is null, use db query, otherwise use conn. @param {String} supernodeAddress @param {function} cb( err, deposit_address ) callback function If depositAddress is invalid, then returns err "invalid address". If can not find the addres...
[ "Returns", "deposit", "address", "by", "supernode", "address", "." ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/sc/deposit.js#L193-L206
20,714
trustnote/trustnote-pow-common
sc/deposit.js
getSupernodeByDepositAddress
function getSupernodeByDepositAddress(conn, depositAddress, cb){ var conn = conn || db; if(!validationUtils.isNonemptyString(depositAddress)) return cb("param depostiAddress is null or empty string"); if(!validationUtils.isValidAddress(depositAddress)) return cb("param depostiAddress is not ...
javascript
function getSupernodeByDepositAddress(conn, depositAddress, cb){ var conn = conn || db; if(!validationUtils.isNonemptyString(depositAddress)) return cb("param depostiAddress is null or empty string"); if(!validationUtils.isValidAddress(depositAddress)) return cb("param depostiAddress is not ...
[ "function", "getSupernodeByDepositAddress", "(", "conn", ",", "depositAddress", ",", "cb", ")", "{", "var", "conn", "=", "conn", "||", "db", ";", "if", "(", "!", "validationUtils", ".", "isNonemptyString", "(", "depositAddress", ")", ")", "return", "cb", "("...
Returns supernode address by deposit address. @param {obj} conn if conn is null, use db query, otherwise use conn. @param {String} depositAddress @param {function} cb( err, supernodeAddress ) callback function If depositAddress is invalid, then returns err "invalid address". If can not find the address...
[ "Returns", "supernode", "address", "by", "deposit", "address", "." ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/sc/deposit.js#L217-L230
20,715
trustnote/trustnote-pow-common
sc/deposit.js
createDepositAddress
function createDepositAddress(my_address, callback) { var arrDefinition = [ 'or', [ ['address', constants.FOUNDATION_SAFE_ADDRESS], ['address', my_address], ] ]; var shared_address = objectHash.getChash160(arrDefinition) if(isDepositDefinition(arrDefinition)){ return callback.ifOk(shared_add...
javascript
function createDepositAddress(my_address, callback) { var arrDefinition = [ 'or', [ ['address', constants.FOUNDATION_SAFE_ADDRESS], ['address', my_address], ] ]; var shared_address = objectHash.getChash160(arrDefinition) if(isDepositDefinition(arrDefinition)){ return callback.ifOk(shared_add...
[ "function", "createDepositAddress", "(", "my_address", ",", "callback", ")", "{", "var", "arrDefinition", "=", "[", "'or'", ",", "[", "[", "'address'", ",", "constants", ".", "FOUNDATION_SAFE_ADDRESS", "]", ",", "[", "'address'", ",", "my_address", "]", ",", ...
Create Deposit Address @param {String} my_address - address that use to generate deposit address @param {Array} arrDefinition - definiton of miner shared address @param {Object} assocSignersByPath - address paths of shared address @param {Function} callback - callback(deposit_address)
[ "Create", "Deposit", "Address" ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/sc/deposit.js#L239-L255
20,716
trustnote/trustnote-pow-common
validation/validation_byzantine.js
validateProposalJoint
function validateProposalJoint(objJoint, callbacks){ var objUnit = objJoint.unit; if (typeof objUnit !== "object" || objUnit === null) return callbacks.ifInvalid("no unit object"); console.log("\nvalidating joint identified by unit "+objJoint.unit.unit); if (!isStringOfLength(objUnit.unit, constants.HASH_LENG...
javascript
function validateProposalJoint(objJoint, callbacks){ var objUnit = objJoint.unit; if (typeof objUnit !== "object" || objUnit === null) return callbacks.ifInvalid("no unit object"); console.log("\nvalidating joint identified by unit "+objJoint.unit.unit); if (!isStringOfLength(objUnit.unit, constants.HASH_LENG...
[ "function", "validateProposalJoint", "(", "objJoint", ",", "callbacks", ")", "{", "var", "objUnit", "=", "objJoint", ".", "unit", ";", "if", "(", "typeof", "objUnit", "!==", "\"object\"", "||", "objUnit", "===", "null", ")", "return", "callbacks", ".", "ifIn...
validate proposed value
[ "validate", "proposed", "value" ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/validation/validation_byzantine.js#L272-L407
20,717
trustnote/trustnote-pow-common
pow/pow.js
obtainMiningInput
function obtainMiningInput( oConn, uRoundIndex, pfnCallback ) { if ( ! oConn ) { throw new Error( `call obtainMiningInput with invalid oConn.` ); } if ( 'number' !== typeof uRoundIndex ) { throw new Error( `call obtainMiningInput with invalid nRoundIndex.` ); } if ( 'function' !== typeof pfnCallback ) { /...
javascript
function obtainMiningInput( oConn, uRoundIndex, pfnCallback ) { if ( ! oConn ) { throw new Error( `call obtainMiningInput with invalid oConn.` ); } if ( 'number' !== typeof uRoundIndex ) { throw new Error( `call obtainMiningInput with invalid nRoundIndex.` ); } if ( 'function' !== typeof pfnCallback ) { /...
[ "function", "obtainMiningInput", "(", "oConn", ",", "uRoundIndex", ",", "pfnCallback", ")", "{", "if", "(", "!", "oConn", ")", "{", "throw", "new", "Error", "(", "`", "`", ")", ";", "}", "if", "(", "'number'", "!==", "typeof", "uRoundIndex", ")", "{", ...
obtain mining input @param {handle} oConn @param {function} oConn.query @param {number} uRoundIndex @param {function} pfnCallback( err ) @return {boolean} @description start successfully pfnCallback( null, objInput ); failed to start pfnCallback( error );
[ "obtain", "mining", "input" ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/pow/pow.js#L235-L386
20,718
trustnote/trustnote-pow-common
pow/pow.js
startMiningWithInputs
function startMiningWithInputs( oInput, pfnCallback ) { console.log( `>***< will start mining with inputs : ${ JSON.stringify( oInput ) }` ); if ( _bBrowser && ! _bWallet ) { throw new Error( 'I am not be able to run in a Web Browser.' ); } if ( 'object' !== typeof oInput ) { throw new Error( 'call startMini...
javascript
function startMiningWithInputs( oInput, pfnCallback ) { console.log( `>***< will start mining with inputs : ${ JSON.stringify( oInput ) }` ); if ( _bBrowser && ! _bWallet ) { throw new Error( 'I am not be able to run in a Web Browser.' ); } if ( 'object' !== typeof oInput ) { throw new Error( 'call startMini...
[ "function", "startMiningWithInputs", "(", "oInput", ",", "pfnCallback", ")", "{", "console", ".", "log", "(", "`", "${", "JSON", ".", "stringify", "(", "oInput", ")", "}", "`", ")", ";", "if", "(", "_bBrowser", "&&", "!", "_bWallet", ")", "{", "throw",...
start calculation with inputs @param {object} oInput @param {number} oInput.roundIndex @param {string} oInput.firstTrustMEBall @param {string} oInput.bits @param {string} oInput.publicSeed @param {string} oInput.superNodeAuthor @param {function} pfnCallback( err ) will be called immediately while we start mining @retu...
[ "start", "calculation", "with", "inputs" ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/pow/pow.js#L418-L515
20,719
trustnote/trustnote-pow-common
pow/pow.js
calculatePublicSeedByRoundIndex
function calculatePublicSeedByRoundIndex( oConn, nRoundIndex, pfnCallback ) { if ( ! oConn ) { return pfnCallback( `call calculatePublicSeedByRoundIndex with invalid oConn` ); } if ( 'number' !== typeof nRoundIndex ) { return pfnCallback( `call calculatePublicSeedByRoundIndex with invalid nRoundIndex` ); } i...
javascript
function calculatePublicSeedByRoundIndex( oConn, nRoundIndex, pfnCallback ) { if ( ! oConn ) { return pfnCallback( `call calculatePublicSeedByRoundIndex with invalid oConn` ); } if ( 'number' !== typeof nRoundIndex ) { return pfnCallback( `call calculatePublicSeedByRoundIndex with invalid nRoundIndex` ); } i...
[ "function", "calculatePublicSeedByRoundIndex", "(", "oConn", ",", "nRoundIndex", ",", "pfnCallback", ")", "{", "if", "(", "!", "oConn", ")", "{", "return", "pfnCallback", "(", "`", "`", ")", ";", "}", "if", "(", "'number'", "!==", "typeof", "nRoundIndex", ...
calculate public seed by round index @param {handle} oConn @param {function} oConn.query @param {number} nRoundIndex round 1 hard code round 2 previous seed [] TrustME Ball round 3 previous seed [] TrustME Ball @param {function} pfnCallback( err, sSeed ) @documentation https://github.com/trustnote/document/blob/mast...
[ "calculate", "public", "seed", "by", "round", "index" ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/pow/pow.js#L675-L780
20,720
trustnote/trustnote-pow-common
pow/pow.js
queryPublicSeedByRoundIndex
function queryPublicSeedByRoundIndex( oConn, nRoundIndex, pfnCallback ) { if ( ! oConn ) { return pfnCallback( `call queryPublicSeedByRoundIndex with invalid oConn` ); } if ( 'number' !== typeof nRoundIndex || nRoundIndex <= 0 ) { return pfnCallback( `call queryPublicSeedByRoundIndex with invalid nRoundIndex` ...
javascript
function queryPublicSeedByRoundIndex( oConn, nRoundIndex, pfnCallback ) { if ( ! oConn ) { return pfnCallback( `call queryPublicSeedByRoundIndex with invalid oConn` ); } if ( 'number' !== typeof nRoundIndex || nRoundIndex <= 0 ) { return pfnCallback( `call queryPublicSeedByRoundIndex with invalid nRoundIndex` ...
[ "function", "queryPublicSeedByRoundIndex", "(", "oConn", ",", "nRoundIndex", ",", "pfnCallback", ")", "{", "if", "(", "!", "oConn", ")", "{", "return", "pfnCallback", "(", "`", "`", ")", ";", "}", "if", "(", "'number'", "!==", "typeof", "nRoundIndex", "||"...
get public seed by round index @param {handle} oConn @param {function} oConn.query @param {number} nRoundIndex @param {function} pfnCallback( err, arrCoinBaseList )
[ "get", "public", "seed", "by", "round", "index" ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/pow/pow.js#L791-L820
20,721
trustnote/trustnote-pow-common
pow/pow.js
queryBitsValueByCycleIndex
function queryBitsValueByCycleIndex( oConn, uCycleIndex, pfnCallback ) { if ( ! oConn ) { return pfnCallback( `call queryBitsValueByCycleIndex with invalid oConn` ); } if ( 'number' !== typeof uCycleIndex || uCycleIndex <= 0 ) { return pfnCallback( `call queryBitsValueByCycleIndex with invalid uCycleIndex` ); ...
javascript
function queryBitsValueByCycleIndex( oConn, uCycleIndex, pfnCallback ) { if ( ! oConn ) { return pfnCallback( `call queryBitsValueByCycleIndex with invalid oConn` ); } if ( 'number' !== typeof uCycleIndex || uCycleIndex <= 0 ) { return pfnCallback( `call queryBitsValueByCycleIndex with invalid uCycleIndex` ); ...
[ "function", "queryBitsValueByCycleIndex", "(", "oConn", ",", "uCycleIndex", ",", "pfnCallback", ")", "{", "if", "(", "!", "oConn", ")", "{", "return", "pfnCallback", "(", "`", "`", ")", ";", "}", "if", "(", "'number'", "!==", "typeof", "uCycleIndex", "||",...
query bits value by round index from database @param {handle} oConn @param {function} oConn.query @param {number} uCycleIndex @param {function} pfnCallback( err, nBitsValue )
[ "query", "bits", "value", "by", "round", "index", "from", "database" ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/pow/pow.js#L831-L860
20,722
trustnote/trustnote-pow-common
pow/pow.js
_createMiningInputBufferFromObject
function _createMiningInputBufferFromObject( objInput ) { let objInputCpy; let sInput; let bufSha512; let bufMd5; let bufRmd160; let bufSha384; if ( 'object' !== typeof objInput ) { return null; } // ... objInputCpy = { roundIndex : objInput.roundIndex, firstTrustMEBall : objInput.firstTrustMEBall, ...
javascript
function _createMiningInputBufferFromObject( objInput ) { let objInputCpy; let sInput; let bufSha512; let bufMd5; let bufRmd160; let bufSha384; if ( 'object' !== typeof objInput ) { return null; } // ... objInputCpy = { roundIndex : objInput.roundIndex, firstTrustMEBall : objInput.firstTrustMEBall, ...
[ "function", "_createMiningInputBufferFromObject", "(", "objInput", ")", "{", "let", "objInputCpy", ";", "let", "sInput", ";", "let", "bufSha512", ";", "let", "bufMd5", ";", "let", "bufRmd160", ";", "let", "bufSha384", ";", "if", "(", "'object'", "!==", "typeof...
create an input buffer with length of 140 from Js plain object @public @param {object} objInput @return {Buffer}
[ "create", "an", "input", "buffer", "with", "length", "of", "140", "from", "Js", "plain", "object" ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/pow/pow.js#L1226-L1255
20,723
trustnote/trustnote-pow-common
pow/pow.js
_generateRandomInteger
function _generateRandomInteger( nMin, nMax ) { return Math.floor( Math.random() * ( nMax + 1 - nMin ) ) + nMin; }
javascript
function _generateRandomInteger( nMin, nMax ) { return Math.floor( Math.random() * ( nMax + 1 - nMin ) ) + nMin; }
[ "function", "_generateRandomInteger", "(", "nMin", ",", "nMax", ")", "{", "return", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", "(", "nMax", "+", "1", "-", "nMin", ")", ")", "+", "nMin", ";", "}" ]
generate random integer @private @param {number} nMin @param {number} nMax @returns {*}
[ "generate", "random", "integer" ]
582965aee4cf98ad15188bfa2392f01b86fe8683
https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/pow/pow.js#L1266-L1269
20,724
ethereumjs/ethereumjs-block
header-from-rpc.js
blockHeaderFromRpc
function blockHeaderFromRpc (blockParams) { const blockHeader = new BlockHeader({ parentHash: blockParams.parentHash, uncleHash: blockParams.sha3Uncles, coinbase: blockParams.miner, stateRoot: blockParams.stateRoot, transactionsTrie: blockParams.transactionsRoot, receiptTrie: blockParams.recei...
javascript
function blockHeaderFromRpc (blockParams) { const blockHeader = new BlockHeader({ parentHash: blockParams.parentHash, uncleHash: blockParams.sha3Uncles, coinbase: blockParams.miner, stateRoot: blockParams.stateRoot, transactionsTrie: blockParams.transactionsRoot, receiptTrie: blockParams.recei...
[ "function", "blockHeaderFromRpc", "(", "blockParams", ")", "{", "const", "blockHeader", "=", "new", "BlockHeader", "(", "{", "parentHash", ":", "blockParams", ".", "parentHash", ",", "uncleHash", ":", "blockParams", ".", "sha3Uncles", ",", "coinbase", ":", "bloc...
Creates a new block header object from Ethereum JSON RPC. @param {Object} blockParams - Ethereum JSON RPC of block (eth_getBlockByNumber)
[ "Creates", "a", "new", "block", "header", "object", "from", "Ethereum", "JSON", "RPC", "." ]
2c3908e5bbb6c9c94aeb5547a779295433f42545
https://github.com/ethereumjs/ethereumjs-block/blob/2c3908e5bbb6c9c94aeb5547a779295433f42545/header-from-rpc.js#L11-L36
20,725
ethereumjs/ethereumjs-block
from-rpc.js
blockFromRpc
function blockFromRpc (blockParams, uncles) { uncles = uncles || [] const block = new Block({ transactions: [], uncleHeaders: [] }) block.header = blockHeaderFromRpc(blockParams) block.transactions = (blockParams.transactions || []).map(function (_txParams) { const txParams = normalizeTxParams(_t...
javascript
function blockFromRpc (blockParams, uncles) { uncles = uncles || [] const block = new Block({ transactions: [], uncleHeaders: [] }) block.header = blockHeaderFromRpc(blockParams) block.transactions = (blockParams.transactions || []).map(function (_txParams) { const txParams = normalizeTxParams(_t...
[ "function", "blockFromRpc", "(", "blockParams", ",", "uncles", ")", "{", "uncles", "=", "uncles", "||", "[", "]", "const", "block", "=", "new", "Block", "(", "{", "transactions", ":", "[", "]", ",", "uncleHeaders", ":", "[", "]", "}", ")", "block", "...
Creates a new block object from Ethereum JSON RPC. @param {Object} blockParams - Ethereum JSON RPC of block (eth_getBlockByNumber) @param {Array.<Object>} Optional list of Ethereum JSON RPC of uncles (eth_getUncleByBlockHashAndIndex)
[ "Creates", "a", "new", "block", "object", "from", "Ethereum", "JSON", "RPC", "." ]
2c3908e5bbb6c9c94aeb5547a779295433f42545
https://github.com/ethereumjs/ethereumjs-block/blob/2c3908e5bbb6c9c94aeb5547a779295433f42545/from-rpc.js#L14-L40
20,726
ethereumjs/ethereumjs-block
index.js
function (cb3) { blockChain.getDetails(uncle.hash(), function (err, blockInfo) { // TODO: remove uncles from BC if (blockInfo && blockInfo.isUncle) { cb3(err || 'uncle already included') } else { cb3() } }) }
javascript
function (cb3) { blockChain.getDetails(uncle.hash(), function (err, blockInfo) { // TODO: remove uncles from BC if (blockInfo && blockInfo.isUncle) { cb3(err || 'uncle already included') } else { cb3() } }) }
[ "function", "(", "cb3", ")", "{", "blockChain", ".", "getDetails", "(", "uncle", ".", "hash", "(", ")", ",", "function", "(", "err", ",", "blockInfo", ")", "{", "// TODO: remove uncles from BC", "if", "(", "blockInfo", "&&", "blockInfo", ".", "isUncle", ")...
check to make sure the uncle is not already in the blockchain
[ "check", "to", "make", "sure", "the", "uncle", "is", "not", "already", "in", "the", "blockchain" ]
2c3908e5bbb6c9c94aeb5547a779295433f42545
https://github.com/ethereumjs/ethereumjs-block/blob/2c3908e5bbb6c9c94aeb5547a779295433f42545/index.js#L271-L280
20,727
kcartlidge/nodepub
src/index.js
replacements
function replacements(document, original) { var modified = moment().format('YYYY-MM-DD'); var result = original; result = tagReplace(result, 'EOL', '\n'); result = tagReplace(result, 'ID', document.metadata.id); result = tagReplace(result, 'TITLE', document.metadata.title); result = tagReplace(result, 'SERI...
javascript
function replacements(document, original) { var modified = moment().format('YYYY-MM-DD'); var result = original; result = tagReplace(result, 'EOL', '\n'); result = tagReplace(result, 'ID', document.metadata.id); result = tagReplace(result, 'TITLE', document.metadata.title); result = tagReplace(result, 'SERI...
[ "function", "replacements", "(", "document", ",", "original", ")", "{", "var", "modified", "=", "moment", "(", ")", ".", "format", "(", "'YYYY-MM-DD'", ")", ";", "var", "result", "=", "original", ";", "result", "=", "tagReplace", "(", "result", ",", "'EO...
Do all in-line replacements needed.
[ "Do", "all", "in", "-", "line", "replacements", "needed", "." ]
4c4b53a3c559f6a0e32f70d63c2b750b2eaa1258
https://github.com/kcartlidge/nodepub/blob/4c4b53a3c559f6a0e32f70d63c2b750b2eaa1258/src/index.js#L178-L199
20,728
kcartlidge/nodepub
src/index.js
getContainer
function getContainer(document) { var content = structuralFiles.getContainer(document); return replacements(document, replacements(document, content)); }
javascript
function getContainer(document) { var content = structuralFiles.getContainer(document); return replacements(document, replacements(document, content)); }
[ "function", "getContainer", "(", "document", ")", "{", "var", "content", "=", "structuralFiles", ".", "getContainer", "(", "document", ")", ";", "return", "replacements", "(", "document", ",", "replacements", "(", "document", ",", "content", ")", ")", ";", "...
Provide the contents of the container XML file.
[ "Provide", "the", "contents", "of", "the", "container", "XML", "file", "." ]
4c4b53a3c559f6a0e32f70d63c2b750b2eaa1258
https://github.com/kcartlidge/nodepub/blob/4c4b53a3c559f6a0e32f70d63c2b750b2eaa1258/src/index.js#L207-L210
20,729
kcartlidge/nodepub
src/index.js
getNCX
function getNCX(document) { var content = structuralFiles.getNCX(document); return replacements(document, replacements(document, content)); }
javascript
function getNCX(document) { var content = structuralFiles.getNCX(document); return replacements(document, replacements(document, content)); }
[ "function", "getNCX", "(", "document", ")", "{", "var", "content", "=", "structuralFiles", ".", "getNCX", "(", "document", ")", ";", "return", "replacements", "(", "document", ",", "replacements", "(", "document", ",", "content", ")", ")", ";", "}" ]
Provide the contents of the NCX file.
[ "Provide", "the", "contents", "of", "the", "NCX", "file", "." ]
4c4b53a3c559f6a0e32f70d63c2b750b2eaa1258
https://github.com/kcartlidge/nodepub/blob/4c4b53a3c559f6a0e32f70d63c2b750b2eaa1258/src/index.js#L219-L222
20,730
kcartlidge/nodepub
src/index.js
getTOC
function getTOC(document) { var content = ""; if (document.generateContentsCallback) { var callbackContent = document.generateContentsCallback(document.filesForTOC); content = markupFiles.getContents(document, callbackContent); } else { content = markupFiles.getContents(document); } return replace...
javascript
function getTOC(document) { var content = ""; if (document.generateContentsCallback) { var callbackContent = document.generateContentsCallback(document.filesForTOC); content = markupFiles.getContents(document, callbackContent); } else { content = markupFiles.getContents(document); } return replace...
[ "function", "getTOC", "(", "document", ")", "{", "var", "content", "=", "\"\"", ";", "if", "(", "document", ".", "generateContentsCallback", ")", "{", "var", "callbackContent", "=", "document", ".", "generateContentsCallback", "(", "document", ".", "filesForTOC"...
Provide the contents of the TOC file.
[ "Provide", "the", "contents", "of", "the", "TOC", "file", "." ]
4c4b53a3c559f6a0e32f70d63c2b750b2eaa1258
https://github.com/kcartlidge/nodepub/blob/4c4b53a3c559f6a0e32f70d63c2b750b2eaa1258/src/index.js#L225-L234
20,731
kcartlidge/nodepub
src/index.js
getCover
function getCover(document) { var content = markupFiles.getCover(); return replacements(document, replacements(document, content)); }
javascript
function getCover(document) { var content = markupFiles.getCover(); return replacements(document, replacements(document, content)); }
[ "function", "getCover", "(", "document", ")", "{", "var", "content", "=", "markupFiles", ".", "getCover", "(", ")", ";", "return", "replacements", "(", "document", ",", "replacements", "(", "document", ",", "content", ")", ")", ";", "}" ]
Provide the contents of the cover HTML enclosure.
[ "Provide", "the", "contents", "of", "the", "cover", "HTML", "enclosure", "." ]
4c4b53a3c559f6a0e32f70d63c2b750b2eaa1258
https://github.com/kcartlidge/nodepub/blob/4c4b53a3c559f6a0e32f70d63c2b750b2eaa1258/src/index.js#L237-L240
20,732
kcartlidge/nodepub
src/index.js
getCSS
function getCSS(document) { var content = document.CSS; return replacements(document, replacements(document, content)); }
javascript
function getCSS(document) { var content = document.CSS; return replacements(document, replacements(document, content)); }
[ "function", "getCSS", "(", "document", ")", "{", "var", "content", "=", "document", ".", "CSS", ";", "return", "replacements", "(", "document", ",", "replacements", "(", "document", ",", "content", ")", ")", ";", "}" ]
Provide the contents of the CSS file.
[ "Provide", "the", "contents", "of", "the", "CSS", "file", "." ]
4c4b53a3c559f6a0e32f70d63c2b750b2eaa1258
https://github.com/kcartlidge/nodepub/blob/4c4b53a3c559f6a0e32f70d63c2b750b2eaa1258/src/index.js#L243-L246
20,733
kcartlidge/nodepub
src/index.js
getSection
function getSection(document, sectionNumber) { var content = markupFiles.getSection(document, sectionNumber); return replacements(document, replacements(document, content)); }
javascript
function getSection(document, sectionNumber) { var content = markupFiles.getSection(document, sectionNumber); return replacements(document, replacements(document, content)); }
[ "function", "getSection", "(", "document", ",", "sectionNumber", ")", "{", "var", "content", "=", "markupFiles", ".", "getSection", "(", "document", ",", "sectionNumber", ")", ";", "return", "replacements", "(", "document", ",", "replacements", "(", "document", ...
Provide the contents of a single section's HTML.
[ "Provide", "the", "contents", "of", "a", "single", "section", "s", "HTML", "." ]
4c4b53a3c559f6a0e32f70d63c2b750b2eaa1258
https://github.com/kcartlidge/nodepub/blob/4c4b53a3c559f6a0e32f70d63c2b750b2eaa1258/src/index.js#L249-L252
20,734
kcartlidge/nodepub
src/index.js
makeFolder
function makeFolder(path, cb) { if (cb) { fs.mkdir(path, function (err) { if (err && err.code != 'EEXIST') { throw err; } cb(); }); } }
javascript
function makeFolder(path, cb) { if (cb) { fs.mkdir(path, function (err) { if (err && err.code != 'EEXIST') { throw err; } cb(); }); } }
[ "function", "makeFolder", "(", "path", ",", "cb", ")", "{", "if", "(", "cb", ")", "{", "fs", ".", "mkdir", "(", "path", ",", "function", "(", "err", ")", "{", "if", "(", "err", "&&", "err", ".", "code", "!=", "'EEXIST'", ")", "{", "throw", "err...
Create a folder, throwing an error only if the error is not that the folder already exists. Effectively creates if not found.
[ "Create", "a", "folder", "throwing", "an", "error", "only", "if", "the", "error", "is", "not", "that", "the", "folder", "already", "exists", ".", "Effectively", "creates", "if", "not", "found", "." ]
4c4b53a3c559f6a0e32f70d63c2b750b2eaa1258
https://github.com/kcartlidge/nodepub/blob/4c4b53a3c559f6a0e32f70d63c2b750b2eaa1258/src/index.js#L256-L265
20,735
royriojas/file-entry-cache
cache.js
function ( files ) { var me = this; files = files || [ ]; return me.normalizeEntries( files ).filter( function ( entry ) { return entry.changed; } ).map( function ( entry ) { return entry.key; } ); }
javascript
function ( files ) { var me = this; files = files || [ ]; return me.normalizeEntries( files ).filter( function ( entry ) { return entry.changed; } ).map( function ( entry ) { return entry.key; } ); }
[ "function", "(", "files", ")", "{", "var", "me", "=", "this", ";", "files", "=", "files", "||", "[", "]", ";", "return", "me", ".", "normalizeEntries", "(", "files", ")", ".", "filter", "(", "function", "(", "entry", ")", "{", "return", "entry", "....
Return the list o the files that changed compared against the ones stored in the cache @method getUpdated @param files {Array} the array of files to compare against the ones in the cache @returns {Array}
[ "Return", "the", "list", "o", "the", "files", "that", "changed", "compared", "against", "the", "ones", "stored", "in", "the", "cache" ]
03f700c99b76133dc14648b465a1550ec2930e5c
https://github.com/royriojas/file-entry-cache/blob/03f700c99b76133dc14648b465a1550ec2930e5c/cache.js#L176-L185
20,736
royriojas/file-entry-cache
cache.js
function ( files ) { files = files || [ ]; var me = this; var nEntries = files.map( function ( file ) { return me.getFileDescriptor( file ); } ); //normalizeEntries = nEntries; return nEntries; }
javascript
function ( files ) { files = files || [ ]; var me = this; var nEntries = files.map( function ( file ) { return me.getFileDescriptor( file ); } ); //normalizeEntries = nEntries; return nEntries; }
[ "function", "(", "files", ")", "{", "files", "=", "files", "||", "[", "]", ";", "var", "me", "=", "this", ";", "var", "nEntries", "=", "files", ".", "map", "(", "function", "(", "file", ")", "{", "return", "me", ".", "getFileDescriptor", "(", "file...
return the list of files @method normalizeEntries @param files @returns {*}
[ "return", "the", "list", "of", "files" ]
03f700c99b76133dc14648b465a1550ec2930e5c
https://github.com/royriojas/file-entry-cache/blob/03f700c99b76133dc14648b465a1550ec2930e5c/cache.js#L193-L203
20,737
royriojas/file-entry-cache
cache.js
function ( noPrune ) { removeNotFoundFiles(); noPrune = typeof noPrune === 'undefined' ? true : noPrune; var entries = normalizedEntries; var keys = Object.keys( entries ); if ( keys.length === 0 ) { return; } var me = this; keys.forEach( fu...
javascript
function ( noPrune ) { removeNotFoundFiles(); noPrune = typeof noPrune === 'undefined' ? true : noPrune; var entries = normalizedEntries; var keys = Object.keys( entries ); if ( keys.length === 0 ) { return; } var me = this; keys.forEach( fu...
[ "function", "(", "noPrune", ")", "{", "removeNotFoundFiles", "(", ")", ";", "noPrune", "=", "typeof", "noPrune", "===", "'undefined'", "?", "true", ":", "noPrune", ";", "var", "entries", "=", "normalizedEntries", ";", "var", "keys", "=", "Object", ".", "ke...
Sync the files and persist them to the cache @method reconcile
[ "Sync", "the", "files", "and", "persist", "them", "to", "the", "cache" ]
03f700c99b76133dc14648b465a1550ec2930e5c
https://github.com/royriojas/file-entry-cache/blob/03f700c99b76133dc14648b465a1550ec2930e5c/cache.js#L253-L283
20,738
aerospike/aerospike-client-nodejs
lib/filter.js
typeOf
function typeOf (value) { if (value === null) return 'null' var valueType = typeof value if (valueType === 'object') { valueType = value.constructor.name.toLowerCase() } return valueType }
javascript
function typeOf (value) { if (value === null) return 'null' var valueType = typeof value if (valueType === 'object') { valueType = value.constructor.name.toLowerCase() } return valueType }
[ "function", "typeOf", "(", "value", ")", "{", "if", "(", "value", "===", "null", ")", "return", "'null'", "var", "valueType", "=", "typeof", "value", "if", "(", "valueType", "===", "'object'", ")", "{", "valueType", "=", "value", ".", "constructor", ".",...
Helper function to determine the type of a primitive or Object
[ "Helper", "function", "to", "determine", "the", "type", "of", "a", "primitive", "or", "Object" ]
2b9554d1158abda58c17cfbd0438d78f0212ef9e
https://github.com/aerospike/aerospike-client-nodejs/blob/2b9554d1158abda58c17cfbd0438d78f0212ef9e/lib/filter.js#L94-L101
20,739
aerospike/aerospike-client-nodejs
lib/info.js
parseKeyValue
function parseKeyValue (str, sep1, sep2) { var result = {} str.split(sep1).forEach(function (kv) { if (kv.length > 0) { kv = kv.split(sep2, 2) result[kv[0]] = parseValue(kv[1]) } }) return result }
javascript
function parseKeyValue (str, sep1, sep2) { var result = {} str.split(sep1).forEach(function (kv) { if (kv.length > 0) { kv = kv.split(sep2, 2) result[kv[0]] = parseValue(kv[1]) } }) return result }
[ "function", "parseKeyValue", "(", "str", ",", "sep1", ",", "sep2", ")", "{", "var", "result", "=", "{", "}", "str", ".", "split", "(", "sep1", ")", ".", "forEach", "(", "function", "(", "kv", ")", "{", "if", "(", "kv", ".", "length", ">", "0", ...
Parses a string value representing a key-value-map separated by sep1 and sep2 into an Object. Ex.: - parseKeyValue('a=1;b=2', ';', '=') => { a: 1, b: 2 } @private
[ "Parses", "a", "string", "value", "representing", "a", "key", "-", "value", "-", "map", "separated", "by", "sep1", "and", "sep2", "into", "an", "Object", "." ]
2b9554d1158abda58c17cfbd0438d78f0212ef9e
https://github.com/aerospike/aerospike-client-nodejs/blob/2b9554d1158abda58c17cfbd0438d78f0212ef9e/lib/info.js#L104-L113
20,740
aerospike/aerospike-client-nodejs
lib/info.js
smartParse
function smartParse (str, sep1, sep2) { sep1 = sep1 || ';' sep2 = sep2 || '=' if ((typeof str === 'string') && str.indexOf(sep1) >= 0) { if (str.indexOf(sep2) >= 0) { return parseKeyValue(str, sep1, sep2) } else { return str.split(sep1) } } return str }
javascript
function smartParse (str, sep1, sep2) { sep1 = sep1 || ';' sep2 = sep2 || '=' if ((typeof str === 'string') && str.indexOf(sep1) >= 0) { if (str.indexOf(sep2) >= 0) { return parseKeyValue(str, sep1, sep2) } else { return str.split(sep1) } } return str }
[ "function", "smartParse", "(", "str", ",", "sep1", ",", "sep2", ")", "{", "sep1", "=", "sep1", "||", "';'", "sep2", "=", "sep2", "||", "'='", "if", "(", "(", "typeof", "str", "===", "'string'", ")", "&&", "str", ".", "indexOf", "(", "sep1", ")", ...
Split string into list or key-value-pairs depending on whether the given separator chars appear in the string. This is the logic used by the old parseInfo function and the default logic used by the new parse function unless a specific format is defined for an info key. Ex.: - smartParse('foo') => 'foo' - smartParse('f...
[ "Split", "string", "into", "list", "or", "key", "-", "value", "-", "pairs", "depending", "on", "whether", "the", "given", "separator", "chars", "appear", "in", "the", "string", ".", "This", "is", "the", "logic", "used", "by", "the", "old", "parseInfo", "...
2b9554d1158abda58c17cfbd0438d78f0212ef9e
https://github.com/aerospike/aerospike-client-nodejs/blob/2b9554d1158abda58c17cfbd0438d78f0212ef9e/lib/info.js#L128-L139
20,741
aerospike/aerospike-client-nodejs
lib/info.js
getSeparators
function getSeparators (key) { let pattern = Object.keys(separators).find(p => minimatch(key, p)) const seps = separators[pattern] || defaultSeparators return seps.slice() // return a copy of the array }
javascript
function getSeparators (key) { let pattern = Object.keys(separators).find(p => minimatch(key, p)) const seps = separators[pattern] || defaultSeparators return seps.slice() // return a copy of the array }
[ "function", "getSeparators", "(", "key", ")", "{", "let", "pattern", "=", "Object", ".", "keys", "(", "separators", ")", ".", "find", "(", "p", "=>", "minimatch", "(", "key", ",", "p", ")", ")", "const", "seps", "=", "separators", "[", "pattern", "]"...
Returns separators to use for the given info key. @private
[ "Returns", "separators", "to", "use", "for", "the", "given", "info", "key", "." ]
2b9554d1158abda58c17cfbd0438d78f0212ef9e
https://github.com/aerospike/aerospike-client-nodejs/blob/2b9554d1158abda58c17cfbd0438d78f0212ef9e/lib/info.js#L146-L150
20,742
aerospike/aerospike-client-nodejs
lib/info.js
deepSplitString
function deepSplitString (input, separators) { if (input === null || typeof input === 'undefined') { return input } if (separators.length === 0) { return input } const sep = separators.shift() let output = input if (typeof input === 'string') { output = splitString(input, sep) } else if (A...
javascript
function deepSplitString (input, separators) { if (input === null || typeof input === 'undefined') { return input } if (separators.length === 0) { return input } const sep = separators.shift() let output = input if (typeof input === 'string') { output = splitString(input, sep) } else if (A...
[ "function", "deepSplitString", "(", "input", ",", "separators", ")", "{", "if", "(", "input", "===", "null", "||", "typeof", "input", "===", "'undefined'", ")", "{", "return", "input", "}", "if", "(", "separators", ".", "length", "===", "0", ")", "{", ...
Splits a string into a, possibly nested, array or object using the given separators. @private
[ "Splits", "a", "string", "into", "a", "possibly", "nested", "array", "or", "object", "using", "the", "given", "separators", "." ]
2b9554d1158abda58c17cfbd0438d78f0212ef9e
https://github.com/aerospike/aerospike-client-nodejs/blob/2b9554d1158abda58c17cfbd0438d78f0212ef9e/lib/info.js#L158-L185
20,743
aerospike/aerospike-client-nodejs
benchmarks/main.js
workerProbe
function workerProbe () { Object.keys(cluster.workers).forEach(function (id) { cluster.workers[id].send(['trans']) }) }
javascript
function workerProbe () { Object.keys(cluster.workers).forEach(function (id) { cluster.workers[id].send(['trans']) }) }
[ "function", "workerProbe", "(", ")", "{", "Object", ".", "keys", "(", "cluster", ".", "workers", ")", ".", "forEach", "(", "function", "(", "id", ")", "{", "cluster", ".", "workers", "[", "id", "]", ".", "send", "(", "[", "'trans'", "]", ")", "}", ...
Signal all workers asking for data on transactions
[ "Signal", "all", "workers", "asking", "for", "data", "on", "transactions" ]
2b9554d1158abda58c17cfbd0438d78f0212ef9e
https://github.com/aerospike/aerospike-client-nodejs/blob/2b9554d1158abda58c17cfbd0438d78f0212ef9e/benchmarks/main.js#L127-L131
20,744
nebulasio/neb.js
lib/account.js
function (priv) { if (utils.isString(priv) || Buffer.isBuffer(priv)) { this.privKey = priv.length === 32 ? priv : Buffer(priv, 'hex'); this.pubKey = null; this.address = null; } }
javascript
function (priv) { if (utils.isString(priv) || Buffer.isBuffer(priv)) { this.privKey = priv.length === 32 ? priv : Buffer(priv, 'hex'); this.pubKey = null; this.address = null; } }
[ "function", "(", "priv", ")", "{", "if", "(", "utils", ".", "isString", "(", "priv", ")", "||", "Buffer", ".", "isBuffer", "(", "priv", ")", ")", "{", "this", ".", "privKey", "=", "priv", ".", "length", "===", "32", "?", "priv", ":", "Buffer", "(...
Private Key setter. @param {Hash} priv - Account private key. @example account.setPrivateKey("ac3773e06ae74c0fa566b0e421d4e391333f31aef90b383f0c0e83e4873609d6");
[ "Private", "Key", "setter", "." ]
ad307a4be2015e5dba165ecab9c6e87104875f37
https://github.com/nebulasio/neb.js/blob/ad307a4be2015e5dba165ecab9c6e87104875f37/lib/account.js#L188-L194
20,745
nebulasio/neb.js
lib/account.js
function () { if (utils.isNull(this.address)) { var pubKey = this.getPublicKey(); if (pubKey.length !== 64) { pubKey = cryptoUtils.secp256k1.publicKeyConvert(pubKey, false).slice(1); } // The uncompressed form consists of a 0x04 (in analogy to th...
javascript
function () { if (utils.isNull(this.address)) { var pubKey = this.getPublicKey(); if (pubKey.length !== 64) { pubKey = cryptoUtils.secp256k1.publicKeyConvert(pubKey, false).slice(1); } // The uncompressed form consists of a 0x04 (in analogy to th...
[ "function", "(", ")", "{", "if", "(", "utils", ".", "isNull", "(", "this", ".", "address", ")", ")", "{", "var", "pubKey", "=", "this", ".", "getPublicKey", "(", ")", ";", "if", "(", "pubKey", ".", "length", "!==", "64", ")", "{", "pubKey", "=", ...
Accaunt address getter. @return {Buffer} Account address. @example var publicKey = account.getAddress(); //<Buffer 7f 87 83 58 46 96 12 7d 1a c0 57 1a 42 87 c6 25 36 08 ff 32 61 36 51 7c>
[ "Accaunt", "address", "getter", "." ]
ad307a4be2015e5dba165ecab9c6e87104875f37
https://github.com/nebulasio/neb.js/blob/ad307a4be2015e5dba165ecab9c6e87104875f37/lib/account.js#L250-L272
20,746
nebulasio/neb.js
lib/account.js
function (password, opts) { /*jshint maxcomplexity:17 */ opts = opts || {}; var salt = opts.salt || cryptoUtils.crypto.randomBytes(32); var iv = opts.iv || cryptoUtils.crypto.randomBytes(16); var derivedKey; var kdf = opts.kdf || 'scrypt'; var kdfparams = { ...
javascript
function (password, opts) { /*jshint maxcomplexity:17 */ opts = opts || {}; var salt = opts.salt || cryptoUtils.crypto.randomBytes(32); var iv = opts.iv || cryptoUtils.crypto.randomBytes(16); var derivedKey; var kdf = opts.kdf || 'scrypt'; var kdfparams = { ...
[ "function", "(", "password", ",", "opts", ")", "{", "/*jshint maxcomplexity:17 */", "opts", "=", "opts", "||", "{", "}", ";", "var", "salt", "=", "opts", ".", "salt", "||", "cryptoUtils", ".", "crypto", ".", "randomBytes", "(", "32", ")", ";", "var", "...
Generate key buy passphrase and options. @param {Password} password - Provided password. @param {KeyOptions} opts - Key options. @return {Key} Key Object. @example var key = account.toKey("passphrase");
[ "Generate", "key", "buy", "passphrase", "and", "options", "." ]
ad307a4be2015e5dba165ecab9c6e87104875f37
https://github.com/nebulasio/neb.js/blob/ad307a4be2015e5dba165ecab9c6e87104875f37/lib/account.js#L295-L344
20,747
nebulasio/neb.js
lib/account.js
function (input, password, nonStrict) { /*jshint maxcomplexity:10 */ var json = (typeof input === 'object') ? input : JSON.parse(nonStrict ? input.toLowerCase() : input); if (json.version !== KeyVersion3 && json.version !== KeyCurrentVersion) { throw new Error('Not supported wallet ...
javascript
function (input, password, nonStrict) { /*jshint maxcomplexity:10 */ var json = (typeof input === 'object') ? input : JSON.parse(nonStrict ? input.toLowerCase() : input); if (json.version !== KeyVersion3 && json.version !== KeyCurrentVersion) { throw new Error('Not supported wallet ...
[ "function", "(", "input", ",", "password", ",", "nonStrict", ")", "{", "/*jshint maxcomplexity:10 */", "var", "json", "=", "(", "typeof", "input", "===", "'object'", ")", "?", "input", ":", "JSON", ".", "parse", "(", "nonStrict", "?", "input", ".", "toLowe...
Restore account from key and passphrase. @param {Key} input - Key Object. @param {Password} password - Provided password. @param {Boolean} nonStrict - Strict сase sensitivity flag. @return {@link Account} - Instance of Account restored from key and passphrase.
[ "Restore", "account", "from", "key", "and", "passphrase", "." ]
ad307a4be2015e5dba165ecab9c6e87104875f37
https://github.com/nebulasio/neb.js/blob/ad307a4be2015e5dba165ecab9c6e87104875f37/lib/account.js#L368-L411
20,748
nebulasio/neb.js
lib/transaction.js
function (options) { if (arguments.length > 0) { options = utils.argumentsToObject(['chainID', 'from', 'to', 'value', 'nonce', 'gasPrice', 'gasLimit', 'contract'], arguments); this.chainID = options.chainID; this.from = account.fromAddress(options.from); this.to = account.fromAddres...
javascript
function (options) { if (arguments.length > 0) { options = utils.argumentsToObject(['chainID', 'from', 'to', 'value', 'nonce', 'gasPrice', 'gasLimit', 'contract'], arguments); this.chainID = options.chainID; this.from = account.fromAddress(options.from); this.to = account.fromAddres...
[ "function", "(", "options", ")", "{", "if", "(", "arguments", ".", "length", ">", "0", ")", "{", "options", "=", "utils", ".", "argumentsToObject", "(", "[", "'chainID'", ",", "'from'", ",", "'to'", ",", "'value'", ",", "'nonce'", ",", "'gasPrice'", ",...
Represent Transaction parameters @typedef {Object} TransactionOptions @property {Number} options.chainID - Transaction chain id. @property {HexString} options.from - Hex string of the sender account addresss.. @property {HexString} options.to - Hex string of the receiver account addresss.. @property {Number} options.v...
[ "Represent", "Transaction", "parameters" ]
ad307a4be2015e5dba165ecab9c6e87104875f37
https://github.com/nebulasio/neb.js/blob/ad307a4be2015e5dba165ecab9c6e87104875f37/lib/transaction.js#L128-L154
20,749
nebulasio/neb.js
lib/transaction.js
function () { var Data = root.lookup("corepb.Data"); var err = Data.verify(this.data); if (err) { throw new Error(err); } var data = Data.create(this.data); var dataBuffer = Data.encode(data).finish(); var hash = cryptoUtils.sha3( this.from...
javascript
function () { var Data = root.lookup("corepb.Data"); var err = Data.verify(this.data); if (err) { throw new Error(err); } var data = Data.create(this.data); var dataBuffer = Data.encode(data).finish(); var hash = cryptoUtils.sha3( this.from...
[ "function", "(", ")", "{", "var", "Data", "=", "root", ".", "lookup", "(", "\"corepb.Data\"", ")", ";", "var", "err", "=", "Data", ".", "verify", "(", "this", ".", "data", ")", ";", "if", "(", "err", ")", "{", "throw", "new", "Error", "(", "err",...
Convert transaction to hash by SHA3-256 algorithm. @return {Hash} hash of Transaction. @example var acc = Account.NewAccount(); var tx = new Transaction({ chainID: 1, from: acc, to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17", value: 10, nonce: 12, gasPrice: 1000000, gasLimit: 2000000 }); var txHash = tx.hashTransaction()...
[ "Convert", "transaction", "to", "hash", "by", "SHA3", "-", "256", "algorithm", "." ]
ad307a4be2015e5dba165ecab9c6e87104875f37
https://github.com/nebulasio/neb.js/blob/ad307a4be2015e5dba165ecab9c6e87104875f37/lib/transaction.js#L254-L274
20,750
nebulasio/neb.js
lib/transaction.js
function () { if (this.from.getPrivateKey() !== null) { this.hash = this.hashTransaction(); this.alg = SECP256K1; this.sign = cryptoUtils.sign(this.hash, this.from.getPrivateKey()); } else { throw new Error("transaction from address's private key is invali...
javascript
function () { if (this.from.getPrivateKey() !== null) { this.hash = this.hashTransaction(); this.alg = SECP256K1; this.sign = cryptoUtils.sign(this.hash, this.from.getPrivateKey()); } else { throw new Error("transaction from address's private key is invali...
[ "function", "(", ")", "{", "if", "(", "this", ".", "from", ".", "getPrivateKey", "(", ")", "!==", "null", ")", "{", "this", ".", "hash", "=", "this", ".", "hashTransaction", "(", ")", ";", "this", ".", "alg", "=", "SECP256K1", ";", "this", ".", "...
Sign transaction with the specified algorithm. @example var acc = Account.NewAccount(); var tx = new Transaction({ chainID: 1, from: acc, to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17", value: 10, nonce: 12, gasPrice: 1000000, gasLimit: 2000000 }); tx.signTransaction();
[ "Sign", "transaction", "with", "the", "specified", "algorithm", "." ]
ad307a4be2015e5dba165ecab9c6e87104875f37
https://github.com/nebulasio/neb.js/blob/ad307a4be2015e5dba165ecab9c6e87104875f37/lib/transaction.js#L292-L300
20,751
nebulasio/neb.js
lib/transaction.js
function() { return { chainID: this.chainID, from: this.from.getAddressString(), to: this.to.getAddressString(), value: utils.isBigNumber(this.value) ? this.value.toNumber() : this.value, nonce: this.nonce, gasPrice: utils.isBigNumber(this....
javascript
function() { return { chainID: this.chainID, from: this.from.getAddressString(), to: this.to.getAddressString(), value: utils.isBigNumber(this.value) ? this.value.toNumber() : this.value, nonce: this.nonce, gasPrice: utils.isBigNumber(this....
[ "function", "(", ")", "{", "return", "{", "chainID", ":", "this", ".", "chainID", ",", "from", ":", "this", ".", "from", ".", "getAddressString", "(", ")", ",", "to", ":", "this", ".", "to", ".", "getAddressString", "(", ")", ",", "value", ":", "ut...
Conver transaction data to plain JavaScript object. @return {Object} Plain JavaScript object with Transaction fields. @example var acc = Account.NewAccount(); var tx = new Transaction({ chainID: 1, from: acc, to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17", value: 10, nonce: 12, gasPrice: 1000000, gasLimit: 2000000 }); txDa...
[ "Conver", "transaction", "data", "to", "plain", "JavaScript", "object", "." ]
ad307a4be2015e5dba165ecab9c6e87104875f37
https://github.com/nebulasio/neb.js/blob/ad307a4be2015e5dba165ecab9c6e87104875f37/lib/transaction.js#L319-L330
20,752
pillarjs/finalhandler
index.js
createHtmlDocument
function createHtmlDocument (message) { var body = escapeHtml(message) .replace(NEWLINE_REGEXP, '<br>') .replace(DOUBLE_SPACE_REGEXP, ' &nbsp;') return '<!DOCTYPE html>\n' + '<html lang="en">\n' + '<head>\n' + '<meta charset="utf-8">\n' + '<title>Error</title>\n' + '</head>\n' + '<b...
javascript
function createHtmlDocument (message) { var body = escapeHtml(message) .replace(NEWLINE_REGEXP, '<br>') .replace(DOUBLE_SPACE_REGEXP, ' &nbsp;') return '<!DOCTYPE html>\n' + '<html lang="en">\n' + '<head>\n' + '<meta charset="utf-8">\n' + '<title>Error</title>\n' + '</head>\n' + '<b...
[ "function", "createHtmlDocument", "(", "message", ")", "{", "var", "body", "=", "escapeHtml", "(", "message", ")", ".", "replace", "(", "NEWLINE_REGEXP", ",", "'<br>'", ")", ".", "replace", "(", "DOUBLE_SPACE_REGEXP", ",", "' &nbsp;'", ")", "return", "'<!DOCTY...
Create a minimal HTML document. @param {string} message @private
[ "Create", "a", "minimal", "HTML", "document", "." ]
1b2c36949db50aa766d4691a5f38eb6639d01d66
https://github.com/pillarjs/finalhandler/blob/1b2c36949db50aa766d4691a5f38eb6639d01d66/index.js#L43-L58
20,753
pillarjs/finalhandler
index.js
finalhandler
function finalhandler (req, res, options) { var opts = options || {} // get environment var env = opts.env || process.env.NODE_ENV || 'development' // get error callback var onerror = opts.onerror return function (err) { var headers var msg var status // ignore 404 on in-flight response ...
javascript
function finalhandler (req, res, options) { var opts = options || {} // get environment var env = opts.env || process.env.NODE_ENV || 'development' // get error callback var onerror = opts.onerror return function (err) { var headers var msg var status // ignore 404 on in-flight response ...
[ "function", "finalhandler", "(", "req", ",", "res", ",", "options", ")", "{", "var", "opts", "=", "options", "||", "{", "}", "// get environment", "var", "env", "=", "opts", ".", "env", "||", "process", ".", "env", ".", "NODE_ENV", "||", "'development'",...
Create a function to handle the final response. @param {Request} req @param {Response} res @param {Object} [options] @return {Function} @public
[ "Create", "a", "function", "to", "handle", "the", "final", "response", "." ]
1b2c36949db50aa766d4691a5f38eb6639d01d66
https://github.com/pillarjs/finalhandler/blob/1b2c36949db50aa766d4691a5f38eb6639d01d66/index.js#L77-L135
20,754
pillarjs/finalhandler
index.js
getErrorHeaders
function getErrorHeaders (err) { if (!err.headers || typeof err.headers !== 'object') { return undefined } var headers = Object.create(null) var keys = Object.keys(err.headers) for (var i = 0; i < keys.length; i++) { var key = keys[i] headers[key] = err.headers[key] } return headers }
javascript
function getErrorHeaders (err) { if (!err.headers || typeof err.headers !== 'object') { return undefined } var headers = Object.create(null) var keys = Object.keys(err.headers) for (var i = 0; i < keys.length; i++) { var key = keys[i] headers[key] = err.headers[key] } return headers }
[ "function", "getErrorHeaders", "(", "err", ")", "{", "if", "(", "!", "err", ".", "headers", "||", "typeof", "err", ".", "headers", "!==", "'object'", ")", "{", "return", "undefined", "}", "var", "headers", "=", "Object", ".", "create", "(", "null", ")"...
Get headers from Error object. @param {Error} err @return {object} @private
[ "Get", "headers", "from", "Error", "object", "." ]
1b2c36949db50aa766d4691a5f38eb6639d01d66
https://github.com/pillarjs/finalhandler/blob/1b2c36949db50aa766d4691a5f38eb6639d01d66/index.js#L145-L159
20,755
pillarjs/finalhandler
index.js
getErrorMessage
function getErrorMessage (err, status, env) { var msg if (env !== 'production') { // use err.stack, which typically includes err.message msg = err.stack // fallback to err.toString() when possible if (!msg && typeof err.toString === 'function') { msg = err.toString() } } return msg ...
javascript
function getErrorMessage (err, status, env) { var msg if (env !== 'production') { // use err.stack, which typically includes err.message msg = err.stack // fallback to err.toString() when possible if (!msg && typeof err.toString === 'function') { msg = err.toString() } } return msg ...
[ "function", "getErrorMessage", "(", "err", ",", "status", ",", "env", ")", "{", "var", "msg", "if", "(", "env", "!==", "'production'", ")", "{", "// use err.stack, which typically includes err.message", "msg", "=", "err", ".", "stack", "// fallback to err.toString()...
Get message from Error object, fallback to status message. @param {Error} err @param {number} status @param {string} env @return {string} @private
[ "Get", "message", "from", "Error", "object", "fallback", "to", "status", "message", "." ]
1b2c36949db50aa766d4691a5f38eb6639d01d66
https://github.com/pillarjs/finalhandler/blob/1b2c36949db50aa766d4691a5f38eb6639d01d66/index.js#L171-L185
20,756
pillarjs/finalhandler
index.js
getErrorStatusCode
function getErrorStatusCode (err) { // check err.status if (typeof err.status === 'number' && err.status >= 400 && err.status < 600) { return err.status } // check err.statusCode if (typeof err.statusCode === 'number' && err.statusCode >= 400 && err.statusCode < 600) { return err.statusCode } re...
javascript
function getErrorStatusCode (err) { // check err.status if (typeof err.status === 'number' && err.status >= 400 && err.status < 600) { return err.status } // check err.statusCode if (typeof err.statusCode === 'number' && err.statusCode >= 400 && err.statusCode < 600) { return err.statusCode } re...
[ "function", "getErrorStatusCode", "(", "err", ")", "{", "// check err.status", "if", "(", "typeof", "err", ".", "status", "===", "'number'", "&&", "err", ".", "status", ">=", "400", "&&", "err", ".", "status", "<", "600", ")", "{", "return", "err", ".", ...
Get status code from Error object. @param {Error} err @return {number} @private
[ "Get", "status", "code", "from", "Error", "object", "." ]
1b2c36949db50aa766d4691a5f38eb6639d01d66
https://github.com/pillarjs/finalhandler/blob/1b2c36949db50aa766d4691a5f38eb6639d01d66/index.js#L195-L207
20,757
pillarjs/finalhandler
index.js
getResponseStatusCode
function getResponseStatusCode (res) { var status = res.statusCode // default status code to 500 if outside valid range if (typeof status !== 'number' || status < 400 || status > 599) { status = 500 } return status }
javascript
function getResponseStatusCode (res) { var status = res.statusCode // default status code to 500 if outside valid range if (typeof status !== 'number' || status < 400 || status > 599) { status = 500 } return status }
[ "function", "getResponseStatusCode", "(", "res", ")", "{", "var", "status", "=", "res", ".", "statusCode", "// default status code to 500 if outside valid range", "if", "(", "typeof", "status", "!==", "'number'", "||", "status", "<", "400", "||", "status", ">", "5...
Get status code from response. @param {OutgoingMessage} res @return {number} @private
[ "Get", "status", "code", "from", "response", "." ]
1b2c36949db50aa766d4691a5f38eb6639d01d66
https://github.com/pillarjs/finalhandler/blob/1b2c36949db50aa766d4691a5f38eb6639d01d66/index.js#L236-L245
20,758
pillarjs/finalhandler
index.js
setHeaders
function setHeaders (res, headers) { if (!headers) { return } var keys = Object.keys(headers) for (var i = 0; i < keys.length; i++) { var key = keys[i] res.setHeader(key, headers[key]) } }
javascript
function setHeaders (res, headers) { if (!headers) { return } var keys = Object.keys(headers) for (var i = 0; i < keys.length; i++) { var key = keys[i] res.setHeader(key, headers[key]) } }
[ "function", "setHeaders", "(", "res", ",", "headers", ")", "{", "if", "(", "!", "headers", ")", "{", "return", "}", "var", "keys", "=", "Object", ".", "keys", "(", "headers", ")", "for", "(", "var", "i", "=", "0", ";", "i", "<", "keys", ".", "l...
Set response headers from an object. @param {OutgoingMessage} res @param {object} headers @private
[ "Set", "response", "headers", "from", "an", "object", "." ]
1b2c36949db50aa766d4691a5f38eb6639d01d66
https://github.com/pillarjs/finalhandler/blob/1b2c36949db50aa766d4691a5f38eb6639d01d66/index.js#L321-L331
20,759
Peer5/videojs-contrib-hls.js
src/videojs.hlsjs.js
Html5HlsJS
function Html5HlsJS(source, tech) { var options = tech.options_; var el = tech.el(); var duration = null; var hls = this.hls = new Hls(options.hlsjsConfig); /** * creates an error handler function * @returns {Function} */ function errorHandlerFactory() { var _recoverDecodingErrorDate = null; ...
javascript
function Html5HlsJS(source, tech) { var options = tech.options_; var el = tech.el(); var duration = null; var hls = this.hls = new Hls(options.hlsjsConfig); /** * creates an error handler function * @returns {Function} */ function errorHandlerFactory() { var _recoverDecodingErrorDate = null; ...
[ "function", "Html5HlsJS", "(", "source", ",", "tech", ")", "{", "var", "options", "=", "tech", ".", "options_", ";", "var", "el", "=", "tech", ".", "el", "(", ")", ";", "var", "duration", "=", "null", ";", "var", "hls", "=", "this", ".", "hls", "...
hls.js source handler @param source @param tech @constructor
[ "hls", ".", "js", "source", "handler" ]
9e1faddae5adbd27860b602376a705c793d5ff71
https://github.com/Peer5/videojs-contrib-hls.js/blob/9e1faddae5adbd27860b602376a705c793d5ff71/src/videojs.hlsjs.js#L15-L122
20,760
Peer5/videojs-contrib-hls.js
src/videojs.hlsjs.js
errorHandlerFactory
function errorHandlerFactory() { var _recoverDecodingErrorDate = null; var _recoverAudioCodecErrorDate = null; return function() { var now = Date.now(); if (!_recoverDecodingErrorDate || (now - _recoverDecodingErrorDate) > 2000) { _recoverDecodingErrorDate = now; hls.recoverMed...
javascript
function errorHandlerFactory() { var _recoverDecodingErrorDate = null; var _recoverAudioCodecErrorDate = null; return function() { var now = Date.now(); if (!_recoverDecodingErrorDate || (now - _recoverDecodingErrorDate) > 2000) { _recoverDecodingErrorDate = now; hls.recoverMed...
[ "function", "errorHandlerFactory", "(", ")", "{", "var", "_recoverDecodingErrorDate", "=", "null", ";", "var", "_recoverAudioCodecErrorDate", "=", "null", ";", "return", "function", "(", ")", "{", "var", "now", "=", "Date", ".", "now", "(", ")", ";", "if", ...
creates an error handler function @returns {Function}
[ "creates", "an", "error", "handler", "function" ]
9e1faddae5adbd27860b602376a705c793d5ff71
https://github.com/Peer5/videojs-contrib-hls.js/blob/9e1faddae5adbd27860b602376a705c793d5ff71/src/videojs.hlsjs.js#L25-L45
20,761
gfranko/jquery.selectBoxIt.js
src/javascripts/modules/jquery.selectBoxIt.core.js
function() { // Used to make sure the dropdown becomes focused (fixes IE issue) self.dropdown.trigger("focus", true); // The `click` handler logic will only be applied if the dropdown list is enabled if (!self.originalElem.disabled) { ...
javascript
function() { // Used to make sure the dropdown becomes focused (fixes IE issue) self.dropdown.trigger("focus", true); // The `click` handler logic will only be applied if the dropdown list is enabled if (!self.originalElem.disabled) { ...
[ "function", "(", ")", "{", "// Used to make sure the dropdown becomes focused (fixes IE issue)", "self", ".", "dropdown", ".", "trigger", "(", "\"focus\"", ",", "true", ")", ";", "// The `click` handler logic will only be applied if the dropdown list is enabled", "if", "(", "!"...
`click` event with the `selectBoxIt` namespace
[ "click", "event", "with", "the", "selectBoxIt", "namespace" ]
31d714060aa94d980be57b2fc052eb7ae73f486e
https://github.com/gfranko/jquery.selectBoxIt.js/blob/31d714060aa94d980be57b2fc052eb7ae73f486e/src/javascripts/modules/jquery.selectBoxIt.core.js#L1135-L1154
20,762
gfranko/jquery.selectBoxIt.js
src/javascripts/modules/jquery.selectBoxIt.core.js
function(e) { // Stores the `keycode` value in a local variable var currentKey = self._keyMappings[e.keyCode], keydownMethod = self._keydownMethods()[currentKey]; if(keydownMethod) { keydownMethod(); ...
javascript
function(e) { // Stores the `keycode` value in a local variable var currentKey = self._keyMappings[e.keyCode], keydownMethod = self._keydownMethods()[currentKey]; if(keydownMethod) { keydownMethod(); ...
[ "function", "(", "e", ")", "{", "// Stores the `keycode` value in a local variable", "var", "currentKey", "=", "self", ".", "_keyMappings", "[", "e", ".", "keyCode", "]", ",", "keydownMethod", "=", "self", ".", "_keydownMethods", "(", ")", "[", "currentKey", "]"...
`keydown` event with the `selectBoxIt` namespace. Catches all user keyboard navigations
[ "keydown", "event", "with", "the", "selectBoxIt", "namespace", ".", "Catches", "all", "user", "keyboard", "navigations" ]
31d714060aa94d980be57b2fc052eb7ae73f486e
https://github.com/gfranko/jquery.selectBoxIt.js/blob/31d714060aa94d980be57b2fc052eb7ae73f486e/src/javascripts/modules/jquery.selectBoxIt.core.js#L1237-L1262
20,763
gfranko/jquery.selectBoxIt.js
src/javascripts/modules/jquery.selectBoxIt.core.js
function(e) { if (!self.originalElem.disabled) { // Sets the current key to the `keyCode` value if `charCode` does not exist. Used for cross // browser support since IE uses `keyCode` instead of `charCode`. var currentKey = e....
javascript
function(e) { if (!self.originalElem.disabled) { // Sets the current key to the `keyCode` value if `charCode` does not exist. Used for cross // browser support since IE uses `keyCode` instead of `charCode`. var currentKey = e....
[ "function", "(", "e", ")", "{", "if", "(", "!", "self", ".", "originalElem", ".", "disabled", ")", "{", "// Sets the current key to the `keyCode` value if `charCode` does not exist. Used for cross", "// browser support since IE uses `keyCode` instead of `charCode`.", "var", "cur...
`keypress` event with the `selectBoxIt` namespace. Catches all user keyboard text searches since you can only reliably get character codes using the `keypress` event
[ "keypress", "event", "with", "the", "selectBoxIt", "namespace", ".", "Catches", "all", "user", "keyboard", "text", "searches", "since", "you", "can", "only", "reliably", "get", "character", "codes", "using", "the", "keypress", "event" ]
31d714060aa94d980be57b2fc052eb7ae73f486e
https://github.com/gfranko/jquery.selectBoxIt.js/blob/31d714060aa94d980be57b2fc052eb7ae73f486e/src/javascripts/modules/jquery.selectBoxIt.core.js#L1265-L1291
20,764
gfranko/jquery.selectBoxIt.js
src/javascripts/modules/jquery.selectBoxIt.core.js
function() { // Removes the hover class from the previous drop down option self.listItems.not($(this)).removeAttr("data-active"); $(this).attr("data-active", ""); var listIsHidden = self.list.is(":hidden"); if((self....
javascript
function() { // Removes the hover class from the previous drop down option self.listItems.not($(this)).removeAttr("data-active"); $(this).attr("data-active", ""); var listIsHidden = self.list.is(":hidden"); if((self....
[ "function", "(", ")", "{", "// Removes the hover class from the previous drop down option", "self", ".", "listItems", ".", "not", "(", "$", "(", "this", ")", ")", ".", "removeAttr", "(", "\"data-active\"", ")", ";", "$", "(", "this", ")", ".", "attr", "(", "...
Delegates the `focusin` event with the `selectBoxIt` namespace to the list items
[ "Delegates", "the", "focusin", "event", "with", "the", "selectBoxIt", "namespace", "to", "the", "list", "items" ]
31d714060aa94d980be57b2fc052eb7ae73f486e
https://github.com/gfranko/jquery.selectBoxIt.js/blob/31d714060aa94d980be57b2fc052eb7ae73f486e/src/javascripts/modules/jquery.selectBoxIt.core.js#L1367-L1385
20,765
gfranko/jquery.selectBoxIt.js
src/javascripts/modules/jquery.selectBoxIt.core.js
function() { if(nativeMousedown && !customShowHideEvent) { self._update($(this)); self.triggerEvent("option-mouseup"); // If the current drop down option is not disabled if ($(this).attr("data-disable...
javascript
function() { if(nativeMousedown && !customShowHideEvent) { self._update($(this)); self.triggerEvent("option-mouseup"); // If the current drop down option is not disabled if ($(this).attr("data-disable...
[ "function", "(", ")", "{", "if", "(", "nativeMousedown", "&&", "!", "customShowHideEvent", ")", "{", "self", ".", "_update", "(", "$", "(", "this", ")", ")", ";", "self", ".", "triggerEvent", "(", "\"option-mouseup\"", ")", ";", "// If the current drop down ...
Delegates the `focus` event with the `selectBoxIt` namespace to the list items
[ "Delegates", "the", "focus", "event", "with", "the", "selectBoxIt", "namespace", "to", "the", "list", "items" ]
31d714060aa94d980be57b2fc052eb7ae73f486e
https://github.com/gfranko/jquery.selectBoxIt.js/blob/31d714060aa94d980be57b2fc052eb7ae73f486e/src/javascripts/modules/jquery.selectBoxIt.core.js#L1388-L1406
20,766
gfranko/jquery.selectBoxIt.js
src/javascripts/modules/jquery.selectBoxIt.core.js
function() { // If the currently moused over drop down option is not disabled if($(this).attr("data-disabled") === "false") { self.listItems.removeAttr("data-active"); $(this).addClass(focusClass).attr("data-active", ""); ...
javascript
function() { // If the currently moused over drop down option is not disabled if($(this).attr("data-disabled") === "false") { self.listItems.removeAttr("data-active"); $(this).addClass(focusClass).attr("data-active", ""); ...
[ "function", "(", ")", "{", "// If the currently moused over drop down option is not disabled", "if", "(", "$", "(", "this", ")", ".", "attr", "(", "\"data-disabled\"", ")", "===", "\"false\"", ")", "{", "self", ".", "listItems", ".", "removeAttr", "(", "\"data-act...
Delegates the `mouseenter` event with the `selectBoxIt` namespace to the list items
[ "Delegates", "the", "mouseenter", "event", "with", "the", "selectBoxIt", "namespace", "to", "the", "list", "items" ]
31d714060aa94d980be57b2fc052eb7ae73f486e
https://github.com/gfranko/jquery.selectBoxIt.js/blob/31d714060aa94d980be57b2fc052eb7ae73f486e/src/javascripts/modules/jquery.selectBoxIt.core.js#L1409-L1427
20,767
gfranko/jquery.selectBoxIt.js
src/javascripts/modules/jquery.selectBoxIt.core.js
function(event, internal) { var currentOption, currentDataSelectedText; // If the user called the change method if(!internal) { currentOption = self.list.find('li[data-val="' + self.originalElem.value + '"]');...
javascript
function(event, internal) { var currentOption, currentDataSelectedText; // If the user called the change method if(!internal) { currentOption = self.list.find('li[data-val="' + self.originalElem.value + '"]');...
[ "function", "(", "event", ",", "internal", ")", "{", "var", "currentOption", ",", "currentDataSelectedText", ";", "// If the user called the change method", "if", "(", "!", "internal", ")", "{", "currentOption", "=", "self", ".", "list", ".", "find", "(", "'li[d...
`change` event handler with the `selectBoxIt` namespace
[ "change", "event", "handler", "with", "the", "selectBoxIt", "namespace" ]
31d714060aa94d980be57b2fc052eb7ae73f486e
https://github.com/gfranko/jquery.selectBoxIt.js/blob/31d714060aa94d980be57b2fc052eb7ae73f486e/src/javascripts/modules/jquery.selectBoxIt.core.js#L1472-L1516
20,768
gfranko/jquery.selectBoxIt.js
src/javascripts/modules/jquery.selectBoxIt.core.js
function() { var currentElem = self.list.find("li[data-val='" + self.dropdownText.attr("data-val") + "']"), activeElem; // If no current element can be found, then select the first drop down option if(!currentElem.length) { ...
javascript
function() { var currentElem = self.list.find("li[data-val='" + self.dropdownText.attr("data-val") + "']"), activeElem; // If no current element can be found, then select the first drop down option if(!currentElem.length) { ...
[ "function", "(", ")", "{", "var", "currentElem", "=", "self", ".", "list", ".", "find", "(", "\"li[data-val='\"", "+", "self", ".", "dropdownText", ".", "attr", "(", "\"data-val\"", ")", "+", "\"']\"", ")", ",", "activeElem", ";", "// If no current element c...
`open` event with the `selectBoxIt` namespace
[ "open", "event", "with", "the", "selectBoxIt", "namespace" ]
31d714060aa94d980be57b2fc052eb7ae73f486e
https://github.com/gfranko/jquery.selectBoxIt.js/blob/31d714060aa94d980be57b2fc052eb7ae73f486e/src/javascripts/modules/jquery.selectBoxIt.core.js#L1535-L1569
20,769
tj/node-querystring
index.js
compact
function compact(obj) { if ('object' != typeof obj) return obj; if (isArray(obj)) { var ret = []; for (var i in obj) { if (hasOwnProperty.call(obj, i)) { ret.push(obj[i]); } } return ret; } for (var key in obj) { obj[key] = compact(obj[key]); } return obj; }
javascript
function compact(obj) { if ('object' != typeof obj) return obj; if (isArray(obj)) { var ret = []; for (var i in obj) { if (hasOwnProperty.call(obj, i)) { ret.push(obj[i]); } } return ret; } for (var key in obj) { obj[key] = compact(obj[key]); } return obj; }
[ "function", "compact", "(", "obj", ")", "{", "if", "(", "'object'", "!=", "typeof", "obj", ")", "return", "obj", ";", "if", "(", "isArray", "(", "obj", ")", ")", "{", "var", "ret", "=", "[", "]", ";", "for", "(", "var", "i", "in", "obj", ")", ...
Compact sparse arrays.
[ "Compact", "sparse", "arrays", "." ]
2769b6e3a09a9dc9887be26ccd1effe9fea639d8
https://github.com/tj/node-querystring/blob/2769b6e3a09a9dc9887be26ccd1effe9fea639d8/index.js#L155-L175
20,770
tj/node-querystring
index.js
parseObject
function parseObject(obj){ var ret = { base: {} }; forEach(objectKeys(obj), function(name){ merge(ret, name, obj[name]); }); return compact(ret.base); }
javascript
function parseObject(obj){ var ret = { base: {} }; forEach(objectKeys(obj), function(name){ merge(ret, name, obj[name]); }); return compact(ret.base); }
[ "function", "parseObject", "(", "obj", ")", "{", "var", "ret", "=", "{", "base", ":", "{", "}", "}", ";", "forEach", "(", "objectKeys", "(", "obj", ")", ",", "function", "(", "name", ")", "{", "merge", "(", "ret", ",", "name", ",", "obj", "[", ...
Parse the given obj.
[ "Parse", "the", "given", "obj", "." ]
2769b6e3a09a9dc9887be26ccd1effe9fea639d8
https://github.com/tj/node-querystring/blob/2769b6e3a09a9dc9887be26ccd1effe9fea639d8/index.js#L181-L189
20,771
tj/node-querystring
index.js
parseString
function parseString(str, options){ var ret = reduce(String(str).split(options.separator), function(ret, pair){ var eql = indexOf(pair, '=') , brace = lastBraceInKey(pair) , key = pair.substr(0, brace || eql) , val = pair.substr(brace || eql, pair.length) , val = val.substr(indexOf(val, '=...
javascript
function parseString(str, options){ var ret = reduce(String(str).split(options.separator), function(ret, pair){ var eql = indexOf(pair, '=') , brace = lastBraceInKey(pair) , key = pair.substr(0, brace || eql) , val = pair.substr(brace || eql, pair.length) , val = val.substr(indexOf(val, '=...
[ "function", "parseString", "(", "str", ",", "options", ")", "{", "var", "ret", "=", "reduce", "(", "String", "(", "str", ")", ".", "split", "(", "options", ".", "separator", ")", ",", "function", "(", "ret", ",", "pair", ")", "{", "var", "eql", "="...
Parse the given str.
[ "Parse", "the", "given", "str", "." ]
2769b6e3a09a9dc9887be26ccd1effe9fea639d8
https://github.com/tj/node-querystring/blob/2769b6e3a09a9dc9887be26ccd1effe9fea639d8/index.js#L195-L211
20,772
AudithSoftworks/Uniform
src/js/jquery.uniform.js
bindMany
function bindMany($el, options, events) { var name, namespaced; for (name in events) { if (events.hasOwnProperty(name)) { namespaced = name.replace(/ |$/g, options.eventNamespace); $el.bind(namespaced, events[name]); } } }
javascript
function bindMany($el, options, events) { var name, namespaced; for (name in events) { if (events.hasOwnProperty(name)) { namespaced = name.replace(/ |$/g, options.eventNamespace); $el.bind(namespaced, events[name]); } } }
[ "function", "bindMany", "(", "$el", ",", "options", ",", "events", ")", "{", "var", "name", ",", "namespaced", ";", "for", "(", "name", "in", "events", ")", "{", "if", "(", "events", ".", "hasOwnProperty", "(", "name", ")", ")", "{", "namespaced", "=...
For backwards compatibility with older jQuery libraries, only bind one thing at a time. Also, this function adds our namespace to events in one consistent location, shrinking the minified code. The properties on the events object are the names of the events that we are supposed to add to. It can be a space separated...
[ "For", "backwards", "compatibility", "with", "older", "jQuery", "libraries", "only", "bind", "one", "thing", "at", "a", "time", ".", "Also", "this", "function", "adds", "our", "namespace", "to", "events", "in", "one", "consistent", "location", "shrinking", "th...
e1c0583a4fe06493e9fb35c8fadc46b6f1de0423
https://github.com/AudithSoftworks/Uniform/blob/e1c0583a4fe06493e9fb35c8fadc46b6f1de0423/src/js/jquery.uniform.js#L49-L58
20,773
AudithSoftworks/Uniform
src/js/jquery.uniform.js
bindUi
function bindUi($el, $target, options) { bindMany($el, options, { focus: function () { $target.addClass(options.focusClass); }, blur: function () { $target.removeClass(options.focusClass); $target.removeClass(options.activeClass...
javascript
function bindUi($el, $target, options) { bindMany($el, options, { focus: function () { $target.addClass(options.focusClass); }, blur: function () { $target.removeClass(options.focusClass); $target.removeClass(options.activeClass...
[ "function", "bindUi", "(", "$el", ",", "$target", ",", "options", ")", "{", "bindMany", "(", "$el", ",", "options", ",", "{", "focus", ":", "function", "(", ")", "{", "$target", ".", "addClass", "(", "options", ".", "focusClass", ")", ";", "}", ",", ...
Bind the hover, active, focus, and blur UI updates @param {jQuery} $el Original element @param {jQuery} $target Target for the events (our div/span) @param {Object} options Uniform options for the element $target
[ "Bind", "the", "hover", "active", "focus", "and", "blur", "UI", "updates" ]
e1c0583a4fe06493e9fb35c8fadc46b6f1de0423
https://github.com/AudithSoftworks/Uniform/blob/e1c0583a4fe06493e9fb35c8fadc46b6f1de0423/src/js/jquery.uniform.js#L67-L92
20,774
AudithSoftworks/Uniform
src/js/jquery.uniform.js
divSpanWrap
function divSpanWrap($el, $container, method) { switch (method) { case "after": // Result: <element /> <container /> $el.after($container); return $el.next(); case "before": // Result: <container /> <element /> ...
javascript
function divSpanWrap($el, $container, method) { switch (method) { case "after": // Result: <element /> <container /> $el.after($container); return $el.next(); case "before": // Result: <container /> <element /> ...
[ "function", "divSpanWrap", "(", "$el", ",", "$container", ",", "method", ")", "{", "switch", "(", "method", ")", "{", "case", "\"after\"", ":", "// Result: <element /> <container />", "$el", ".", "after", "(", "$container", ")", ";", "return", "$el", ".", "...
Wrap an element inside of a container or put the container next to the element. See the code for examples of the different methods. Returns the container that was added to the HTML. @param {jQuery} $el Element to wrap @param {jQuery} $container Add this new container around/near $el @param {String} method One of "af...
[ "Wrap", "an", "element", "inside", "of", "a", "container", "or", "put", "the", "container", "next", "to", "the", "element", ".", "See", "the", "code", "for", "examples", "of", "the", "different", "methods", "." ]
e1c0583a4fe06493e9fb35c8fadc46b6f1de0423
https://github.com/AudithSoftworks/Uniform/blob/e1c0583a4fe06493e9fb35c8fadc46b6f1de0423/src/js/jquery.uniform.js#L176-L193
20,775
AudithSoftworks/Uniform
src/js/jquery.uniform.js
highContrast
function highContrast() { var c, $div, el, rgb; // High contrast mode deals with white and black rgb = 'rgb(120,2,153)'; $div = $('<div style="width:0;height:0;color:' + rgb + '">'); $('body').append($div); el = $div.get(0); // $div.css() will get the style defi...
javascript
function highContrast() { var c, $div, el, rgb; // High contrast mode deals with white and black rgb = 'rgb(120,2,153)'; $div = $('<div style="width:0;height:0;color:' + rgb + '">'); $('body').append($div); el = $div.get(0); // $div.css() will get the style defi...
[ "function", "highContrast", "(", ")", "{", "var", "c", ",", "$div", ",", "el", ",", "rgb", ";", "// High contrast mode deals with white and black", "rgb", "=", "'rgb(120,2,153)'", ";", "$div", "=", "$", "(", "'<div style=\"width:0;height:0;color:'", "+", "rgb", "+...
Test if high contrast mode is enabled. In high contrast mode, background images can not be set and they are always returned as 'none'. @return {Boolean} True if in high contrast mode
[ "Test", "if", "high", "contrast", "mode", "is", "enabled", "." ]
e1c0583a4fe06493e9fb35c8fadc46b6f1de0423
https://github.com/AudithSoftworks/Uniform/blob/e1c0583a4fe06493e9fb35c8fadc46b6f1de0423/src/js/jquery.uniform.js#L286-L305
20,776
AudithSoftworks/Uniform
src/js/jquery.uniform.js
setFilename
function setFilename($el, $filenameTag, options) { var filenames = $.map($el[0].files, function (file) {return file.name}).join(', '); if (filenames === "") { filenames = options.fileDefaultHtml; } else { filenames = filenames.split(/[\/\\]+/); filenames = fi...
javascript
function setFilename($el, $filenameTag, options) { var filenames = $.map($el[0].files, function (file) {return file.name}).join(', '); if (filenames === "") { filenames = options.fileDefaultHtml; } else { filenames = filenames.split(/[\/\\]+/); filenames = fi...
[ "function", "setFilename", "(", "$el", ",", "$filenameTag", ",", "options", ")", "{", "var", "filenames", "=", "$", ".", "map", "(", "$el", "[", "0", "]", ".", "files", ",", "function", "(", "file", ")", "{", "return", "file", ".", "name", "}", ")"...
Updates the filename tag based on the value of the real input element. @param {jQuery} $el Actual form element @param {jQuery} $filenameTag Span/div to update @param {Object} options Uniform options for this element
[ "Updates", "the", "filename", "tag", "based", "on", "the", "value", "of", "the", "real", "input", "element", "." ]
e1c0583a4fe06493e9fb35c8fadc46b6f1de0423
https://github.com/AudithSoftworks/Uniform/blob/e1c0583a4fe06493e9fb35c8fadc46b6f1de0423/src/js/jquery.uniform.js#L396-L407
20,777
AudithSoftworks/Uniform
src/js/jquery.uniform.js
swap
function swap($elements, newCss, callback) { var restore, item; restore = []; $elements.each(function () { var name; for (name in newCss) { if (Object.prototype.hasOwnProperty.call(newCss, name)) { restore.push({ ...
javascript
function swap($elements, newCss, callback) { var restore, item; restore = []; $elements.each(function () { var name; for (name in newCss) { if (Object.prototype.hasOwnProperty.call(newCss, name)) { restore.push({ ...
[ "function", "swap", "(", "$elements", ",", "newCss", ",", "callback", ")", "{", "var", "restore", ",", "item", ";", "restore", "=", "[", "]", ";", "$elements", ".", "each", "(", "function", "(", ")", "{", "var", "name", ";", "for", "(", "name", "in...
Function from jQuery to swap some CSS values, run a callback, then restore the CSS. Modified to pass JSLint and handle undefined values with 'use strict'. @param {jQuery} $elements Element @param {Object} newCss CSS values to swap out @param {Function} callback Function to run
[ "Function", "from", "jQuery", "to", "swap", "some", "CSS", "values", "run", "a", "callback", "then", "restore", "the", "CSS", ".", "Modified", "to", "pass", "JSLint", "and", "handle", "undefined", "values", "with", "use", "strict", "." ]
e1c0583a4fe06493e9fb35c8fadc46b6f1de0423
https://github.com/AudithSoftworks/Uniform/blob/e1c0583a4fe06493e9fb35c8fadc46b6f1de0423/src/js/jquery.uniform.js#L418-L445
20,778
AudithSoftworks/Uniform
src/js/jquery.uniform.js
sizingInvisible
function sizingInvisible($el, callback) { var targets; // We wish to target ourselves and any parents as long as // they are not visible targets = $el.parents(); targets.push($el[0]); targets = targets.not(':visible'); swap(targets, { visibility: "hid...
javascript
function sizingInvisible($el, callback) { var targets; // We wish to target ourselves and any parents as long as // they are not visible targets = $el.parents(); targets.push($el[0]); targets = targets.not(':visible'); swap(targets, { visibility: "hid...
[ "function", "sizingInvisible", "(", "$el", ",", "callback", ")", "{", "var", "targets", ";", "// We wish to target ourselves and any parents as long as", "// they are not visible", "targets", "=", "$el", ".", "parents", "(", ")", ";", "targets", ".", "push", "(", "$...
The browser doesn't provide sizes of elements that are not visible. This will clone an element and add it to the DOM for calculations. @param {jQuery} $el @param {Function} callback
[ "The", "browser", "doesn", "t", "provide", "sizes", "of", "elements", "that", "are", "not", "visible", ".", "This", "will", "clone", "an", "element", "and", "add", "it", "to", "the", "DOM", "for", "calculations", "." ]
e1c0583a4fe06493e9fb35c8fadc46b6f1de0423
https://github.com/AudithSoftworks/Uniform/blob/e1c0583a4fe06493e9fb35c8fadc46b6f1de0423/src/js/jquery.uniform.js#L454-L467
20,779
shakilsiraj/json-object-mapper
dist/ObjectMapper.js
function (typeName) { switch (typeName) { case Constants.STRING_TYPE: return true; case Constants.NUMBER_TYPE: return true; case Constants.BOOLEAN_TYPE: return true; case Constants.DATE_TYPE: return true; case Constants.STRING_TYPE_LOWERCASE: return true; case Constan...
javascript
function (typeName) { switch (typeName) { case Constants.STRING_TYPE: return true; case Constants.NUMBER_TYPE: return true; case Constants.BOOLEAN_TYPE: return true; case Constants.DATE_TYPE: return true; case Constants.STRING_TYPE_LOWERCASE: return true; case Constan...
[ "function", "(", "typeName", ")", "{", "switch", "(", "typeName", ")", "{", "case", "Constants", ".", "STRING_TYPE", ":", "return", "true", ";", "case", "Constants", ".", "NUMBER_TYPE", ":", "return", "true", ";", "case", "Constants", ".", "BOOLEAN_TYPE", ...
Checks to see if the specified type is a standard JS object type.
[ "Checks", "to", "see", "if", "the", "specified", "type", "is", "a", "standard", "JS", "object", "type", "." ]
718c8f8697080bdf7eb44701e34065b87be08e9c
https://github.com/shakilsiraj/json-object-mapper/blob/718c8f8697080bdf7eb44701e34065b87be08e9c/dist/ObjectMapper.js#L61-L73
20,780
shakilsiraj/json-object-mapper
dist/ObjectMapper.js
function (metadata) { if (typeof metadata === 'string') { return getJsonPropertyDecorator({ name: metadata, required: false, access: exports.AccessType.BOTH }); } else { return getJsonPropertyDecorator(metadata); } }
javascript
function (metadata) { if (typeof metadata === 'string') { return getJsonPropertyDecorator({ name: metadata, required: false, access: exports.AccessType.BOTH }); } else { return getJsonPropertyDecorator(metadata); } }
[ "function", "(", "metadata", ")", "{", "if", "(", "typeof", "metadata", "===", "'string'", ")", "{", "return", "getJsonPropertyDecorator", "(", "{", "name", ":", "metadata", ",", "required", ":", "false", ",", "access", ":", "exports", ".", "AccessType", "...
JsonProperty Decorator function.
[ "JsonProperty", "Decorator", "function", "." ]
718c8f8697080bdf7eb44701e34065b87be08e9c
https://github.com/shakilsiraj/json-object-mapper/blob/718c8f8697080bdf7eb44701e34065b87be08e9c/dist/ObjectMapper.js#L132-L139
20,781
shakilsiraj/json-object-mapper
dist/ObjectMapper.js
function (instance, instanceKey, type, json, jsonKey) { var jsonObject = (jsonKey !== undefined) ? (json[jsonKey] || []) : json; var jsonArraySize = jsonObject.length; var conversionFunctionsList = []; var arrayInstance = []; instance[instanceKey] = arrayInstance; if (jsonArraySize > 0) { ...
javascript
function (instance, instanceKey, type, json, jsonKey) { var jsonObject = (jsonKey !== undefined) ? (json[jsonKey] || []) : json; var jsonArraySize = jsonObject.length; var conversionFunctionsList = []; var arrayInstance = []; instance[instanceKey] = arrayInstance; if (jsonArraySize > 0) { ...
[ "function", "(", "instance", ",", "instanceKey", ",", "type", ",", "json", ",", "jsonKey", ")", "{", "var", "jsonObject", "=", "(", "jsonKey", "!==", "undefined", ")", "?", "(", "json", "[", "jsonKey", "]", "||", "[", "]", ")", ":", "json", ";", "v...
Deserializes a JS array type from json.
[ "Deserializes", "a", "JS", "array", "type", "from", "json", "." ]
718c8f8697080bdf7eb44701e34065b87be08e9c
https://github.com/shakilsiraj/json-object-mapper/blob/718c8f8697080bdf7eb44701e34065b87be08e9c/dist/ObjectMapper.js#L205-L227
20,782
shakilsiraj/json-object-mapper
dist/ObjectMapper.js
function (key, instance, serializer) { var value = serializer.serialize(instance); if (key !== undefined) { return "\"" + key + "\":" + value; } else { return value; } }
javascript
function (key, instance, serializer) { var value = serializer.serialize(instance); if (key !== undefined) { return "\"" + key + "\":" + value; } else { return value; } }
[ "function", "(", "key", ",", "instance", ",", "serializer", ")", "{", "var", "value", "=", "serializer", ".", "serialize", "(", "instance", ")", ";", "if", "(", "key", "!==", "undefined", ")", "{", "return", "\"\\\"\"", "+", "key", "+", "\"\\\":\"", "+...
Serialize any type with key value pairs
[ "Serialize", "any", "type", "with", "key", "value", "pairs" ]
718c8f8697080bdf7eb44701e34065b87be08e9c
https://github.com/shakilsiraj/json-object-mapper/blob/718c8f8697080bdf7eb44701e34065b87be08e9c/dist/ObjectMapper.js#L462-L470
20,783
klaascuvelier/gulp-copy
lib/gulp-copy.js
gulpCopy
function gulpCopy(destination, opts) { const throughOptions = { objectMode: true }; // Make sure a destination was verified if (typeof destination !== 'string') { throw new PluginError('gulp-copy', 'No valid destination specified'); } // Default options if (opts === undefined) { ...
javascript
function gulpCopy(destination, opts) { const throughOptions = { objectMode: true }; // Make sure a destination was verified if (typeof destination !== 'string') { throw new PluginError('gulp-copy', 'No valid destination specified'); } // Default options if (opts === undefined) { ...
[ "function", "gulpCopy", "(", "destination", ",", "opts", ")", "{", "const", "throughOptions", "=", "{", "objectMode", ":", "true", "}", ";", "// Make sure a destination was verified", "if", "(", "typeof", "destination", "!==", "'string'", ")", "{", "throw", "new...
gulp copy method @param {string} destination @param {object} opts @returns {object}
[ "gulp", "copy", "method" ]
4b4c3391b3704f14c7edb9f2fc149e4f801d26b1
https://github.com/klaascuvelier/gulp-copy/blob/4b4c3391b3704f14c7edb9f2fc149e4f801d26b1/lib/gulp-copy.js#L14-L77
20,784
klaascuvelier/gulp-copy
lib/gulp-copy.js
createDestination
function createDestination(destination) { const folders = destination.split(separator); const pathParts = []; const l = folders.length; // for absolute paths if (folders[0] === '') { pathParts.push(separator); folders.shift(); } for (let i = 0; i < l; i++) { pathPar...
javascript
function createDestination(destination) { const folders = destination.split(separator); const pathParts = []; const l = folders.length; // for absolute paths if (folders[0] === '') { pathParts.push(separator); folders.shift(); } for (let i = 0; i < l; i++) { pathPar...
[ "function", "createDestination", "(", "destination", ")", "{", "const", "folders", "=", "destination", ".", "split", "(", "separator", ")", ";", "const", "pathParts", "=", "[", "]", ";", "const", "l", "=", "folders", ".", "length", ";", "// for absolute path...
Recursively creates the path @param {string} destination
[ "Recursively", "creates", "the", "path" ]
4b4c3391b3704f14c7edb9f2fc149e4f801d26b1
https://github.com/klaascuvelier/gulp-copy/blob/4b4c3391b3704f14c7edb9f2fc149e4f801d26b1/lib/gulp-copy.js#L83-L105
20,785
klaascuvelier/gulp-copy
lib/gulp-copy.js
doesPathExist
function doesPathExist(pathToVerify) { let pathExists = true; try { fs.accessSync(pathToVerify); } catch (error) { pathExists = false; } return pathExists; }
javascript
function doesPathExist(pathToVerify) { let pathExists = true; try { fs.accessSync(pathToVerify); } catch (error) { pathExists = false; } return pathExists; }
[ "function", "doesPathExist", "(", "pathToVerify", ")", "{", "let", "pathExists", "=", "true", ";", "try", "{", "fs", ".", "accessSync", "(", "pathToVerify", ")", ";", "}", "catch", "(", "error", ")", "{", "pathExists", "=", "false", ";", "}", "return", ...
Check if the path exists @param path @returns {boolean}
[ "Check", "if", "the", "path", "exists" ]
4b4c3391b3704f14c7edb9f2fc149e4f801d26b1
https://github.com/klaascuvelier/gulp-copy/blob/4b4c3391b3704f14c7edb9f2fc149e4f801d26b1/lib/gulp-copy.js#L112-L122
20,786
klaascuvelier/gulp-copy
lib/gulp-copy.js
copyFile
function copyFile(source, target, copyCallback) { const readStream = fs.createReadStream(source); const writeStream = fs.createWriteStream(target); let done = false; readStream.on('error', copyDone); writeStream.on('error', copyDone); writeStream.on('close', function onWriteCb() { copy...
javascript
function copyFile(source, target, copyCallback) { const readStream = fs.createReadStream(source); const writeStream = fs.createWriteStream(target); let done = false; readStream.on('error', copyDone); writeStream.on('error', copyDone); writeStream.on('close', function onWriteCb() { copy...
[ "function", "copyFile", "(", "source", ",", "target", ",", "copyCallback", ")", "{", "const", "readStream", "=", "fs", ".", "createReadStream", "(", "source", ")", ";", "const", "writeStream", "=", "fs", ".", "createWriteStream", "(", "target", ")", ";", "...
Copy a file to its new destination @param {string} source @param {string} target @param {function} copyCallback
[ "Copy", "a", "file", "to", "its", "new", "destination" ]
4b4c3391b3704f14c7edb9f2fc149e4f801d26b1
https://github.com/klaascuvelier/gulp-copy/blob/4b4c3391b3704f14c7edb9f2fc149e4f801d26b1/lib/gulp-copy.js#L130-L154
20,787
eslint/eslint-scope
lib/index.js
defaultOptions
function defaultOptions() { return { optimistic: false, directive: false, nodejsScope: false, impliedStrict: false, sourceType: "script", // one of ['script', 'module'] ecmaVersion: 5, childVisitorKeys: null, fallback: "iteration" }; }
javascript
function defaultOptions() { return { optimistic: false, directive: false, nodejsScope: false, impliedStrict: false, sourceType: "script", // one of ['script', 'module'] ecmaVersion: 5, childVisitorKeys: null, fallback: "iteration" }; }
[ "function", "defaultOptions", "(", ")", "{", "return", "{", "optimistic", ":", "false", ",", "directive", ":", "false", ",", "nodejsScope", ":", "false", ",", "impliedStrict", ":", "false", ",", "sourceType", ":", "\"script\"", ",", "// one of ['script', 'module...
Set the default options @returns {Object} options
[ "Set", "the", "default", "options" ]
5d2ec4fa322095067bd5a262b0c218d1bdf9270c
https://github.com/eslint/eslint-scope/blob/5d2ec4fa322095067bd5a262b0c218d1bdf9270c/lib/index.js#L65-L76
20,788
eslint/eslint-scope
lib/index.js
updateDeeply
function updateDeeply(target, override) { /** * Is hash object * @param {Object} value - Test value * @returns {boolean} Result */ function isHashObject(value) { return typeof value === "object" && value instanceof Object && !(value instanceof Array) && !(value instanceof RegExp); ...
javascript
function updateDeeply(target, override) { /** * Is hash object * @param {Object} value - Test value * @returns {boolean} Result */ function isHashObject(value) { return typeof value === "object" && value instanceof Object && !(value instanceof Array) && !(value instanceof RegExp); ...
[ "function", "updateDeeply", "(", "target", ",", "override", ")", "{", "/**\n * Is hash object\n * @param {Object} value - Test value\n * @returns {boolean} Result\n */", "function", "isHashObject", "(", "value", ")", "{", "return", "typeof", "value", "===", "\"o...
Preform deep update on option object @param {Object} target - Options @param {Object} override - Updates @returns {Object} Updated options
[ "Preform", "deep", "update", "on", "option", "object" ]
5d2ec4fa322095067bd5a262b0c218d1bdf9270c
https://github.com/eslint/eslint-scope/blob/5d2ec4fa322095067bd5a262b0c218d1bdf9270c/lib/index.js#L84-L111
20,789
aws/awsmobile-cli
lib/utils/directory-file-ops.js
getDirContentMTime
function getDirContentMTime(dirPath, ignoredDirs, ignoredFiles){ let mtime if(fs.existsSync(dirPath)){ _ignoredDirs.push.apply(_ignoredDirs, ignoredDirs) _ignoredFiles.push.apply(_ignoredFiles, ignoredFiles) mtime = recursiveGetDirContentMTime(dirPath) } return mtime }
javascript
function getDirContentMTime(dirPath, ignoredDirs, ignoredFiles){ let mtime if(fs.existsSync(dirPath)){ _ignoredDirs.push.apply(_ignoredDirs, ignoredDirs) _ignoredFiles.push.apply(_ignoredFiles, ignoredFiles) mtime = recursiveGetDirContentMTime(dirPath) } return mtime }
[ "function", "getDirContentMTime", "(", "dirPath", ",", "ignoredDirs", ",", "ignoredFiles", ")", "{", "let", "mtime", "if", "(", "fs", ".", "existsSync", "(", "dirPath", ")", ")", "{", "_ignoredDirs", ".", "push", ".", "apply", "(", "_ignoredDirs", ",", "ig...
get the last modification time of the directory including its files and subdirectories
[ "get", "the", "last", "modification", "time", "of", "the", "directory", "including", "its", "files", "and", "subdirectories" ]
dc17aeb3975f5f3a039ed2d8a24bb2ba5ff373be
https://github.com/aws/awsmobile-cli/blob/dc17aeb3975f5f3a039ed2d8a24bb2ba5ff373be/lib/utils/directory-file-ops.js#L21-L29
20,790
aws/awsmobile-cli
lib/backend-operations/backend-spec-manager.js
onClearBackend
function onClearBackend(projectInfo){ let backendProject = getBackendProjectObject(projectInfo) if(backendProject){ backendProject.name = '' setBackendProjectObject(backendProject, projectInfo) } }
javascript
function onClearBackend(projectInfo){ let backendProject = getBackendProjectObject(projectInfo) if(backendProject){ backendProject.name = '' setBackendProjectObject(backendProject, projectInfo) } }
[ "function", "onClearBackend", "(", "projectInfo", ")", "{", "let", "backendProject", "=", "getBackendProjectObject", "(", "projectInfo", ")", "if", "(", "backendProject", ")", "{", "backendProject", ".", "name", "=", "''", "setBackendProjectObject", "(", "backendPro...
happens with delete or detach backend project
[ "happens", "with", "delete", "or", "detach", "backend", "project" ]
dc17aeb3975f5f3a039ed2d8a24bb2ba5ff373be
https://github.com/aws/awsmobile-cli/blob/dc17aeb3975f5f3a039ed2d8a24bb2ba5ff373be/lib/backend-operations/backend-spec-manager.js#L183-L189
20,791
angular/router
src/ngRoute_shim.js
routeObjToRouteName
function routeObjToRouteName(route, path) { var name = route.controllerAs; var controller = route.controller; if (!name && controller) { if (angular.isArray(controller)) { controller = controller[controller.length - 1]; } name = controller.name; } if (!name) { var s...
javascript
function routeObjToRouteName(route, path) { var name = route.controllerAs; var controller = route.controller; if (!name && controller) { if (angular.isArray(controller)) { controller = controller[controller.length - 1]; } name = controller.name; } if (!name) { var s...
[ "function", "routeObjToRouteName", "(", "route", ",", "path", ")", "{", "var", "name", "=", "route", ".", "controllerAs", ";", "var", "controller", "=", "route", ".", "controller", ";", "if", "(", "!", "name", "&&", "controller", ")", "{", "if", "(", "...
Given a route object, attempts to find a unique directive name. @param route – route config object passed to $routeProvider.when @param path – route configuration path @returns {string|name} – a normalized (camelCase) directive name
[ "Given", "a", "route", "object", "attempts", "to", "find", "a", "unique", "directive", "name", "." ]
f642b4caad6501609182487ce5e7107d9876d912
https://github.com/angular/router/blob/f642b4caad6501609182487ce5e7107d9876d912/src/ngRoute_shim.js#L300-L321
20,792
nikku/node-xsd-schema-validator
lib/validator.js
Validator
function Validator(options) { options = options || {}; this.cwd = options.cwd || process.cwd(); this.debug = !!options.debug; }
javascript
function Validator(options) { options = options || {}; this.cwd = options.cwd || process.cwd(); this.debug = !!options.debug; }
[ "function", "Validator", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "this", ".", "cwd", "=", "options", ".", "cwd", "||", "process", ".", "cwd", "(", ")", ";", "this", ".", "debug", "=", "!", "!", "options", ".", "d...
Pass the current working directory as an argument @param {Object} [options] directory to search for schema resources and includes.
[ "Pass", "the", "current", "working", "directory", "as", "an", "argument" ]
fac2fb3f9ee6d1c8bbc993a2ba857a01d44b1f79
https://github.com/nikku/node-xsd-schema-validator/blob/fac2fb3f9ee6d1c8bbc993a2ba857a01d44b1f79/lib/validator.js#L48-L53
20,793
fonini/ckeditor-youtube-plugin
youtube/plugin.js
hmsToSeconds
function hmsToSeconds(time) { var arr = time.split(':'), s = 0, m = 1; while (arr.length > 0) { s += m * parseInt(arr.pop(), 10); m *= 60; } return s; }
javascript
function hmsToSeconds(time) { var arr = time.split(':'), s = 0, m = 1; while (arr.length > 0) { s += m * parseInt(arr.pop(), 10); m *= 60; } return s; }
[ "function", "hmsToSeconds", "(", "time", ")", "{", "var", "arr", "=", "time", ".", "split", "(", "':'", ")", ",", "s", "=", "0", ",", "m", "=", "1", ";", "while", "(", "arr", ".", "length", ">", "0", ")", "{", "s", "+=", "m", "*", "parseInt",...
Converts time in hms format to seconds only
[ "Converts", "time", "in", "hms", "format", "to", "seconds", "only" ]
74d69adfc32be83378adcf02b603095a380c92e2
https://github.com/fonini/ckeditor-youtube-plugin/blob/74d69adfc32be83378adcf02b603095a380c92e2/youtube/plugin.js#L381-L390
20,794
fonini/ckeditor-youtube-plugin
youtube/plugin.js
secondsToHms
function secondsToHms(seconds) { var h = Math.floor(seconds / 3600); var m = Math.floor((seconds / 60) % 60); var s = seconds % 60; var pad = function (n) { n = String(n); return n.length >= 2 ? n : "0" + n; }; if (h > 0) { return pad(h) + ':' + pad(m) + ':' + pad(s); } else { return pad(m) + ':' + pa...
javascript
function secondsToHms(seconds) { var h = Math.floor(seconds / 3600); var m = Math.floor((seconds / 60) % 60); var s = seconds % 60; var pad = function (n) { n = String(n); return n.length >= 2 ? n : "0" + n; }; if (h > 0) { return pad(h) + ':' + pad(m) + ':' + pad(s); } else { return pad(m) + ':' + pa...
[ "function", "secondsToHms", "(", "seconds", ")", "{", "var", "h", "=", "Math", ".", "floor", "(", "seconds", "/", "3600", ")", ";", "var", "m", "=", "Math", ".", "floor", "(", "(", "seconds", "/", "60", ")", "%", "60", ")", ";", "var", "s", "="...
Converts seconds to hms format
[ "Converts", "seconds", "to", "hms", "format" ]
74d69adfc32be83378adcf02b603095a380c92e2
https://github.com/fonini/ckeditor-youtube-plugin/blob/74d69adfc32be83378adcf02b603095a380c92e2/youtube/plugin.js#L395-L411
20,795
fonini/ckeditor-youtube-plugin
youtube/plugin.js
timeParamToSeconds
function timeParamToSeconds(param) { var componentValue = function (si) { var regex = new RegExp('(\\d+)' + si); return param.match(regex) ? parseInt(RegExp.$1, 10) : 0; }; return componentValue('h') * 3600 + componentValue('m') * 60 + componentValue('s'); }
javascript
function timeParamToSeconds(param) { var componentValue = function (si) { var regex = new RegExp('(\\d+)' + si); return param.match(regex) ? parseInt(RegExp.$1, 10) : 0; }; return componentValue('h') * 3600 + componentValue('m') * 60 + componentValue('s'); }
[ "function", "timeParamToSeconds", "(", "param", ")", "{", "var", "componentValue", "=", "function", "(", "si", ")", "{", "var", "regex", "=", "new", "RegExp", "(", "'(\\\\d+)'", "+", "si", ")", ";", "return", "param", ".", "match", "(", "regex", ")", "...
Converts time in youtube t-param format to seconds
[ "Converts", "time", "in", "youtube", "t", "-", "param", "format", "to", "seconds" ]
74d69adfc32be83378adcf02b603095a380c92e2
https://github.com/fonini/ckeditor-youtube-plugin/blob/74d69adfc32be83378adcf02b603095a380c92e2/youtube/plugin.js#L416-L425
20,796
brantwills/Angular-Paging
dist/paging.js
internalAction
function internalAction(scope, page) { // Block clicks we try to load the active page if (scope.page == page) { return; } // Block if we are forcing disabled if(scope.isDisabled) { return; } // Update the page in scope s...
javascript
function internalAction(scope, page) { // Block clicks we try to load the active page if (scope.page == page) { return; } // Block if we are forcing disabled if(scope.isDisabled) { return; } // Update the page in scope s...
[ "function", "internalAction", "(", "scope", ",", "page", ")", "{", "// Block clicks we try to load the active page", "if", "(", "scope", ".", "page", "==", "page", ")", "{", "return", ";", "}", "// Block if we are forcing disabled ", "if", "(", "scope", ".", "isDi...
Assign the method action to take when a page is clicked @param {Object} scope - The local directive scope object @param {int} page - The current page of interest
[ "Assign", "the", "method", "action", "to", "take", "when", "a", "page", "is", "clicked" ]
0c1bf95cdbe9ba66a6e767092ffb73136f9f789f
https://github.com/brantwills/Angular-Paging/blob/0c1bf95cdbe9ba66a6e767092ffb73136f9f789f/dist/paging.js#L208-L235
20,797
brantwills/Angular-Paging
dist/paging.js
addRange
function addRange(start, finish, scope) { // Add our items where i is the page number var i = 0; for (i = start; i <= finish; i++) { var pgHref = scope.pgHref.replace(regex, i); var liClass = scope.page == i ? scope.activeClass : ''; // Handle items th...
javascript
function addRange(start, finish, scope) { // Add our items where i is the page number var i = 0; for (i = start; i <= finish; i++) { var pgHref = scope.pgHref.replace(regex, i); var liClass = scope.page == i ? scope.activeClass : ''; // Handle items th...
[ "function", "addRange", "(", "start", ",", "finish", ",", "scope", ")", "{", "// Add our items where i is the page number", "var", "i", "=", "0", ";", "for", "(", "i", "=", "start", ";", "i", "<=", "finish", ";", "i", "++", ")", "{", "var", "pgHref", "...
Adds a range of numbers to our list The range is dependent on the start and finish parameters @param {int} start - The start of the range to add to the paging list @param {int} finish - The end of the range to add to the paging list @param {Object} scope - The local directive scope object
[ "Adds", "a", "range", "of", "numbers", "to", "our", "list", "The", "range", "is", "dependent", "on", "the", "start", "and", "finish", "parameters" ]
0c1bf95cdbe9ba66a6e767092ffb73136f9f789f
https://github.com/brantwills/Angular-Paging/blob/0c1bf95cdbe9ba66a6e767092ffb73136f9f789f/dist/paging.js#L352-L378
20,798
haydenbbickerton/vue-charts
dist/vue-charts.common.js
buildDataTable
function buildDataTable() { var self = this; var dataTable = new google.visualization.DataTable(); _.each(self.columns, function (value) { dataTable.addColumn(value); }); if (!_.isEmpty(self.rows)) { dataTable.addRows(self.rows); } return dataTable; }
javascript
function buildDataTable() { var self = this; var dataTable = new google.visualization.DataTable(); _.each(self.columns, function (value) { dataTable.addColumn(value); }); if (!_.isEmpty(self.rows)) { dataTable.addRows(self.rows); } return dataTable; }
[ "function", "buildDataTable", "(", ")", "{", "var", "self", "=", "this", ";", "var", "dataTable", "=", "new", "google", ".", "visualization", ".", "DataTable", "(", ")", ";", "_", ".", "each", "(", "self", ".", "columns", ",", "function", "(", "value",...
Initialize the datatable and add the initial data. @link https://developers.google.com/chart/interactive/docs/reference#DataTable @return object
[ "Initialize", "the", "datatable", "and", "add", "the", "initial", "data", "." ]
f8bb783dd2476d854389678d0abe45b35ad8014b
https://github.com/haydenbbickerton/vue-charts/blob/f8bb783dd2476d854389678d0abe45b35ad8014b/dist/vue-charts.common.js#L243-L257
20,799
haydenbbickerton/vue-charts
dist/vue-charts.common.js
updateDataTable
function updateDataTable() { var self = this; // Remove all data from the datatable. self.dataTable.removeRows(0, self.dataTable.getNumberOfRows()); self.dataTable.removeColumns(0, self.dataTable.getNumberOfColumns()); // Add _.each(self.columns, function (value) { self.dat...
javascript
function updateDataTable() { var self = this; // Remove all data from the datatable. self.dataTable.removeRows(0, self.dataTable.getNumberOfRows()); self.dataTable.removeColumns(0, self.dataTable.getNumberOfColumns()); // Add _.each(self.columns, function (value) { self.dat...
[ "function", "updateDataTable", "(", ")", "{", "var", "self", "=", "this", ";", "// Remove all data from the datatable.", "self", ".", "dataTable", ".", "removeRows", "(", "0", ",", "self", ".", "dataTable", ".", "getNumberOfRows", "(", ")", ")", ";", "self", ...
Update the datatable. @return void
[ "Update", "the", "datatable", "." ]
f8bb783dd2476d854389678d0abe45b35ad8014b
https://github.com/haydenbbickerton/vue-charts/blob/f8bb783dd2476d854389678d0abe45b35ad8014b/dist/vue-charts.common.js#L265-L280