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
32,400
Azure/azure-mobile-apps-js-client
sdk/src/Platform/cordova/sqliteSerializer.js
serializeValue
function serializeValue(value) { var type; if ( _.isNull(value) ) { type = ColumnType.Object; } else if ( _.isNumber(value) ) { type = ColumnType.Real; } else if ( _.isDate(value) ) { type = ColumnType.Date; } else if ( _.isBool(value) ) { type = ColumnType.Boolean; ...
javascript
function serializeValue(value) { var type; if ( _.isNull(value) ) { type = ColumnType.Object; } else if ( _.isNumber(value) ) { type = ColumnType.Real; } else if ( _.isDate(value) ) { type = ColumnType.Date; } else if ( _.isBool(value) ) { type = ColumnType.Boolean; ...
[ "function", "serializeValue", "(", "value", ")", "{", "var", "type", ";", "if", "(", "_", ".", "isNull", "(", "value", ")", ")", "{", "type", "=", "ColumnType", ".", "Object", ";", "}", "else", "if", "(", "_", ".", "isNumber", "(", "value", ")", ...
Serializes a JS value to its equivalent that will be stored in the store. This method is useful while querying to convert values to their store representations. @private
[ "Serializes", "a", "JS", "value", "to", "its", "equivalent", "that", "will", "be", "stored", "in", "the", "store", ".", "This", "method", "is", "useful", "while", "querying", "to", "convert", "values", "to", "their", "store", "representations", "." ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/Platform/cordova/sqliteSerializer.js#L299-L321
32,401
Azure/azure-mobile-apps-js-client
sdk/src/Utilities/taskRunner.js
run
function run(task) { return Platform.async(function(callback) { // parameter validation Validate.isFunction(task); Validate.isFunction(callback); // Add the task to the queue of pending tasks and trigger task processing queue.push({ ...
javascript
function run(task) { return Platform.async(function(callback) { // parameter validation Validate.isFunction(task); Validate.isFunction(callback); // Add the task to the queue of pending tasks and trigger task processing queue.push({ ...
[ "function", "run", "(", "task", ")", "{", "return", "Platform", ".", "async", "(", "function", "(", "callback", ")", "{", "// parameter validation", "Validate", ".", "isFunction", "(", "task", ")", ";", "Validate", ".", "isFunction", "(", "callback", ")", ...
Runs the specified task asynchronously after all the earlier tasks have completed @param task Function / task to be executed. The task can either be a synchronous function or can return a promise. @returns A promise that is resolved with the value returned by the task. If the task fails the promise is rejected.
[ "Runs", "the", "specified", "task", "asynchronously", "after", "all", "the", "earlier", "tasks", "have", "completed" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/Utilities/taskRunner.js#L27-L40
32,402
Azure/azure-mobile-apps-js-client
sdk/src/Utilities/taskRunner.js
processTask
function processTask() { setTimeout(function() { if (isBusy || queue.length === 0) { return; } isBusy = true; var next = queue.shift(), result, error; Platform.async(function(callback) { // Start a pro...
javascript
function processTask() { setTimeout(function() { if (isBusy || queue.length === 0) { return; } isBusy = true; var next = queue.shift(), result, error; Platform.async(function(callback) { // Start a pro...
[ "function", "processTask", "(", ")", "{", "setTimeout", "(", "function", "(", ")", "{", "if", "(", "isBusy", "||", "queue", ".", "length", "===", "0", ")", "{", "return", ";", "}", "isBusy", "=", "true", ";", "var", "next", "=", "queue", ".", "shif...
Asynchronously executes the first pending task
[ "Asynchronously", "executes", "the", "first", "pending", "task" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/Utilities/taskRunner.js#L45-L71
32,403
Azure/azure-mobile-apps-js-client
sdk/src/sync/pull.js
initialize
function initialize () { return pullTaskRunner.run(function() { return store.defineTable({ name: pulltimeTableName, columnDefinitions: { id: 'string', // column for storing queryId tableName: 'string', // column for storing tabl...
javascript
function initialize () { return pullTaskRunner.run(function() { return store.defineTable({ name: pulltimeTableName, columnDefinitions: { id: 'string', // column for storing queryId tableName: 'string', // column for storing tabl...
[ "function", "initialize", "(", ")", "{", "return", "pullTaskRunner", ".", "run", "(", "function", "(", ")", "{", "return", "store", ".", "defineTable", "(", "{", "name", ":", "pulltimeTableName", ",", "columnDefinitions", ":", "{", "id", ":", "'string'", "...
Creates and initializes the table used to store the state for performing incremental pull
[ "Creates", "and", "initializes", "the", "table", "used", "to", "store", "the", "state", "for", "performing", "incremental", "pull" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/pull.js#L42-L53
32,404
Azure/azure-mobile-apps-js-client
sdk/src/sync/pull.js
pull
function pull(query, queryId, settings) { //TODO: support pullQueryId //TODO: page size should be configurable return pullTaskRunner.run(function() { validateQuery(query, 'query'); Validate.isString(queryId, 'queryId'); // non-null string or null - both are valid...
javascript
function pull(query, queryId, settings) { //TODO: support pullQueryId //TODO: page size should be configurable return pullTaskRunner.run(function() { validateQuery(query, 'query'); Validate.isString(queryId, 'queryId'); // non-null string or null - both are valid...
[ "function", "pull", "(", "query", ",", "queryId", ",", "settings", ")", "{", "//TODO: support pullQueryId", "//TODO: page size should be configurable", "return", "pullTaskRunner", ".", "run", "(", "function", "(", ")", "{", "validateQuery", "(", "query", ",", "'quer...
Pulls changes from the server tables into the local store. @param query Query specifying which records to pull @param pullQueryId A unique string ID for an incremental pull query OR null for a vanilla pull query. @param [settings] An object that defines the various pull settings - currently only pageSize @returns A p...
[ "Pulls", "changes", "from", "the", "server", "tables", "into", "the", "local", "store", "." ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/pull.js#L64-L94
32,405
Azure/azure-mobile-apps-js-client
sdk/src/sync/pull.js
pullAllPages
function pullAllPages() { // 1. Pull one page // 2. Check if Pull is complete // 3. If it is complete, go to 5. If not, update the query to fetch the next page. // 4. Go to 1 // 5. DONE return pullPage().then(function(pulledRecords) { if (!isPullComplete(pulle...
javascript
function pullAllPages() { // 1. Pull one page // 2. Check if Pull is complete // 3. If it is complete, go to 5. If not, update the query to fetch the next page. // 4. Go to 1 // 5. DONE return pullPage().then(function(pulledRecords) { if (!isPullComplete(pulle...
[ "function", "pullAllPages", "(", ")", "{", "// 1. Pull one page", "// 2. Check if Pull is complete", "// 3. If it is complete, go to 5. If not, update the query to fetch the next page.", "// 4. Go to 1", "// 5. DONE", "return", "pullPage", "(", ")", ".", "then", "(", "function", ...
Pulls all pages from the server table, one page at a time.
[ "Pulls", "all", "pages", "from", "the", "server", "table", "one", "page", "at", "a", "time", "." ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/pull.js#L104-L118
32,406
Azure/azure-mobile-apps-js-client
sdk/src/sync/pull.js
pullPage
function pullPage() { // Define appropriate parameter to enable fetching of deleted records from the server. // Assumption is that soft delete is enabled on the server table. var params = {}; params[tableConstants.includeDeletedFlag] = true; var pulledRecords; ...
javascript
function pullPage() { // Define appropriate parameter to enable fetching of deleted records from the server. // Assumption is that soft delete is enabled on the server table. var params = {}; params[tableConstants.includeDeletedFlag] = true; var pulledRecords; ...
[ "function", "pullPage", "(", ")", "{", "// Define appropriate parameter to enable fetching of deleted records from the server.", "// Assumption is that soft delete is enabled on the server table.", "var", "params", "=", "{", "}", ";", "params", "[", "tableConstants", ".", "includeD...
Pull the page as described by the query
[ "Pull", "the", "page", "as", "described", "by", "the", "query" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/pull.js#L129-L162
32,407
Azure/azure-mobile-apps-js-client
sdk/src/sync/pull.js
updateQueryForNextPage
function updateQueryForNextPage(pulledRecords) { return Platform.async(function(callback) { callback(); })().then(function() { if (!pulledRecords) { throw new Error('Something is wrong. pulledRecords cannot be null at this point'); } var ...
javascript
function updateQueryForNextPage(pulledRecords) { return Platform.async(function(callback) { callback(); })().then(function() { if (!pulledRecords) { throw new Error('Something is wrong. pulledRecords cannot be null at this point'); } var ...
[ "function", "updateQueryForNextPage", "(", "pulledRecords", ")", "{", "return", "Platform", ".", "async", "(", "function", "(", "callback", ")", "{", "callback", "(", ")", ";", "}", ")", "(", ")", ".", "then", "(", "function", "(", ")", "{", "if", "(",...
update the query to pull the next page
[ "update", "the", "query", "to", "pull", "the", "next", "page" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/pull.js#L217-L244
32,408
Azure/azure-mobile-apps-js-client
sdk/src/sync/pull.js
buildQueryFromLastKnownUpdateAt
function buildQueryFromLastKnownUpdateAt(updatedAt) { lastKnownUpdatedAt = updatedAt; // Make a copy of the table query and tweak it to fetch the next first page pagePullQuery = copyQuery(tablePullQuery); pagePullQuery = pagePullQuery.where(function(lastKnownUpdatedAt) { //...
javascript
function buildQueryFromLastKnownUpdateAt(updatedAt) { lastKnownUpdatedAt = updatedAt; // Make a copy of the table query and tweak it to fetch the next first page pagePullQuery = copyQuery(tablePullQuery); pagePullQuery = pagePullQuery.where(function(lastKnownUpdatedAt) { //...
[ "function", "buildQueryFromLastKnownUpdateAt", "(", "updatedAt", ")", "{", "lastKnownUpdatedAt", "=", "updatedAt", ";", "// Make a copy of the table query and tweak it to fetch the next first page", "pagePullQuery", "=", "copyQuery", "(", "tablePullQuery", ")", ";", "pagePullQuer...
Builds a query to fetch one page Records with updatedAt values >= updatedAt will be fetched
[ "Builds", "a", "query", "to", "fetch", "one", "page", "Records", "with", "updatedAt", "values", ">", "=", "updatedAt", "will", "be", "fetched" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/pull.js#L248-L262
32,409
Azure/azure-mobile-apps-js-client
sdk/src/sync/pull.js
onPagePulled
function onPagePulled() { // For incremental pull, make a note of the lastKnownUpdatedAt in the store if (pullQueryId) { return store.upsert(pulltimeTableName, { id: pullQueryId, tableName: pagePullQuery.getComponents().table, value: lastKnown...
javascript
function onPagePulled() { // For incremental pull, make a note of the lastKnownUpdatedAt in the store if (pullQueryId) { return store.upsert(pulltimeTableName, { id: pullQueryId, tableName: pagePullQuery.getComponents().table, value: lastKnown...
[ "function", "onPagePulled", "(", ")", "{", "// For incremental pull, make a note of the lastKnownUpdatedAt in the store", "if", "(", "pullQueryId", ")", "{", "return", "store", ".", "upsert", "(", "pulltimeTableName", ",", "{", "id", ":", "pullQueryId", ",", "tableName"...
Called after a page is pulled and processed
[ "Called", "after", "a", "page", "is", "pulled", "and", "processed" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/pull.js#L265-L275
32,410
Azure/azure-mobile-apps-js-client
sdk/src/sync/pull.js
validateQuery
function validateQuery(query) { Validate.isObject(query); Validate.notNull(query); var components = query.getComponents(); for (var i in components.ordering) { throw new Error('orderBy and orderByDescending clauses are not supported in the pull query'); ...
javascript
function validateQuery(query) { Validate.isObject(query); Validate.notNull(query); var components = query.getComponents(); for (var i in components.ordering) { throw new Error('orderBy and orderByDescending clauses are not supported in the pull query'); ...
[ "function", "validateQuery", "(", "query", ")", "{", "Validate", ".", "isObject", "(", "query", ")", ";", "Validate", ".", "notNull", "(", "query", ")", ";", "var", "components", "=", "query", ".", "getComponents", "(", ")", ";", "for", "(", "var", "i"...
Not all query operations are allowed while pulling. This function validates that the query does not perform unsupported operations.
[ "Not", "all", "query", "operations", "are", "allowed", "while", "pulling", ".", "This", "function", "validates", "that", "the", "query", "does", "not", "perform", "unsupported", "operations", "." ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/pull.js#L279-L304
32,411
Azure/azure-mobile-apps-js-client
sdk/src/sync/pull.js
copyQuery
function copyQuery(query) { var components = query.getComponents(); var queryCopy = new Query(components.table); queryCopy.setComponents(components); return queryCopy; }
javascript
function copyQuery(query) { var components = query.getComponents(); var queryCopy = new Query(components.table); queryCopy.setComponents(components); return queryCopy; }
[ "function", "copyQuery", "(", "query", ")", "{", "var", "components", "=", "query", ".", "getComponents", "(", ")", ";", "var", "queryCopy", "=", "new", "Query", "(", "components", ".", "table", ")", ";", "queryCopy", ".", "setComponents", "(", "components...
Makes a copy of the QueryJS object
[ "Makes", "a", "copy", "of", "the", "QueryJS", "object" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/pull.js#L307-L313
32,412
Azure/azure-mobile-apps-js-client
sdk/src/sync/purge.js
purge
function purge(query, forcePurge) { return storeTaskRunner.run(function() { Validate.isObject(query, 'query'); Validate.notNull(query, 'query'); if (!_.isNull(forcePurge)) { Validate.isBool(forcePurge, 'forcePurge'); } // Query for pen...
javascript
function purge(query, forcePurge) { return storeTaskRunner.run(function() { Validate.isObject(query, 'query'); Validate.notNull(query, 'query'); if (!_.isNull(forcePurge)) { Validate.isBool(forcePurge, 'forcePurge'); } // Query for pen...
[ "function", "purge", "(", "query", ",", "forcePurge", ")", "{", "return", "storeTaskRunner", ".", "run", "(", "function", "(", ")", "{", "Validate", ".", "isObject", "(", "query", ",", "'query'", ")", ";", "Validate", ".", "notNull", "(", "query", ",", ...
Purges data, pending operations and incremental sync state associated with a local table A regular purge, would fail if there are any pending operations for the table being purged. A forced purge will proceed even if pending operations for the table being purged exist in the operation table. In addition, it will also d...
[ "Purges", "data", "pending", "operations", "and", "incremental", "sync", "state", "associated", "with", "a", "local", "table", "A", "regular", "purge", "would", "fail", "if", "there", "are", "any", "pending", "operations", "for", "the", "table", "being", "purg...
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/purge.js#L35-L84
32,413
Azure/azure-mobile-apps-js-client
sdk/src/sync/operations.js
lockOperation
function lockOperation(id) { return runner.run(function() { // Locking a locked operation should have no effect if (lockedOperationId === id) { return; } if (!lockedOperationId) { lockedOperationId = id; ...
javascript
function lockOperation(id) { return runner.run(function() { // Locking a locked operation should have no effect if (lockedOperationId === id) { return; } if (!lockedOperationId) { lockedOperationId = id; ...
[ "function", "lockOperation", "(", "id", ")", "{", "return", "runner", ".", "run", "(", "function", "(", ")", "{", "// Locking a locked operation should have no effect", "if", "(", "lockedOperationId", "===", "id", ")", "{", "return", ";", "}", "if", "(", "!", ...
Locks the operation with the specified id. TODO: Lock state and the value of the locked operation should be persisted. That way we can handle the following scenario: insert -> initiate push -> connection failure after item inserted in server table -> client crashes or cancels push -> client app starts again -> delete ...
[ "Locks", "the", "operation", "with", "the", "specified", "id", "." ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/operations.js#L86-L100
32,414
Azure/azure-mobile-apps-js-client
sdk/src/sync/operations.js
getCondenseAction
function getCondenseAction(pendingOperation, newAction) { var pendingAction = pendingOperation.action, condenseAction; if (pendingAction === 'insert' && newAction === 'update') { condenseAction = 'nop'; } else if (pendingAction === 'insert' && newAction === 'dele...
javascript
function getCondenseAction(pendingOperation, newAction) { var pendingAction = pendingOperation.action, condenseAction; if (pendingAction === 'insert' && newAction === 'update') { condenseAction = 'nop'; } else if (pendingAction === 'insert' && newAction === 'dele...
[ "function", "getCondenseAction", "(", "pendingOperation", ",", "newAction", ")", "{", "var", "pendingAction", "=", "pendingOperation", ".", "action", ",", "condenseAction", ";", "if", "(", "pendingAction", "===", "'insert'", "&&", "newAction", "===", "'update'", "...
Determines how to condense the new action into the pending operation @returns 'nop' - if no action is needed 'remove' - if the pending operation should be removed 'modify' - if the pending action should be modified to be the new action 'add' - if a new operation should be added
[ "Determines", "how", "to", "condense", "the", "new", "action", "into", "the", "pending", "operation" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/operations.js#L289-L314
32,415
Azure/azure-mobile-apps-js-client
sdk/src/sync/operations.js
getOperationForInsertingLog
function getOperationForInsertingLog(tableName, action, item) { return api.getMetadata(tableName, action, item).then(function(metadata) { return { tableName: operationTableName, action: 'upsert', data: { id: ++maxId, ...
javascript
function getOperationForInsertingLog(tableName, action, item) { return api.getMetadata(tableName, action, item).then(function(metadata) { return { tableName: operationTableName, action: 'upsert', data: { id: ++maxId, ...
[ "function", "getOperationForInsertingLog", "(", "tableName", ",", "action", ",", "item", ")", "{", "return", "api", ".", "getMetadata", "(", "tableName", ",", "action", ",", "item", ")", ".", "then", "(", "function", "(", "metadata", ")", "{", "return", "{...
Gets the operation that will insert a new record in the operation table.
[ "Gets", "the", "operation", "that", "will", "insert", "a", "new", "record", "in", "the", "operation", "table", "." ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/operations.js#L319-L333
32,416
Azure/azure-mobile-apps-js-client
sdk/src/sync/operations.js
getOperationForUpdatingLog
function getOperationForUpdatingLog(operationId, tableName, action, item) { return api.getMetadata(tableName, action, item).then(function(metadata) { return { tableName: operationTableName, action: 'upsert', data: { id: operationId,...
javascript
function getOperationForUpdatingLog(operationId, tableName, action, item) { return api.getMetadata(tableName, action, item).then(function(metadata) { return { tableName: operationTableName, action: 'upsert', data: { id: operationId,...
[ "function", "getOperationForUpdatingLog", "(", "operationId", ",", "tableName", ",", "action", ",", "item", ")", "{", "return", "api", ".", "getMetadata", "(", "tableName", ",", "action", ",", "item", ")", ".", "then", "(", "function", "(", "metadata", ")", ...
Gets the operation that will update an existing record in the operation table.
[ "Gets", "the", "operation", "that", "will", "update", "an", "existing", "record", "in", "the", "operation", "table", "." ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/operations.js#L338-L350
32,417
Azure/azure-mobile-apps-js-client
sdk/src/sync/operations.js
getMetadata
function getMetadata(tableName, action, item) { return Platform.async(function(callback) { callback(); })().then(function() { var metadata = {}; // If action is update and item defines version property OR if action is insert / update, // define m...
javascript
function getMetadata(tableName, action, item) { return Platform.async(function(callback) { callback(); })().then(function() { var metadata = {}; // If action is update and item defines version property OR if action is insert / update, // define m...
[ "function", "getMetadata", "(", "tableName", ",", "action", ",", "item", ")", "{", "return", "Platform", ".", "async", "(", "function", "(", "callback", ")", "{", "callback", "(", ")", ";", "}", ")", "(", ")", ".", "then", "(", "function", "(", ")", ...
Gets the metadata to associate with a log record in the operation table @param action 'insert', 'update' and 'delete' correspond to the insert, update and delete operations. 'upsert' is a special action that is used only in the context of conflict handling.
[ "Gets", "the", "metadata", "to", "associate", "with", "a", "log", "record", "in", "the", "operation", "table" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/operations.js#L369-L395
32,418
Azure/azure-mobile-apps-js-client
sdk/src/sync/operations.js
getMaxOperationId
function getMaxOperationId() { var query = new Query(operationTableName); return store.read(query.orderByDescending('id').take(1)).then(function(result) { Validate.isArray(result); if (result.length === 0) { return 0; } else if (result.len...
javascript
function getMaxOperationId() { var query = new Query(operationTableName); return store.read(query.orderByDescending('id').take(1)).then(function(result) { Validate.isArray(result); if (result.length === 0) { return 0; } else if (result.len...
[ "function", "getMaxOperationId", "(", ")", "{", "var", "query", "=", "new", "Query", "(", "operationTableName", ")", ";", "return", "store", ".", "read", "(", "query", ".", "orderByDescending", "(", "'id'", ")", ".", "take", "(", "1", ")", ")", ".", "t...
Gets the largest operation ID from the operation table If there are no records in the operation table, returns 0.
[ "Gets", "the", "largest", "operation", "ID", "from", "the", "operation", "table", "If", "there", "are", "no", "records", "in", "the", "operation", "table", "returns", "0", "." ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/operations.js#L401-L414
32,419
Azure/azure-mobile-apps-js-client
sdk/src/sync/push.js
push
function push(handler) { return pushTaskRunner.run(function() { reset(); pushHandler = handler; return pushAllOperations().then(function() { return pushConflicts; }); }); }
javascript
function push(handler) { return pushTaskRunner.run(function() { reset(); pushHandler = handler; return pushAllOperations().then(function() { return pushConflicts; }); }); }
[ "function", "push", "(", "handler", ")", "{", "return", "pushTaskRunner", ".", "run", "(", "function", "(", ")", "{", "reset", "(", ")", ";", "pushHandler", "=", "handler", ";", "return", "pushAllOperations", "(", ")", ".", "then", "(", "function", "(", ...
Pushes operations performed on the local store to the server tables. @returns A promise that is fulfilled when all pending operations are pushed. Conflict errors won't fail the push operation. All conflicts are collected and returned to the user at the completion of the push operation. The promise is rejected if pushi...
[ "Pushes", "operations", "performed", "on", "the", "local", "store", "to", "the", "server", "tables", "." ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/push.js#L44-L52
32,420
Azure/azure-mobile-apps-js-client
sdk/src/sync/push.js
pushAllOperations
function pushAllOperations() { var currentOperation, pushError; return readAndLockFirstPendingOperation().then(function(pendingOperation) { if (!pendingOperation) { return; // No more pending operations. Push is complete } var ...
javascript
function pushAllOperations() { var currentOperation, pushError; return readAndLockFirstPendingOperation().then(function(pendingOperation) { if (!pendingOperation) { return; // No more pending operations. Push is complete } var ...
[ "function", "pushAllOperations", "(", ")", "{", "var", "currentOperation", ",", "pushError", ";", "return", "readAndLockFirstPendingOperation", "(", ")", ".", "then", "(", "function", "(", "pendingOperation", ")", "{", "if", "(", "!", "pendingOperation", ")", "{...
Pushes all pending operations, one at a time. 1. Read the oldest pending operation 2. If 1 did not fetch any operation, go to 6. 3. Lock the operation obtained in step 1 and push it. 4. If 3 is successful, unlock and remove the locked operation from the operation table and go to 1 Else if 3 fails, unlock the operation....
[ "Pushes", "all", "pending", "operations", "one", "at", "a", "time", ".", "1", ".", "Read", "the", "oldest", "pending", "operation", "2", ".", "If", "1", "did", "not", "fetch", "any", "operation", "go", "to", "6", ".", "3", ".", "Lock", "the", "operat...
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/push.js#L70-L125
32,421
Azure/azure-mobile-apps-js-client
sdk/src/Platform/web/index.js
function (err) { if (_.isNull(err)) { // Call complete with all the args except for err complete.apply(null, Array.prototype.slice.call(arguments, 1)); } else { error(err); } }
javascript
function (err) { if (_.isNull(err)) { // Call complete with all the args except for err complete.apply(null, Array.prototype.slice.call(arguments, 1)); } else { error(err); } }
[ "function", "(", "err", ")", "{", "if", "(", "_", ".", "isNull", "(", "err", ")", ")", "{", "// Call complete with all the args except for err", "complete", ".", "apply", "(", "null", ",", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "argumen...
Add a callback to the args which will call the appropriate promise handlers
[ "Add", "a", "callback", "to", "the", "args", "which", "will", "call", "the", "appropriate", "promise", "handlers" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/Platform/web/index.js#L65-L72
32,422
Azure/azure-mobile-apps-js-client
sdk/src/sync/pushError.js
handlePushError
function handlePushError(pushError, pushHandler) { return Platform.async(function(callback) { callback(); })().then(function() { if (pushError.isConflict()) { if (pushHandler && pushHandler.onConflict) { // NOTE: value of server record will not be available i...
javascript
function handlePushError(pushError, pushHandler) { return Platform.async(function(callback) { callback(); })().then(function() { if (pushError.isConflict()) { if (pushHandler && pushHandler.onConflict) { // NOTE: value of server record will not be available i...
[ "function", "handlePushError", "(", "pushError", ",", "pushHandler", ")", "{", "return", "Platform", ".", "async", "(", "function", "(", "callback", ")", "{", "callback", "(", ")", ";", "}", ")", "(", ")", ".", "then", "(", "function", "(", ")", "{", ...
Attempts error handling by delegating it to the user, if a push handler is provided @private
[ "Attempts", "error", "handling", "by", "delegating", "it", "to", "the", "user", "if", "a", "push", "handler", "is", "provided" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/pushError.js#L448-L466
32,423
Azure/azure-mobile-apps-js-client
sdk/src/MobileServiceTable.js
removeSystemProperties
function removeSystemProperties(instance) { var copy = {}; for (var property in instance) { if ((property != MobileServiceSystemColumns.Version) && (property != MobileServiceSystemColumns.UpdatedAt) && (property != MobileServiceSystemColumns.CreatedAt) && (property !=...
javascript
function removeSystemProperties(instance) { var copy = {}; for (var property in instance) { if ((property != MobileServiceSystemColumns.Version) && (property != MobileServiceSystemColumns.UpdatedAt) && (property != MobileServiceSystemColumns.CreatedAt) && (property !=...
[ "function", "removeSystemProperties", "(", "instance", ")", "{", "var", "copy", "=", "{", "}", ";", "for", "(", "var", "property", "in", "instance", ")", "{", "if", "(", "(", "property", "!=", "MobileServiceSystemColumns", ".", "Version", ")", "&&", "(", ...
Table system properties
[ "Table", "system", "properties" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/MobileServiceTable.js#L654-L666
32,424
Azure/azure-mobile-apps-js-client
sdk/src/MobileServiceTable.js
getItemFromResponse
function getItemFromResponse(response) { var result = _.fromJson(response.responseText); if (response.getResponseHeader) { var eTag = response.getResponseHeader('ETag'); if (!_.isNullOrEmpty(eTag)) { result[MobileServiceSystemColumns.Version] = getVersionFromEtag(eTag); } ...
javascript
function getItemFromResponse(response) { var result = _.fromJson(response.responseText); if (response.getResponseHeader) { var eTag = response.getResponseHeader('ETag'); if (!_.isNullOrEmpty(eTag)) { result[MobileServiceSystemColumns.Version] = getVersionFromEtag(eTag); } ...
[ "function", "getItemFromResponse", "(", "response", ")", "{", "var", "result", "=", "_", ".", "fromJson", "(", "response", ".", "responseText", ")", ";", "if", "(", "response", ".", "getResponseHeader", ")", "{", "var", "eTag", "=", "response", ".", "getRe...
Add double quotes and unescape any internal quotes
[ "Add", "double", "quotes", "and", "unescape", "any", "internal", "quotes" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/MobileServiceTable.js#L669-L678
32,425
Azure/azure-mobile-apps-js-client
sdk/src/MobileServiceTable.js
setServerItemIfPreconditionFailed
function setServerItemIfPreconditionFailed(error) { if (error.request && error.request.status === 412) { error.serverInstance = _.fromJson(error.request.responseText); } }
javascript
function setServerItemIfPreconditionFailed(error) { if (error.request && error.request.status === 412) { error.serverInstance = _.fromJson(error.request.responseText); } }
[ "function", "setServerItemIfPreconditionFailed", "(", "error", ")", "{", "if", "(", "error", ".", "request", "&&", "error", ".", "request", ".", "status", "===", "412", ")", "{", "error", ".", "serverInstance", "=", "_", ".", "fromJson", "(", "error", ".",...
Converts an error to precondition failed error
[ "Converts", "an", "error", "to", "precondition", "failed", "error" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/MobileServiceTable.js#L681-L685
32,426
Azure/azure-mobile-apps-js-client
sdk/src/MobileServiceTable.js
getVersionFromEtag
function getVersionFromEtag(etag) { var len = etag.length, result = etag; if (len > 1 && etag[0] === '"' && etag[len - 1] === '"') { result = etag.substr(1, len - 2); } return result.replace(/\\\"/g, '"'); }
javascript
function getVersionFromEtag(etag) { var len = etag.length, result = etag; if (len > 1 && etag[0] === '"' && etag[len - 1] === '"') { result = etag.substr(1, len - 2); } return result.replace(/\\\"/g, '"'); }
[ "function", "getVersionFromEtag", "(", "etag", ")", "{", "var", "len", "=", "etag", ".", "length", ",", "result", "=", "etag", ";", "if", "(", "len", ">", "1", "&&", "etag", "[", "0", "]", "===", "'\"'", "&&", "etag", "[", "len", "-", "1", "]", ...
Remove surrounding double quotes and unescape internal quotes
[ "Remove", "surrounding", "double", "quotes", "and", "unescape", "internal", "quotes" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/MobileServiceTable.js#L694-L702
32,427
Azure/azure-mobile-apps-js-client
sdk/src/MobileServiceTable.js
addQueryParametersFeaturesIfApplicable
function addQueryParametersFeaturesIfApplicable(features, userQueryParameters) { var hasQueryParameters = false; if (userQueryParameters) { if (Array.isArray(userQueryParameters)) { hasQueryParameters = userQueryParameters.length > 0; } else if (_.isObject(userQueryParameters)) { ...
javascript
function addQueryParametersFeaturesIfApplicable(features, userQueryParameters) { var hasQueryParameters = false; if (userQueryParameters) { if (Array.isArray(userQueryParameters)) { hasQueryParameters = userQueryParameters.length > 0; } else if (_.isObject(userQueryParameters)) { ...
[ "function", "addQueryParametersFeaturesIfApplicable", "(", "features", ",", "userQueryParameters", ")", "{", "var", "hasQueryParameters", "=", "false", ";", "if", "(", "userQueryParameters", ")", "{", "if", "(", "Array", ".", "isArray", "(", "userQueryParameters", "...
Updates and returns the headers parameters with features used in the call
[ "Updates", "and", "returns", "the", "headers", "parameters", "with", "features", "used", "in", "the", "call" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/MobileServiceTable.js#L705-L723
32,428
lethexa/leaflet-tracksymbol
leaflet-tracksymbol.js
function(gpsRefPos) { if(gpsRefPos === undefined || gpsRefPos.length < 4) { this._gpsRefPos = undefined; } else if(gpsRefPos[0] === 0 && gpsRefPos[1] === 0 && gpsRefPos[2] === 0 && gpsRefPos[3] === 0) { this._gpsRefPos = undefined; } else { ...
javascript
function(gpsRefPos) { if(gpsRefPos === undefined || gpsRefPos.length < 4) { this._gpsRefPos = undefined; } else if(gpsRefPos[0] === 0 && gpsRefPos[1] === 0 && gpsRefPos[2] === 0 && gpsRefPos[3] === 0) { this._gpsRefPos = undefined; } else { ...
[ "function", "(", "gpsRefPos", ")", "{", "if", "(", "gpsRefPos", "===", "undefined", "||", "gpsRefPos", ".", "length", "<", "4", ")", "{", "this", ".", "_gpsRefPos", "=", "undefined", ";", "}", "else", "if", "(", "gpsRefPos", "[", "0", "]", "===", "0"...
Sets the position offset of the silouette to the center of the symbol. The array contains the refpoints from ITU R-REC-M.1371-4-201004 page 108 in sequence A,B,C,D. @method setGPSRefPos @param gpsRefPos {Array} The GPS offset from center.
[ "Sets", "the", "position", "offset", "of", "the", "silouette", "to", "the", "center", "of", "the", "symbol", ".", "The", "array", "contains", "the", "refpoints", "from", "ITU", "R", "-", "REC", "-", "M", ".", "1371", "-", "4", "-", "201004", "page", ...
835deeaa42a7de7c5ec6b96c5bd00dcc994abc15
https://github.com/lethexa/leaflet-tracksymbol/blob/835deeaa42a7de7c5ec6b96c5bd00dcc994abc15/leaflet-tracksymbol.js#L191-L206
32,429
lethexa/leaflet-tracksymbol
leaflet-tracksymbol.js
function () { var lngSize = this._getLngSize() / 2.0; var latSize = this._getLatSize() / 2.0; var latlng = this._latlng; return new L.LatLngBounds( [latlng.lat - latSize, latlng.lng - lngSize], [latlng.lat + latSize, latlng.lng + lngSize]); }
javascript
function () { var lngSize = this._getLngSize() / 2.0; var latSize = this._getLatSize() / 2.0; var latlng = this._latlng; return new L.LatLngBounds( [latlng.lat - latSize, latlng.lng - lngSize], [latlng.lat + latSize, latlng.lng + lngSize]); }
[ "function", "(", ")", "{", "var", "lngSize", "=", "this", ".", "_getLngSize", "(", ")", "/", "2.0", ";", "var", "latSize", "=", "this", ".", "_getLatSize", "(", ")", "/", "2.0", ";", "var", "latlng", "=", "this", ".", "_latlng", ";", "return", "new...
Returns the bounding box of the symbol. @method getBounds @return {LatLngBounds} The bounding box.
[ "Returns", "the", "bounding", "box", "of", "the", "symbol", "." ]
835deeaa42a7de7c5ec6b96c5bd00dcc994abc15
https://github.com/lethexa/leaflet-tracksymbol/blob/835deeaa42a7de7c5ec6b96c5bd00dcc994abc15/leaflet-tracksymbol.js#L238-L245
32,430
lethexa/leaflet-tracksymbol
leaflet-tracksymbol.js
function(point, angle) { var x = point[0]; var y = point[1]; var si_z = Math.sin(angle); var co_z = Math.cos(angle); var newX = x * co_z - y * si_z; var newY = x * si_z + y * co_z; return [newX, newY]; }
javascript
function(point, angle) { var x = point[0]; var y = point[1]; var si_z = Math.sin(angle); var co_z = Math.cos(angle); var newX = x * co_z - y * si_z; var newY = x * si_z + y * co_z; return [newX, newY]; }
[ "function", "(", "point", ",", "angle", ")", "{", "var", "x", "=", "point", "[", "0", "]", ";", "var", "y", "=", "point", "[", "1", "]", ";", "var", "si_z", "=", "Math", ".", "sin", "(", "angle", ")", ";", "var", "co_z", "=", "Math", ".", "...
Rotates the given point around the angle. @method _rotate @param point {Array} A point vector 2d. @param angle {Number} Angle for rotation [rad]. @return The rotated vector 2d.
[ "Rotates", "the", "given", "point", "around", "the", "angle", "." ]
835deeaa42a7de7c5ec6b96c5bd00dcc994abc15
https://github.com/lethexa/leaflet-tracksymbol/blob/835deeaa42a7de7c5ec6b96c5bd00dcc994abc15/leaflet-tracksymbol.js#L263-L271
32,431
lethexa/leaflet-tracksymbol
leaflet-tracksymbol.js
function(points, angle) { var result = []; for(var i=0;i<points.length;i+=2) { var x = points[i + 0] * this._size; var y = points[i + 1] * this._size; var pt = this._rotate([x, y], angle); result.push(pt[0]); result.push(pt[1]); } return result; }
javascript
function(points, angle) { var result = []; for(var i=0;i<points.length;i+=2) { var x = points[i + 0] * this._size; var y = points[i + 1] * this._size; var pt = this._rotate([x, y], angle); result.push(pt[0]); result.push(pt[1]); } return result; }
[ "function", "(", "points", ",", "angle", ")", "{", "var", "result", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "points", ".", "length", ";", "i", "+=", "2", ")", "{", "var", "x", "=", "points", "[", "i", "+", "0", ...
Rotates the given point-array around the angle. @method _rotateAllPoints @param points {Array} A point vector 2d. @param angle {Number} Angle for rotation [rad]. @return The rotated vector-array 2d.
[ "Rotates", "the", "given", "point", "-", "array", "around", "the", "angle", "." ]
835deeaa42a7de7c5ec6b96c5bd00dcc994abc15
https://github.com/lethexa/leaflet-tracksymbol/blob/835deeaa42a7de7c5ec6b96c5bd00dcc994abc15/leaflet-tracksymbol.js#L280-L290
32,432
lethexa/leaflet-tracksymbol
leaflet-tracksymbol.js
function () { if(this._heading === undefined) { return this._createNoHeadingSymbolPathString(); } else { if(this._gpsRefPos === undefined || this._map.getZoom() <= this._minSilouetteZoom ) { return this._createWithHeadingSymbolPathString(); } else { return this._creat...
javascript
function () { if(this._heading === undefined) { return this._createNoHeadingSymbolPathString(); } else { if(this._gpsRefPos === undefined || this._map.getZoom() <= this._minSilouetteZoom ) { return this._createWithHeadingSymbolPathString(); } else { return this._creat...
[ "function", "(", ")", "{", "if", "(", "this", ".", "_heading", "===", "undefined", ")", "{", "return", "this", ".", "_createNoHeadingSymbolPathString", "(", ")", ";", "}", "else", "{", "if", "(", "this", ".", "_gpsRefPos", "===", "undefined", "||", "this...
Generates the symbol as SVG path string. depending on zoomlevel or track heading different symbol types are generated. @return {String} The symbol path string.
[ "Generates", "the", "symbol", "as", "SVG", "path", "string", ".", "depending", "on", "zoomlevel", "or", "track", "heading", "different", "symbol", "types", "are", "generated", "." ]
835deeaa42a7de7c5ec6b96c5bd00dcc994abc15
https://github.com/lethexa/leaflet-tracksymbol/blob/835deeaa42a7de7c5ec6b96c5bd00dcc994abc15/leaflet-tracksymbol.js#L412-L424
32,433
KyleAMathews/superagent-bluebird-promise
index.js
function(message, originalError) { var stack; this.message = message; this.originalError = originalError; if (Error.captureStackTrace) { Error.captureStackTrace(this, this.constructor); stack = this.stack; } else { stack = new Error(message).stack; } if (Object.defineProperty) { Object.d...
javascript
function(message, originalError) { var stack; this.message = message; this.originalError = originalError; if (Error.captureStackTrace) { Error.captureStackTrace(this, this.constructor); stack = this.stack; } else { stack = new Error(message).stack; } if (Object.defineProperty) { Object.d...
[ "function", "(", "message", ",", "originalError", ")", "{", "var", "stack", ";", "this", ".", "message", "=", "message", ";", "this", ".", "originalError", "=", "originalError", ";", "if", "(", "Error", ".", "captureStackTrace", ")", "{", "Error", ".", "...
Create custom error type. Create a new object, that prototypally inherits from the Error constructor.
[ "Create", "custom", "error", "type", ".", "Create", "a", "new", "object", "that", "prototypally", "inherits", "from", "the", "Error", "constructor", "." ]
31f8298e583b2cc5e70fb43a1c3a016d80755360
https://github.com/KyleAMathews/superagent-bluebird-promise/blob/31f8298e583b2cc5e70fb43a1c3a016d80755360/index.js#L27-L54
32,434
karma-runner/karma-ie-launcher
index.js
getInternetExplorerExe
function getInternetExplorerExe () { var suffix = path.join('Internet Explorer', PROCESS_NAME) var locations = _.map(_.compact([ process.env['PROGRAMW6432'], process.env['PROGRAMFILES(X86)'], process.env['PROGRAMFILES'] ]), function (prefix) { return path.join(prefix, suffix) }) return _.find...
javascript
function getInternetExplorerExe () { var suffix = path.join('Internet Explorer', PROCESS_NAME) var locations = _.map(_.compact([ process.env['PROGRAMW6432'], process.env['PROGRAMFILES(X86)'], process.env['PROGRAMFILES'] ]), function (prefix) { return path.join(prefix, suffix) }) return _.find...
[ "function", "getInternetExplorerExe", "(", ")", "{", "var", "suffix", "=", "path", ".", "join", "(", "'Internet Explorer'", ",", "PROCESS_NAME", ")", "var", "locations", "=", "_", ".", "map", "(", "_", ".", "compact", "(", "[", "process", ".", "env", "["...
Find the ie executable
[ "Find", "the", "ie", "executable" ]
7c95ad6d2ae96a1fd6bf8bd5d04aa88d435f8145
https://github.com/karma-runner/karma-ie-launcher/blob/7c95ad6d2ae96a1fd6bf8bd5d04aa88d435f8145/index.js#L20-L33
32,435
LvChengbin/url
dist/url.cjs.js
merge
function merge( a, l, m, r ) { const n1 = m - l + 1; const n2 = r - m; const L = a.slice( l, m + 1 ); const R = a.slice( m + 1, 1 + r ); let i = 0, j = 0, k = l; while( i < n1 && j < n2 ) { if( L[ i ][ 0 ] <= R[ j ][ 0 ] ) { a[ k ] = L[ i ]; i++; } else {...
javascript
function merge( a, l, m, r ) { const n1 = m - l + 1; const n2 = r - m; const L = a.slice( l, m + 1 ); const R = a.slice( m + 1, 1 + r ); let i = 0, j = 0, k = l; while( i < n1 && j < n2 ) { if( L[ i ][ 0 ] <= R[ j ][ 0 ] ) { a[ k ] = L[ i ]; i++; } else {...
[ "function", "merge", "(", "a", ",", "l", ",", "m", ",", "r", ")", "{", "const", "n1", "=", "m", "-", "l", "+", "1", ";", "const", "n2", "=", "r", "-", "m", ";", "const", "L", "=", "a", ".", "slice", "(", "l", ",", "m", "+", "1", ")", ...
function for merge sort
[ "function", "for", "merge", "sort" ]
4b53d642903b386ed86185831fa5e33a6af693d5
https://github.com/LvChengbin/url/blob/4b53d642903b386ed86185831fa5e33a6af693d5/dist/url.cjs.js#L551-L580
32,436
ef4/ember-browserify
lib/index.js
findHost
function findHost() { var current = this; var app; // Keep iterating upward until we don't have a grandparent. // Has to do this grandparent check because at some point we hit the project. // Stop at lazy engine boundaries. do { if (current.lazyLoading === true) { return current; } app = current.ap...
javascript
function findHost() { var current = this; var app; // Keep iterating upward until we don't have a grandparent. // Has to do this grandparent check because at some point we hit the project. // Stop at lazy engine boundaries. do { if (current.lazyLoading === true) { return current; } app = current.ap...
[ "function", "findHost", "(", ")", "{", "var", "current", "=", "this", ";", "var", "app", ";", "// Keep iterating upward until we don't have a grandparent.", "// Has to do this grandparent check because at some point we hit the project.", "// Stop at lazy engine boundaries.", "do", ...
Support old versions of Ember CLI.
[ "Support", "old", "versions", "of", "Ember", "CLI", "." ]
851bcc988df26406b6fda76b08f84fd118e95e7a
https://github.com/ef4/ember-browserify/blob/851bcc988df26406b6fda76b08f84fd118e95e7a/lib/index.js#L2-L15
32,437
ef4/ember-browserify
lib/caching-browserify.js
function(path) { return (path && path.match(/^[a-z]:\\/i)) ? path.charAt(0).toLowerCase() + path.slice(1) : path; }
javascript
function(path) { return (path && path.match(/^[a-z]:\\/i)) ? path.charAt(0).toLowerCase() + path.slice(1) : path; }
[ "function", "(", "path", ")", "{", "return", "(", "path", "&&", "path", ".", "match", "(", "/", "^[a-z]:\\\\", "/", "i", ")", ")", "?", "path", ".", "charAt", "(", "0", ")", ".", "toLowerCase", "(", ")", "+", "path", ".", "slice", "(", "1", ")"...
Changes path drive-letter to lowercase for Windows
[ "Changes", "path", "drive", "-", "letter", "to", "lowercase", "for", "Windows" ]
851bcc988df26406b6fda76b08f84fd118e95e7a
https://github.com/ef4/ember-browserify/blob/851bcc988df26406b6fda76b08f84fd118e95e7a/lib/caching-browserify.js#L206-L208
32,438
dbusjs/mpris-service
src/index.js
Player
function Player(opts) { if (!(this instanceof Player)) { return new Player(opts); } events.EventEmitter.call(this); this.name = opts.name; this.supportedInterfaces = opts.supportedInterfaces || ['player']; this._tracks = []; this.init(opts); }
javascript
function Player(opts) { if (!(this instanceof Player)) { return new Player(opts); } events.EventEmitter.call(this); this.name = opts.name; this.supportedInterfaces = opts.supportedInterfaces || ['player']; this._tracks = []; this.init(opts); }
[ "function", "Player", "(", "opts", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Player", ")", ")", "{", "return", "new", "Player", "(", "opts", ")", ";", "}", "events", ".", "EventEmitter", ".", "call", "(", "this", ")", ";", "this", ".", ...
Construct a new Player and export it on the DBus session bus. For more information about the properties of this class, see [the MPRIS DBus Interface Specification](https://specifications.freedesktop.org/mpris-spec/latest/). Method Call Events ------------------ The Player is an `EventEmitter` that emits events when ...
[ "Construct", "a", "new", "Player", "and", "export", "it", "on", "the", "DBus", "session", "bus", "." ]
ee50820e0c10981713c25cfe3e99005b9ab619c5
https://github.com/dbusjs/mpris-service/blob/ee50820e0c10981713c25cfe3e99005b9ab619c5/src/index.js#L166-L176
32,439
extrabacon/google-oauth-jwt
lib/token-cache.js
TokenRequest
function TokenRequest(authenticate, options) { var self = this; this.status = 'expired'; this.pendingCallbacks = []; // execute accumulated callbacks during the 'pending' state function fireCallbacks(err, token) { self.pendingCallbacks.forEach(function (callback) { callback(err, token); }); self.pending...
javascript
function TokenRequest(authenticate, options) { var self = this; this.status = 'expired'; this.pendingCallbacks = []; // execute accumulated callbacks during the 'pending' state function fireCallbacks(err, token) { self.pendingCallbacks.forEach(function (callback) { callback(err, token); }); self.pending...
[ "function", "TokenRequest", "(", "authenticate", ",", "options", ")", "{", "var", "self", "=", "this", ";", "this", ".", "status", "=", "'expired'", ";", "this", ".", "pendingCallbacks", "=", "[", "]", ";", "// execute accumulated callbacks during the 'pending' st...
A single cacheable token request with support for concurrency. @private @constructor
[ "A", "single", "cacheable", "token", "request", "with", "support", "for", "concurrency", "." ]
9032bb3e272e7ae3f227f822dc0e708cc0c89a62
https://github.com/extrabacon/google-oauth-jwt/blob/9032bb3e272e7ae3f227f822dc0e708cc0c89a62/lib/token-cache.js#L54-L102
32,440
extrabacon/google-oauth-jwt
lib/token-cache.js
fireCallbacks
function fireCallbacks(err, token) { self.pendingCallbacks.forEach(function (callback) { callback(err, token); }); self.pendingCallbacks = []; }
javascript
function fireCallbacks(err, token) { self.pendingCallbacks.forEach(function (callback) { callback(err, token); }); self.pendingCallbacks = []; }
[ "function", "fireCallbacks", "(", "err", ",", "token", ")", "{", "self", ".", "pendingCallbacks", ".", "forEach", "(", "function", "(", "callback", ")", "{", "callback", "(", "err", ",", "token", ")", ";", "}", ")", ";", "self", ".", "pendingCallbacks", ...
execute accumulated callbacks during the 'pending' state
[ "execute", "accumulated", "callbacks", "during", "the", "pending", "state" ]
9032bb3e272e7ae3f227f822dc0e708cc0c89a62
https://github.com/extrabacon/google-oauth-jwt/blob/9032bb3e272e7ae3f227f822dc0e708cc0c89a62/lib/token-cache.js#L61-L66
32,441
eemeli/dot-properties
parse.js
parseLines
function parseLines (src) { const lines = [] for (i = 0; i < src.length; ++i) { if (src[i] === '\n' && src[i - 1] === '\r') i += 1 if (!src[i]) break const keyStart = endOfIndent(src, i) if (atLineEnd(src, keyStart)) { lines.push('') i = keyStart continue } if (atComment(sr...
javascript
function parseLines (src) { const lines = [] for (i = 0; i < src.length; ++i) { if (src[i] === '\n' && src[i - 1] === '\r') i += 1 if (!src[i]) break const keyStart = endOfIndent(src, i) if (atLineEnd(src, keyStart)) { lines.push('') i = keyStart continue } if (atComment(sr...
[ "function", "parseLines", "(", "src", ")", "{", "const", "lines", "=", "[", "]", "for", "(", "i", "=", "0", ";", "i", "<", "src", ".", "length", ";", "++", "i", ")", "{", "if", "(", "src", "[", "i", "]", "===", "'\\n'", "&&", "src", "[", "i...
Splits the input string into an array of logical lines Key-value pairs are [key, value] arrays with string values. Escape sequences in keys and values are parsed. Empty lines are included as empty strings, and comments as strings that start with '#' or '! characters. Leading whitespace is not included. @see https://d...
[ "Splits", "the", "input", "string", "into", "an", "array", "of", "logical", "lines" ]
d71e10eb5a975a59172c2c2716935eba6f6e16c5
https://github.com/eemeli/dot-properties/blob/d71e10eb5a975a59172c2c2716935eba6f6e16c5/parse.js#L108-L139
32,442
eemeli/dot-properties
parse.js
parse
function parse (src, path) { const pathSep = typeof path === 'string' ? path : '.' return parseLines(src).reduce((res, line) => { if (Array.isArray(line)) { const [key, value] = line if (path) { const keyPath = key.split(pathSep) let parent = res while (keyPath.length >= 2) {...
javascript
function parse (src, path) { const pathSep = typeof path === 'string' ? path : '.' return parseLines(src).reduce((res, line) => { if (Array.isArray(line)) { const [key, value] = line if (path) { const keyPath = key.split(pathSep) let parent = res while (keyPath.length >= 2) {...
[ "function", "parse", "(", "src", ",", "path", ")", "{", "const", "pathSep", "=", "typeof", "path", "===", "'string'", "?", "path", ":", "'.'", "return", "parseLines", "(", "src", ")", ".", "reduce", "(", "(", "res", ",", "line", ")", "=>", "{", "if...
Parses an input string read from a .properties file into a JavaScript Object If the second `path` parameter is true, dots '.' in keys will result in a multi-level object (use a string value to customise). If a parent level is directly assigned a value while it also has a child with an assigned value, the parent value ...
[ "Parses", "an", "input", "string", "read", "from", "a", ".", "properties", "file", "into", "a", "JavaScript", "Object" ]
d71e10eb5a975a59172c2c2716935eba6f6e16c5
https://github.com/eemeli/dot-properties/blob/d71e10eb5a975a59172c2c2716935eba6f6e16c5/parse.js#L154-L183
32,443
eemeli/dot-properties
stringify.js
stringify
function stringify (input, { commentPrefix = '# ', defaultKey = '', indent = ' ', keySep = ' = ', latin1 = true, lineWidth = 80, newline = '\n', pathSep = '.' } = {}) { if (!input) return '' if (!Array.isArray(input)) input = toLines(input, pathSep, defaultKey) const foldLine = getFold({ indent...
javascript
function stringify (input, { commentPrefix = '# ', defaultKey = '', indent = ' ', keySep = ' = ', latin1 = true, lineWidth = 80, newline = '\n', pathSep = '.' } = {}) { if (!input) return '' if (!Array.isArray(input)) input = toLines(input, pathSep, defaultKey) const foldLine = getFold({ indent...
[ "function", "stringify", "(", "input", ",", "{", "commentPrefix", "=", "'# '", ",", "defaultKey", "=", "''", ",", "indent", "=", "' '", ",", "keySep", "=", "' = '", ",", "latin1", "=", "true", ",", "lineWidth", "=", "80", ",", "newline", "=", "'\\n'...
Stringifies a hierarchical object or an array of lines to .properties format If the input is a hierarchical object, keys will consist of the path parts joined by '.' characters. With array input, string values represent blank or comment lines and string arrays are [key, value] pairs. The characters \, \n and \r will b...
[ "Stringifies", "a", "hierarchical", "object", "or", "an", "array", "of", "lines", "to", ".", "properties", "format" ]
d71e10eb5a975a59172c2c2716935eba6f6e16c5
https://github.com/eemeli/dot-properties/blob/d71e10eb5a975a59172c2c2716935eba6f6e16c5/stringify.js#L117-L146
32,444
axemclion/react-native-cordova-plugin
cli/android-cli.js
mapVariablesToObject
function mapVariablesToObject(variables) { var plugmanConsumableVariables = {}; for (var i in variables) { var t = variables[i].split('='); if (t[0] && t[1]) { plugmanConsumableVariables[t[0]] = t[1]; } } return plugmanConsumableVariables; }
javascript
function mapVariablesToObject(variables) { var plugmanConsumableVariables = {}; for (var i in variables) { var t = variables[i].split('='); if (t[0] && t[1]) { plugmanConsumableVariables[t[0]] = t[1]; } } return plugmanConsumableVariables; }
[ "function", "mapVariablesToObject", "(", "variables", ")", "{", "var", "plugmanConsumableVariables", "=", "{", "}", ";", "for", "(", "var", "i", "in", "variables", ")", "{", "var", "t", "=", "variables", "[", "i", "]", ".", "split", "(", "'='", ")", ";...
takes an array or variables and turns them into an object to be consumed by plugman
[ "takes", "an", "array", "or", "variables", "and", "turns", "them", "into", "an", "object", "to", "be", "consumed", "by", "plugman" ]
a794a93a2702759863795dd4636bddc703dad678
https://github.com/axemclion/react-native-cordova-plugin/blob/a794a93a2702759863795dd4636bddc703dad678/cli/android-cli.js#L54-L63
32,445
lucaslg26/TidalAPI
lib/client.js
TidalAPI
function TidalAPI(authData) { if(typeof authData !== 'object') { throw new Error('You must pass auth data into the TidalAPI object correctly'); } else { if(typeof authData.username !== 'string') { throw new Error('Username invalid or missing'); } if(typeof authData.password !== 'string') { ...
javascript
function TidalAPI(authData) { if(typeof authData !== 'object') { throw new Error('You must pass auth data into the TidalAPI object correctly'); } else { if(typeof authData.username !== 'string') { throw new Error('Username invalid or missing'); } if(typeof authData.password !== 'string') { ...
[ "function", "TidalAPI", "(", "authData", ")", "{", "if", "(", "typeof", "authData", "!==", "'object'", ")", "{", "throw", "new", "Error", "(", "'You must pass auth data into the TidalAPI object correctly'", ")", ";", "}", "else", "{", "if", "(", "typeof", "authD...
Create TidalAPI instance @param {{username: String, password: String, token: String, quality: String}} @Constructor
[ "Create", "TidalAPI", "instance" ]
0df9e2c7e62323e626adddd1f5332d7b47e37206
https://github.com/lucaslg26/TidalAPI/blob/0df9e2c7e62323e626adddd1f5332d7b47e37206/lib/client.js#L71-L94
32,446
lucaslg26/TidalAPI
lib/client.js
tryLogin
function tryLogin(authInfo, cb) { /** * Logging? * @type {boolean} */ var loggingIn = true; request({ method: 'POST', uri: '/login/username', headers: { 'X-Tidal-Token': authInfo.token }, form: { username: authInfo.username, password: authInfo.password, clie...
javascript
function tryLogin(authInfo, cb) { /** * Logging? * @type {boolean} */ var loggingIn = true; request({ method: 'POST', uri: '/login/username', headers: { 'X-Tidal-Token': authInfo.token }, form: { username: authInfo.username, password: authInfo.password, clie...
[ "function", "tryLogin", "(", "authInfo", ",", "cb", ")", "{", "/**\n * Logging?\n * @type {boolean}\n */", "var", "loggingIn", "=", "true", ";", "request", "(", "{", "method", ":", "'POST'", ",", "uri", ":", "'/login/username'", ",", "headers", ":", "{"...
Try login using credentials. @param {{username: String, password: String}}
[ "Try", "login", "using", "credentials", "." ]
0df9e2c7e62323e626adddd1f5332d7b47e37206
https://github.com/lucaslg26/TidalAPI/blob/0df9e2c7e62323e626adddd1f5332d7b47e37206/lib/client.js#L100-L134
32,447
stbaer/rangeslider-js
src/utils.js
resize
function resize () { if (!running) { running = true if (window.requestAnimationFrame) { window.requestAnimationFrame(runCallbacks) } else { setTimeout(runCallbacks, 66) } } }
javascript
function resize () { if (!running) { running = true if (window.requestAnimationFrame) { window.requestAnimationFrame(runCallbacks) } else { setTimeout(runCallbacks, 66) } } }
[ "function", "resize", "(", ")", "{", "if", "(", "!", "running", ")", "{", "running", "=", "true", "if", "(", "window", ".", "requestAnimationFrame", ")", "{", "window", ".", "requestAnimationFrame", "(", "runCallbacks", ")", "}", "else", "{", "setTimeout",...
fired on resize event
[ "fired", "on", "resize", "event" ]
5000e1a8ff92ee849e8e7f84cf009f7c0c84b1bc
https://github.com/stbaer/rangeslider-js/blob/5000e1a8ff92ee849e8e7f84cf009f7c0c84b1bc/src/utils.js#L159-L169
32,448
tjmehta/graphql-date
index.js
function (value) { assertErr(value instanceof Date, TypeError, 'Field error: value is not an instance of Date') assertErr(!isNaN(value.getTime()), TypeError, 'Field error: value is an invalid Date') return value.toJSON() }
javascript
function (value) { assertErr(value instanceof Date, TypeError, 'Field error: value is not an instance of Date') assertErr(!isNaN(value.getTime()), TypeError, 'Field error: value is an invalid Date') return value.toJSON() }
[ "function", "(", "value", ")", "{", "assertErr", "(", "value", "instanceof", "Date", ",", "TypeError", ",", "'Field error: value is not an instance of Date'", ")", "assertErr", "(", "!", "isNaN", "(", "value", ".", "getTime", "(", ")", ")", ",", "TypeError", "...
Serialize date value into string @param {Date} value date value @return {String} date as string
[ "Serialize", "date", "value", "into", "string" ]
ecd3fa27247a744914bd184a159c3818b91dd181
https://github.com/tjmehta/graphql-date/blob/ecd3fa27247a744914bd184a159c3818b91dd181/index.js#L13-L17
32,449
tjmehta/graphql-date
index.js
function (value) { var date = new Date(value) assertErr(!isNaN(date.getTime()), TypeError, 'Field error: value is an invalid Date') return date }
javascript
function (value) { var date = new Date(value) assertErr(!isNaN(date.getTime()), TypeError, 'Field error: value is an invalid Date') return date }
[ "function", "(", "value", ")", "{", "var", "date", "=", "new", "Date", "(", "value", ")", "assertErr", "(", "!", "isNaN", "(", "date", ".", "getTime", "(", ")", ")", ",", "TypeError", ",", "'Field error: value is an invalid Date'", ")", "return", "date", ...
Parse value into date @param {*} value serialized date value @return {Date} date value
[ "Parse", "value", "into", "date" ]
ecd3fa27247a744914bd184a159c3818b91dd181
https://github.com/tjmehta/graphql-date/blob/ecd3fa27247a744914bd184a159c3818b91dd181/index.js#L23-L27
32,450
tjmehta/graphql-date
index.js
function (ast) { assertErr(ast.kind === Kind.STRING, GraphQLError, 'Query error: Can only parse strings to dates but got a: ' + ast.kind, [ast]) var result = new Date(ast.value) assertErr(!isNaN(result.getTime()), GraphQLError, 'Query error: Invalid date', [ast]) assertErr(ast.value === res...
javascript
function (ast) { assertErr(ast.kind === Kind.STRING, GraphQLError, 'Query error: Can only parse strings to dates but got a: ' + ast.kind, [ast]) var result = new Date(ast.value) assertErr(!isNaN(result.getTime()), GraphQLError, 'Query error: Invalid date', [ast]) assertErr(ast.value === res...
[ "function", "(", "ast", ")", "{", "assertErr", "(", "ast", ".", "kind", "===", "Kind", ".", "STRING", ",", "GraphQLError", ",", "'Query error: Can only parse strings to dates but got a: '", "+", "ast", ".", "kind", ",", "[", "ast", "]", ")", "var", "result", ...
Parse ast literal to date @param {Object} ast graphql ast @return {Date} date value
[ "Parse", "ast", "literal", "to", "date" ]
ecd3fa27247a744914bd184a159c3818b91dd181
https://github.com/tjmehta/graphql-date/blob/ecd3fa27247a744914bd184a159c3818b91dd181/index.js#L33-L44
32,451
audiojs/web-audio-stream
write.js
push
function push (chunk) { if (!isAudioBuffer(chunk)) { chunk = util.create(chunk, channels) } data.append(chunk) isEmpty = false; }
javascript
function push (chunk) { if (!isAudioBuffer(chunk)) { chunk = util.create(chunk, channels) } data.append(chunk) isEmpty = false; }
[ "function", "push", "(", "chunk", ")", "{", "if", "(", "!", "isAudioBuffer", "(", "chunk", ")", ")", "{", "chunk", "=", "util", ".", "create", "(", "chunk", ",", "channels", ")", "}", "data", ".", "append", "(", "chunk", ")", "isEmpty", "=", "false...
push new data for the next WAA dinner
[ "push", "new", "data", "for", "the", "next", "WAA", "dinner" ]
0efbe9838c903dbc698024c256b85da4c9f91de7
https://github.com/audiojs/web-audio-stream/blob/0efbe9838c903dbc698024c256b85da4c9f91de7/write.js#L105-L113
32,452
anvaka/ngraph.three
lib/defaults.js
createNodeUI
function createNodeUI(node) { var nodeMaterial = new THREE.MeshBasicMaterial({ color: 0xfefefe }); var nodeGeometry = new THREE.BoxGeometry(NODE_SIZE, NODE_SIZE, NODE_SIZE); return new THREE.Mesh(nodeGeometry, nodeMaterial); }
javascript
function createNodeUI(node) { var nodeMaterial = new THREE.MeshBasicMaterial({ color: 0xfefefe }); var nodeGeometry = new THREE.BoxGeometry(NODE_SIZE, NODE_SIZE, NODE_SIZE); return new THREE.Mesh(nodeGeometry, nodeMaterial); }
[ "function", "createNodeUI", "(", "node", ")", "{", "var", "nodeMaterial", "=", "new", "THREE", ".", "MeshBasicMaterial", "(", "{", "color", ":", "0xfefefe", "}", ")", ";", "var", "nodeGeometry", "=", "new", "THREE", ".", "BoxGeometry", "(", "NODE_SIZE", ",...
default size of a node square
[ "default", "size", "of", "a", "node", "square" ]
7a1cc19574f27207a04f3ba269538b904c406161
https://github.com/anvaka/ngraph.three/blob/7a1cc19574f27207a04f3ba269538b904c406161/lib/defaults.js#L30-L34
32,453
Yehzuna/jquery-schedule
dist/jquery.schedule.js
function () { $('<table class="jqs-table"><tr></tr></table>').appendTo($(this.element)); for (var i = 0; i < this.settings.days; i++) { $('<td><div class="jqs-day"></div></td>'). appendTo($('.jqs-table tr', this.element)); } $('<div class="jqs-grid"><div class="jqs-grid-head...
javascript
function () { $('<table class="jqs-table"><tr></tr></table>').appendTo($(this.element)); for (var i = 0; i < this.settings.days; i++) { $('<td><div class="jqs-day"></div></td>'). appendTo($('.jqs-table tr', this.element)); } $('<div class="jqs-grid"><div class="jqs-grid-head...
[ "function", "(", ")", "{", "$", "(", "'<table class=\"jqs-table\"><tr></tr></table>'", ")", ".", "appendTo", "(", "$", "(", "this", ".", "element", ")", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "settings", ".", "days", ...
Generate schedule structure
[ "Generate", "schedule", "structure" ]
a9df541cb16572a83a5b1f5fdbe611ea88a77835
https://github.com/Yehzuna/jquery-schedule/blob/a9df541cb16572a83a5b1f5fdbe611ea88a77835/dist/jquery.schedule.js#L222-L250
32,454
Yehzuna/jquery-schedule
dist/jquery.schedule.js
function (period) { if (!this.settings.onDuplicatePeriod.call(this, period, this.element)) { var options = this.periodData(period); var position = Math.round(period.position().top / this.periodPosition); var height = Math.round(period.height() / this.periodPosition); var $this = t...
javascript
function (period) { if (!this.settings.onDuplicatePeriod.call(this, period, this.element)) { var options = this.periodData(period); var position = Math.round(period.position().top / this.periodPosition); var height = Math.round(period.height() / this.periodPosition); var $this = t...
[ "function", "(", "period", ")", "{", "if", "(", "!", "this", ".", "settings", ".", "onDuplicatePeriod", ".", "call", "(", "this", ",", "period", ",", "this", ".", "element", ")", ")", "{", "var", "options", "=", "this", ".", "periodData", "(", "perio...
Duplicate a period @param period
[ "Duplicate", "a", "period" ]
a9df541cb16572a83a5b1f5fdbe611ea88a77835
https://github.com/Yehzuna/jquery-schedule/blob/a9df541cb16572a83a5b1f5fdbe611ea88a77835/dist/jquery.schedule.js#L421-L434
32,455
Yehzuna/jquery-schedule
dist/jquery.schedule.js
function (ui) { var start = Math.round(ui.position.top / this.periodPosition); var end = Math.round(($(ui.helper).height() + ui.position.top) / this.periodPosition); return this.periodFormat(start) + ' - ' + this.periodFormat(end); }
javascript
function (ui) { var start = Math.round(ui.position.top / this.periodPosition); var end = Math.round(($(ui.helper).height() + ui.position.top) / this.periodPosition); return this.periodFormat(start) + ' - ' + this.periodFormat(end); }
[ "function", "(", "ui", ")", "{", "var", "start", "=", "Math", ".", "round", "(", "ui", ".", "position", ".", "top", "/", "this", ".", "periodPosition", ")", ";", "var", "end", "=", "Math", ".", "round", "(", "(", "$", "(", "ui", ".", "helper", ...
Return a readable period string from a drag event @param ui @returns {string}
[ "Return", "a", "readable", "period", "string", "from", "a", "drag", "event" ]
a9df541cb16572a83a5b1f5fdbe611ea88a77835
https://github.com/Yehzuna/jquery-schedule/blob/a9df541cb16572a83a5b1f5fdbe611ea88a77835/dist/jquery.schedule.js#L554-L559
32,456
Yehzuna/jquery-schedule
dist/jquery.schedule.js
function (period) { var start = Math.round(period.position().top / this.periodPosition); var end = Math.round((period.height() + period.position().top) / this.periodPosition); return { start: this.periodFormat(start), end: this.periodFormat(end), title: $('.jqs-period-title', ...
javascript
function (period) { var start = Math.round(period.position().top / this.periodPosition); var end = Math.round((period.height() + period.position().top) / this.periodPosition); return { start: this.periodFormat(start), end: this.periodFormat(end), title: $('.jqs-period-title', ...
[ "function", "(", "period", ")", "{", "var", "start", "=", "Math", ".", "round", "(", "period", ".", "position", "(", ")", ".", "top", "/", "this", ".", "periodPosition", ")", ";", "var", "end", "=", "Math", ".", "round", "(", "(", "period", ".", ...
Return an object with all period data @param period @returns {[*,*]}
[ "Return", "an", "object", "with", "all", "period", "data" ]
a9df541cb16572a83a5b1f5fdbe611ea88a77835
https://github.com/Yehzuna/jquery-schedule/blob/a9df541cb16572a83a5b1f5fdbe611ea88a77835/dist/jquery.schedule.js#L600-L612
32,457
Yehzuna/jquery-schedule
dist/jquery.schedule.js
function (position) { if (position >= this.periodHeight) { position = 0; } if (position < 0) { position = 0; } var hour = Math.floor(position / this.periodInterval); var mn = (position / this.periodInterval - hour) * 60; if (this.settings.hour === 12) { ...
javascript
function (position) { if (position >= this.periodHeight) { position = 0; } if (position < 0) { position = 0; } var hour = Math.floor(position / this.periodInterval); var mn = (position / this.periodInterval - hour) * 60; if (this.settings.hour === 12) { ...
[ "function", "(", "position", ")", "{", "if", "(", "position", ">=", "this", ".", "periodHeight", ")", "{", "position", "=", "0", ";", "}", "if", "(", "position", "<", "0", ")", "{", "position", "=", "0", ";", "}", "var", "hour", "=", "Math", ".",...
Return a readable hour from a position @param position @returns {number}
[ "Return", "a", "readable", "hour", "from", "a", "position" ]
a9df541cb16572a83a5b1f5fdbe611ea88a77835
https://github.com/Yehzuna/jquery-schedule/blob/a9df541cb16572a83a5b1f5fdbe611ea88a77835/dist/jquery.schedule.js#L619-L660
32,458
Yehzuna/jquery-schedule
dist/jquery.schedule.js
function (time) { var split = time.split(':'); var hour = parseInt(split[0]); var mn = parseInt(split[1]); if (this.settings.hour === 12) { var matches = time.match(/([0-1]?[0-9]):?([0-5][0-9])?\s?(am|pm|p)?/); var ind = matches[3]; if (!ind) { ind = 'am'; ...
javascript
function (time) { var split = time.split(':'); var hour = parseInt(split[0]); var mn = parseInt(split[1]); if (this.settings.hour === 12) { var matches = time.match(/([0-1]?[0-9]):?([0-5][0-9])?\s?(am|pm|p)?/); var ind = matches[3]; if (!ind) { ind = 'am'; ...
[ "function", "(", "time", ")", "{", "var", "split", "=", "time", ".", "split", "(", "':'", ")", ";", "var", "hour", "=", "parseInt", "(", "split", "[", "0", "]", ")", ";", "var", "mn", "=", "parseInt", "(", "split", "[", "1", "]", ")", ";", "i...
Return a position from a readable hour @param time @returns {number}
[ "Return", "a", "position", "from", "a", "readable", "hour" ]
a9df541cb16572a83a5b1f5fdbe611ea88a77835
https://github.com/Yehzuna/jquery-schedule/blob/a9df541cb16572a83a5b1f5fdbe611ea88a77835/dist/jquery.schedule.js#L667-L706
32,459
Yehzuna/jquery-schedule
dist/jquery.schedule.js
function (current) { var currentStart = Math.round(current.position().top); var currentEnd = Math.round(current.position().top + current.height()); var start = 0; var end = 0; var check = true; $('.jqs-period', $(current).parent()).each(function (index, period) { if (current...
javascript
function (current) { var currentStart = Math.round(current.position().top); var currentEnd = Math.round(current.position().top + current.height()); var start = 0; var end = 0; var check = true; $('.jqs-period', $(current).parent()).each(function (index, period) { if (current...
[ "function", "(", "current", ")", "{", "var", "currentStart", "=", "Math", ".", "round", "(", "current", ".", "position", "(", ")", ".", "top", ")", ";", "var", "currentEnd", "=", "Math", ".", "round", "(", "current", ".", "position", "(", ")", ".", ...
Check if a period is valid @param current @returns {boolean}
[ "Check", "if", "a", "period", "is", "valid" ]
a9df541cb16572a83a5b1f5fdbe611ea88a77835
https://github.com/Yehzuna/jquery-schedule/blob/a9df541cb16572a83a5b1f5fdbe611ea88a77835/dist/jquery.schedule.js#L749-L780
32,460
Yehzuna/jquery-schedule
dist/jquery.schedule.js
function () { var $this = this; var data = []; $('.jqs-day', $this.element).each(function (index, day) { var periods = []; $('.jqs-period', day).each(function (index, period) { periods.push($this.periodData($(period))); }); data.push({ day: index, ...
javascript
function () { var $this = this; var data = []; $('.jqs-day', $this.element).each(function (index, day) { var periods = []; $('.jqs-period', day).each(function (index, period) { periods.push($this.periodData($(period))); }); data.push({ day: index, ...
[ "function", "(", ")", "{", "var", "$this", "=", "this", ";", "var", "data", "=", "[", "]", ";", "$", "(", "'.jqs-day'", ",", "$this", ".", "element", ")", ".", "each", "(", "function", "(", "index", ",", "day", ")", "{", "var", "periods", "=", ...
Export data to JSON string @returns {string}
[ "Export", "data", "to", "JSON", "string" ]
a9df541cb16572a83a5b1f5fdbe611ea88a77835
https://github.com/Yehzuna/jquery-schedule/blob/a9df541cb16572a83a5b1f5fdbe611ea88a77835/dist/jquery.schedule.js#L786-L803
32,461
Yehzuna/jquery-schedule
dist/jquery.schedule.js
function (args) { var $this = this; var dataImport = args[1]; var ret = []; $.each(dataImport, function (index, data) { $.each(data.periods, function (index, period) { var parent = $('.jqs-day', $this.element).eq(data.day); var options = {}; var height, posi...
javascript
function (args) { var $this = this; var dataImport = args[1]; var ret = []; $.each(dataImport, function (index, data) { $.each(data.periods, function (index, period) { var parent = $('.jqs-day', $this.element).eq(data.day); var options = {}; var height, posi...
[ "function", "(", "args", ")", "{", "var", "$this", "=", "this", ";", "var", "dataImport", "=", "args", "[", "1", "]", ";", "var", "ret", "=", "[", "]", ";", "$", ".", "each", "(", "dataImport", ",", "function", "(", "index", ",", "data", ")", "...
Import data on plugin init @param args @returns {Array}
[ "Import", "data", "on", "plugin", "init" ]
a9df541cb16572a83a5b1f5fdbe611ea88a77835
https://github.com/Yehzuna/jquery-schedule/blob/a9df541cb16572a83a5b1f5fdbe611ea88a77835/dist/jquery.schedule.js#L810-L849
32,462
DanielBaulig/node-gettext
lib/gettext.js
function (d, msgctxt, msgid, msgid_plural, n, category) { if (! msgid) { return ''; } var msg_ctxt_id = msgctxt ? msgctxt + this.context_glue + msgid : msgid; var domainname = d || this.domain || 'messages'; var lang = this.lang; // category is always LC_ME...
javascript
function (d, msgctxt, msgid, msgid_plural, n, category) { if (! msgid) { return ''; } var msg_ctxt_id = msgctxt ? msgctxt + this.context_glue + msgid : msgid; var domainname = d || this.domain || 'messages'; var lang = this.lang; // category is always LC_ME...
[ "function", "(", "d", ",", "msgctxt", ",", "msgid", ",", "msgid_plural", ",", "n", ",", "category", ")", "{", "if", "(", "!", "msgid", ")", "{", "return", "''", ";", "}", "var", "msg_ctxt_id", "=", "msgctxt", "?", "msgctxt", "+", "this", ".", "cont...
this has all the options, so we use it for all of them.
[ "this", "has", "all", "the", "options", "so", "we", "use", "it", "for", "all", "of", "them", "." ]
39dd22e6af8a601cfbbd6eb27ac8dbbe6075cb63
https://github.com/DanielBaulig/node-gettext/blob/39dd22e6af8a601cfbbd6eb27ac8dbbe6075cb63/lib/gettext.js#L311-L386
32,463
janvotava/swagger-koa
example/public/swagger/lib/handlebars-1.0.rc.1.js
function(mustache, program, inverse) { var params = mustache.params; this.pushParams(params); this.opcode('pushProgram', program); this.opcode('pushProgram', inverse); if(mustache.hash) { this.hash(mustache.hash); } else { this.opcode('pushLiteral', '{}'); } ...
javascript
function(mustache, program, inverse) { var params = mustache.params; this.pushParams(params); this.opcode('pushProgram', program); this.opcode('pushProgram', inverse); if(mustache.hash) { this.hash(mustache.hash); } else { this.opcode('pushLiteral', '{}'); } ...
[ "function", "(", "mustache", ",", "program", ",", "inverse", ")", "{", "var", "params", "=", "mustache", ".", "params", ";", "this", ".", "pushParams", "(", "params", ")", ";", "this", ".", "opcode", "(", "'pushProgram'", ",", "program", ")", ";", "thi...
this will replace setupMustacheParams when we're done
[ "this", "will", "replace", "setupMustacheParams", "when", "we", "re", "done" ]
510696b3eca3bcaf23a0cd4d2debcb5986d55860
https://github.com/janvotava/swagger-koa/blob/510696b3eca3bcaf23a0cd4d2debcb5986d55860/example/public/swagger/lib/handlebars-1.0.rc.1.js#L1140-L1154
32,464
janvotava/swagger-koa
lib/swagger-koa/index.js
parseCoffeeDocs
function parseCoffeeDocs(file, fn) { fs.readFile(file, function(err, data) { if (err) { fn(err); } var js = coffee.compile(data.toString()); var regex = /\/\**([\s\S]*?)\*\//gm; var fragments = js.match(regex); var docs = []; for (var i = 0; i < fragments.length; i++) { var f...
javascript
function parseCoffeeDocs(file, fn) { fs.readFile(file, function(err, data) { if (err) { fn(err); } var js = coffee.compile(data.toString()); var regex = /\/\**([\s\S]*?)\*\//gm; var fragments = js.match(regex); var docs = []; for (var i = 0; i < fragments.length; i++) { var f...
[ "function", "parseCoffeeDocs", "(", "file", ",", "fn", ")", "{", "fs", ".", "readFile", "(", "file", ",", "function", "(", "err", ",", "data", ")", "{", "if", "(", "err", ")", "{", "fn", "(", "err", ")", ";", "}", "var", "js", "=", "coffee", "....
Parse coffeeDoc from a coffee file @api private @param {String} file @param {Function} fn
[ "Parse", "coffeeDoc", "from", "a", "coffee", "file" ]
510696b3eca3bcaf23a0cd4d2debcb5986d55860
https://github.com/janvotava/swagger-koa/blob/510696b3eca3bcaf23a0cd4d2debcb5986d55860/lib/swagger-koa/index.js#L82-L104
32,465
janvotava/swagger-koa
lib/swagger-koa/index.js
getSwagger
function getSwagger(fragment, fn) { for (var i = 0; i < fragment.tags.length; i++) { var tag = fragment.tags[i]; if ('swagger' === tag.title) { return yaml.safeLoadAll(tag.description, fn); } } return fn(false); }
javascript
function getSwagger(fragment, fn) { for (var i = 0; i < fragment.tags.length; i++) { var tag = fragment.tags[i]; if ('swagger' === tag.title) { return yaml.safeLoadAll(tag.description, fn); } } return fn(false); }
[ "function", "getSwagger", "(", "fragment", ",", "fn", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "fragment", ".", "tags", ".", "length", ";", "i", "++", ")", "{", "var", "tag", "=", "fragment", ".", "tags", "[", "i", "]", ";", ...
Get jsDoc tag with title '@swagger' @api private @param {Object} fragment @param {Function} fn
[ "Get", "jsDoc", "tag", "with", "title" ]
510696b3eca3bcaf23a0cd4d2debcb5986d55860
https://github.com/janvotava/swagger-koa/blob/510696b3eca3bcaf23a0cd4d2debcb5986d55860/lib/swagger-koa/index.js#L112-L121
32,466
janvotava/swagger-koa
lib/swagger-koa/index.js
readApi
function readApi(file, fn) { var ext = path.extname(file); if ('.js' === ext || '.ts' === ext) { readJsDoc(file, fn); } else if ('.yml' === ext) { readYml(file, fn); } else if ('.coffee' === ext) { readCoffee(file, fn); } else { throw new Error('Unsupported extension \'' + ext + '\''); } }
javascript
function readApi(file, fn) { var ext = path.extname(file); if ('.js' === ext || '.ts' === ext) { readJsDoc(file, fn); } else if ('.yml' === ext) { readYml(file, fn); } else if ('.coffee' === ext) { readCoffee(file, fn); } else { throw new Error('Unsupported extension \'' + ext + '\''); } }
[ "function", "readApi", "(", "file", ",", "fn", ")", "{", "var", "ext", "=", "path", ".", "extname", "(", "file", ")", ";", "if", "(", "'.js'", "===", "ext", "||", "'.ts'", "===", "ext", ")", "{", "readJsDoc", "(", "file", ",", "fn", ")", ";", "...
Read API from file @api private @param {String} file @param {Function} fn
[ "Read", "API", "from", "file" ]
510696b3eca3bcaf23a0cd4d2debcb5986d55860
https://github.com/janvotava/swagger-koa/blob/510696b3eca3bcaf23a0cd4d2debcb5986d55860/lib/swagger-koa/index.js#L209-L220
32,467
thlorenz/proxyquireify
lib/prelude.js
function(x){ var pqify = (proxyquireifyName != null) && cache[proxyquireifyName]; // Only try to use the proxyquireify version if it has been `require`d if (pqify && pqify.exports._proxy) { return pqify.exports._proxy(req, x); } else { ...
javascript
function(x){ var pqify = (proxyquireifyName != null) && cache[proxyquireifyName]; // Only try to use the proxyquireify version if it has been `require`d if (pqify && pqify.exports._proxy) { return pqify.exports._proxy(req, x); } else { ...
[ "function", "(", "x", ")", "{", "var", "pqify", "=", "(", "proxyquireifyName", "!=", "null", ")", "&&", "cache", "[", "proxyquireifyName", "]", ";", "// Only try to use the proxyquireify version if it has been `require`d", "if", "(", "pqify", "&&", "pqify", ".", "...
The require function substituted for proxyquireify
[ "The", "require", "function", "substituted", "for", "proxyquireify" ]
8f2596ee5b931a5646bb35746c805ab80f51aa99
https://github.com/thlorenz/proxyquireify/blob/8f2596ee5b931a5646bb35746c805ab80f51aa99/lib/prelude.js#L65-L73
32,468
thienhung1989/angular-tree-dnd
dist/ng-tree-dnd.debug.js
pointIsInsideBounds
function pointIsInsideBounds(x, y, bounds) { return x >= bounds.left && y >= bounds.top && x <= bounds.left + bounds.width && y <= bounds.top + bounds.height; }
javascript
function pointIsInsideBounds(x, y, bounds) { return x >= bounds.left && y >= bounds.top && x <= bounds.left + bounds.width && y <= bounds.top + bounds.height; }
[ "function", "pointIsInsideBounds", "(", "x", ",", "y", ",", "bounds", ")", "{", "return", "x", ">=", "bounds", ".", "left", "&&", "y", ">=", "bounds", ".", "top", "&&", "x", "<=", "bounds", ".", "left", "+", "bounds", ".", "width", "&&", "y", "<=",...
Check if a point is inside specified bounds @param x @param y @param bounds @returns {boolean}
[ "Check", "if", "a", "point", "is", "inside", "specified", "bounds" ]
ac1a5cf6ccd14d17f117b39cf00328d6285362bb
https://github.com/thienhung1989/angular-tree-dnd/blob/ac1a5cf6ccd14d17f117b39cf00328d6285362bb/dist/ng-tree-dnd.debug.js#L1861-L1866
32,469
thienhung1989/angular-tree-dnd
dist/ng-tree-dnd.debug.js
add
function add(scope, element) { updateDelayed(); items.push({ element: element, scope: scope }); }
javascript
function add(scope, element) { updateDelayed(); items.push({ element: element, scope: scope }); }
[ "function", "add", "(", "scope", ",", "element", ")", "{", "updateDelayed", "(", ")", ";", "items", ".", "push", "(", "{", "element", ":", "element", ",", "scope", ":", "scope", "}", ")", ";", "}" ]
Add listener for event @param element @param callback
[ "Add", "listener", "for", "event" ]
ac1a5cf6ccd14d17f117b39cf00328d6285362bb
https://github.com/thienhung1989/angular-tree-dnd/blob/ac1a5cf6ccd14d17f117b39cf00328d6285362bb/dist/ng-tree-dnd.debug.js#L1904-L1911
32,470
thienhung1989/angular-tree-dnd
dist/ng-tree-dnd.debug.js
_fnCheck
function _fnCheck(callback, data) { if (angular.isUndefinedOrNull(data) || angular.isArray(data)) { return; // jmp out } if (angular.isFunction(callback)) { return callback(data, $filter); } else { ...
javascript
function _fnCheck(callback, data) { if (angular.isUndefinedOrNull(data) || angular.isArray(data)) { return; // jmp out } if (angular.isFunction(callback)) { return callback(data, $filter); } else { ...
[ "function", "_fnCheck", "(", "callback", ",", "data", ")", "{", "if", "(", "angular", ".", "isUndefinedOrNull", "(", "data", ")", "||", "angular", ".", "isArray", "(", "data", ")", ")", "{", "return", ";", "// jmp out", "}", "if", "(", "angular", ".", ...
Check data with callback @param {string|object|function|regex} callback @param {*} data @returns {undefined|boolean} @private
[ "Check", "data", "with", "callback" ]
ac1a5cf6ccd14d17f117b39cf00328d6285362bb
https://github.com/thienhung1989/angular-tree-dnd/blob/ac1a5cf6ccd14d17f117b39cf00328d6285362bb/dist/ng-tree-dnd.debug.js#L1975-L2002
32,471
thienhung1989/angular-tree-dnd
dist/ng-tree-dnd.debug.js
_fnAfter
function _fnAfter(options, node, isNodePassed, isChildPassed, isParentPassed) { if (isNodePassed === true) { node.__filtered__ = true; node.__filtered_visible__ = true; node.__filtered_index__ = options.filter_index++; ...
javascript
function _fnAfter(options, node, isNodePassed, isChildPassed, isParentPassed) { if (isNodePassed === true) { node.__filtered__ = true; node.__filtered_visible__ = true; node.__filtered_index__ = options.filter_index++; ...
[ "function", "_fnAfter", "(", "options", ",", "node", ",", "isNodePassed", ",", "isChildPassed", ",", "isParentPassed", ")", "{", "if", "(", "isNodePassed", "===", "true", ")", "{", "node", ".", "__filtered__", "=", "true", ";", "node", ".", "__filtered_visib...
Will call _fnAfter to clear data no need @param {object} options @param {object} node @param {boolean} isNodePassed @param {boolean} isChildPassed @param {boolean} isParentPassed @private
[ "Will", "call", "_fnAfter", "to", "clear", "data", "no", "need" ]
ac1a5cf6ccd14d17f117b39cf00328d6285362bb
https://github.com/thienhung1989/angular-tree-dnd/blob/ac1a5cf6ccd14d17f117b39cf00328d6285362bb/dist/ng-tree-dnd.debug.js#L2077-L2095
32,472
thienhung1989/angular-tree-dnd
dist/ng-tree-dnd.debug.js
_fnConvert
function _fnConvert(filters) { var _iF, _lenF, _keysF, _filter, _state; // convert filter object to array filter if (angular.isObject(filters) && !angular.isArray(filters)) { _keysF = Object.keys(filters); ...
javascript
function _fnConvert(filters) { var _iF, _lenF, _keysF, _filter, _state; // convert filter object to array filter if (angular.isObject(filters) && !angular.isArray(filters)) { _keysF = Object.keys(filters); ...
[ "function", "_fnConvert", "(", "filters", ")", "{", "var", "_iF", ",", "_lenF", ",", "_keysF", ",", "_filter", ",", "_state", ";", "// convert filter object to array filter", "if", "(", "angular", ".", "isObject", "(", "filters", ")", "&&", "!", "angular", "...
`_fnConvert` to convert `filter` `object` to `array` invaild. @param {object|array} filters @returns {array} Instead of `filter` or new array invaild *(converted from filter)* @private
[ "_fnConvert", "to", "convert", "filter", "object", "to", "array", "invaild", "." ]
ac1a5cf6ccd14d17f117b39cf00328d6285362bb
https://github.com/thienhung1989/angular-tree-dnd/blob/ac1a5cf6ccd14d17f117b39cf00328d6285362bb/dist/ng-tree-dnd.debug.js#L2134-L2169
32,473
pattern-lab/styleguidekit-assets-default
dist/styleguide/js/patternlab-viewer.js
function (e) { var patternName; var state = e.state; if (state === null) { this.skipBack = false; return; } else if (state !== null) { patternName = state.pattern; } var iFramePath = ""; iFramePath = this.getFileName(patternName); if (iFramePath === "") { iFramePath = "styleguide/html/sty...
javascript
function (e) { var patternName; var state = e.state; if (state === null) { this.skipBack = false; return; } else if (state !== null) { patternName = state.pattern; } var iFramePath = ""; iFramePath = this.getFileName(patternName); if (iFramePath === "") { iFramePath = "styleguide/html/sty...
[ "function", "(", "e", ")", "{", "var", "patternName", ";", "var", "state", "=", "e", ".", "state", ";", "if", "(", "state", "===", "null", ")", "{", "this", ".", "skipBack", "=", "false", ";", "return", ";", "}", "else", "if", "(", "state", "!=="...
based on a click forward or backward modify the url and iframe source @param {Object} event info like state and properties set in pushState()
[ "based", "on", "a", "click", "forward", "or", "backward", "modify", "the", "url", "and", "iframe", "source" ]
a4d566b6bb9ed40474389168972ed1f39f042273
https://github.com/pattern-lab/styleguidekit-assets-default/blob/a4d566b6bb9ed40474389168972ed1f39f042273/dist/styleguide/js/patternlab-viewer.js#L366-L391
32,474
pattern-lab/styleguidekit-assets-default
dist/styleguide/js/patternlab-viewer.js
function () { // make sure the listener for checkpanels is set-up Dispatcher.addListener('insertPanels', modalViewer.insert); // add the info/code panel onclick handler $('.pl-js-pattern-info-toggle').click(function (e) { modalViewer.toggle(); }); // make sure the close button handles the click $('....
javascript
function () { // make sure the listener for checkpanels is set-up Dispatcher.addListener('insertPanels', modalViewer.insert); // add the info/code panel onclick handler $('.pl-js-pattern-info-toggle').click(function (e) { modalViewer.toggle(); }); // make sure the close button handles the click $('....
[ "function", "(", ")", "{", "// make sure the listener for checkpanels is set-up", "Dispatcher", ".", "addListener", "(", "'insertPanels'", ",", "modalViewer", ".", "insert", ")", ";", "// add the info/code panel onclick handler", "$", "(", "'.pl-js-pattern-info-toggle'", ")",...
initialize the modal window
[ "initialize", "the", "modal", "window" ]
a4d566b6bb9ed40474389168972ed1f39f042273
https://github.com/pattern-lab/styleguidekit-assets-default/blob/a4d566b6bb9ed40474389168972ed1f39f042273/dist/styleguide/js/patternlab-viewer.js#L427-L473
32,475
pattern-lab/styleguidekit-assets-default
dist/styleguide/js/patternlab-viewer.js
function (templateRendered, patternPartial, iframePassback, switchText) { if (iframePassback) { // send a message to the pattern var obj = JSON.stringify({ 'event': 'patternLab.patternModalInsert', 'patternPartial': patternPartial, 'modalContent': templateRendered.outerHTML }); document.quer...
javascript
function (templateRendered, patternPartial, iframePassback, switchText) { if (iframePassback) { // send a message to the pattern var obj = JSON.stringify({ 'event': 'patternLab.patternModalInsert', 'patternPartial': patternPartial, 'modalContent': templateRendered.outerHTML }); document.quer...
[ "function", "(", "templateRendered", ",", "patternPartial", ",", "iframePassback", ",", "switchText", ")", "{", "if", "(", "iframePassback", ")", "{", "// send a message to the pattern", "var", "obj", "=", "JSON", ".", "stringify", "(", "{", "'event'", ":", "'pa...
insert the copy for the modal window. if it's meant to be sent back to the iframe, do that. @param {String} the rendered template that should be inserted @param {String} the patternPartial that the rendered template is related to @param {Boolean} if the refresh is of a view-all view and the content ...
[ "insert", "the", "copy", "for", "the", "modal", "window", ".", "if", "it", "s", "meant", "to", "be", "sent", "back", "to", "the", "iframe", "do", "that", "." ]
a4d566b6bb9ed40474389168972ed1f39f042273
https://github.com/pattern-lab/styleguidekit-assets-default/blob/a4d566b6bb9ed40474389168972ed1f39f042273/dist/styleguide/js/patternlab-viewer.js#L546-L571
32,476
pattern-lab/styleguidekit-assets-default
dist/styleguide/js/patternlab-viewer.js
function (patternPartial, panelID) { var els; // turn off all of the active tabs els = document.querySelectorAll('#pl-' + patternPartial + '-tabs .pl-js-tab-link'); for (i = 0; i < els.length; ++i) { els[i].classList.remove('pl-is-active-tab'); } // hide all of the panels els = document.querySelecto...
javascript
function (patternPartial, panelID) { var els; // turn off all of the active tabs els = document.querySelectorAll('#pl-' + patternPartial + '-tabs .pl-js-tab-link'); for (i = 0; i < els.length; ++i) { els[i].classList.remove('pl-is-active-tab'); } // hide all of the panels els = document.querySelecto...
[ "function", "(", "patternPartial", ",", "panelID", ")", "{", "var", "els", ";", "// turn off all of the active tabs", "els", "=", "document", ".", "querySelectorAll", "(", "'#pl-'", "+", "patternPartial", "+", "'-tabs .pl-js-tab-link'", ")", ";", "for", "(", "i", ...
Show a specific modal @param {String} the pattern partial for the modal @param {String} the ID of the panel to be shown
[ "Show", "a", "specific", "modal" ]
a4d566b6bb9ed40474389168972ed1f39f042273
https://github.com/pattern-lab/styleguidekit-assets-default/blob/a4d566b6bb9ed40474389168972ed1f39f042273/dist/styleguide/js/patternlab-viewer.js#L743-L765
32,477
pattern-lab/styleguidekit-assets-default
dist/styleguide/js/patternlab-viewer.js
function (patternData, iframePassback, switchText) { Dispatcher.addListener('checkPanels', panelsViewer.checkPanels); // set-up defaults var template, templateCompiled, templateRendered, panel; // get the base panels var panels = Panels.get(); // evaluate panels array and create content for (var i = 0...
javascript
function (patternData, iframePassback, switchText) { Dispatcher.addListener('checkPanels', panelsViewer.checkPanels); // set-up defaults var template, templateCompiled, templateRendered, panel; // get the base panels var panels = Panels.get(); // evaluate panels array and create content for (var i = 0...
[ "function", "(", "patternData", ",", "iframePassback", ",", "switchText", ")", "{", "Dispatcher", ".", "addListener", "(", "'checkPanels'", ",", "panelsViewer", ".", "checkPanels", ")", ";", "// set-up defaults", "var", "template", ",", "templateCompiled", ",", "t...
Gather the panels related to the modal @param {String} the data from the pattern @param {Boolean} if this is going to be passed back to the styleguide
[ "Gather", "the", "panels", "related", "to", "the", "modal" ]
a4d566b6bb9ed40474389168972ed1f39f042273
https://github.com/pattern-lab/styleguidekit-assets-default/blob/a4d566b6bb9ed40474389168972ed1f39f042273/dist/styleguide/js/patternlab-viewer.js#L960-L1025
32,478
pattern-lab/styleguidekit-assets-default
dist/styleguide/js/patternlab-viewer.js
goMedium
function goMedium() { killDisco(); killHay(); fullMode = false; sizeiframe(getRandom( minViewportWidth, config.ishViewportRange !== undefined ? parseInt(config.ishViewportRange.s[1]) : 500 )); }
javascript
function goMedium() { killDisco(); killHay(); fullMode = false; sizeiframe(getRandom( minViewportWidth, config.ishViewportRange !== undefined ? parseInt(config.ishViewportRange.s[1]) : 500 )); }
[ "function", "goMedium", "(", ")", "{", "killDisco", "(", ")", ";", "killHay", "(", ")", ";", "fullMode", "=", "false", ";", "sizeiframe", "(", "getRandom", "(", "minViewportWidth", ",", "config", ".", "ishViewportRange", "!==", "undefined", "?", "parseInt", ...
handle medium button
[ "handle", "medium", "button" ]
a4d566b6bb9ed40474389168972ed1f39f042273
https://github.com/pattern-lab/styleguidekit-assets-default/blob/a4d566b6bb9ed40474389168972ed1f39f042273/dist/styleguide/js/patternlab-viewer.js#L1534-L1542
32,479
pattern-lab/styleguidekit-assets-default
dist/styleguide/js/patternlab-viewer.js
goLarge
function goLarge() { killDisco(); killHay(); fullMode = false; sizeiframe(getRandom( config.ishViewportRange !== undefined ? parseInt(config.ishViewportRange.l[0]) : 800, config.ishViewportRange !== undefined ? parseInt(config.ishViewportRange.l[1]) : 1200 )); }
javascript
function goLarge() { killDisco(); killHay(); fullMode = false; sizeiframe(getRandom( config.ishViewportRange !== undefined ? parseInt(config.ishViewportRange.l[0]) : 800, config.ishViewportRange !== undefined ? parseInt(config.ishViewportRange.l[1]) : 1200 )); }
[ "function", "goLarge", "(", ")", "{", "killDisco", "(", ")", ";", "killHay", "(", ")", ";", "fullMode", "=", "false", ";", "sizeiframe", "(", "getRandom", "(", "config", ".", "ishViewportRange", "!==", "undefined", "?", "parseInt", "(", "config", ".", "i...
handle large button
[ "handle", "large", "button" ]
a4d566b6bb9ed40474389168972ed1f39f042273
https://github.com/pattern-lab/styleguidekit-assets-default/blob/a4d566b6bb9ed40474389168972ed1f39f042273/dist/styleguide/js/patternlab-viewer.js#L1555-L1563
32,480
pattern-lab/styleguidekit-assets-default
dist/styleguide/js/patternlab-viewer.js
killHay
function killHay() { var currentWidth = $sgIframe.width(); hayMode = false; $sgIframe.removeClass('hay-mode'); $('.pl-js-vp-iframe-container').removeClass('hay-mode'); sizeiframe(Math.floor(currentWidth)); }
javascript
function killHay() { var currentWidth = $sgIframe.width(); hayMode = false; $sgIframe.removeClass('hay-mode'); $('.pl-js-vp-iframe-container').removeClass('hay-mode'); sizeiframe(Math.floor(currentWidth)); }
[ "function", "killHay", "(", ")", "{", "var", "currentWidth", "=", "$sgIframe", ".", "width", "(", ")", ";", "hayMode", "=", "false", ";", "$sgIframe", ".", "removeClass", "(", "'hay-mode'", ")", ";", "$", "(", "'.pl-js-vp-iframe-container'", ")", ".", "rem...
Stop Hay! Mode
[ "Stop", "Hay!", "Mode" ]
a4d566b6bb9ed40474389168972ed1f39f042273
https://github.com/pattern-lab/styleguidekit-assets-default/blob/a4d566b6bb9ed40474389168972ed1f39f042273/dist/styleguide/js/patternlab-viewer.js#L1644-L1650
32,481
pattern-lab/styleguidekit-assets-default
dist/styleguide/js/patternlab-viewer.js
startHay
function startHay() { hayMode = true; $('.pl-js-vp-iframe-container').removeClass("vp-animate").width(minViewportWidth + viewportResizeHandleWidth); $sgIframe.removeClass("vp-animate").width(minViewportWidth); var timeoutID = window.setTimeout(function () { $('.pl-js-vp-iframe-container').addClass('hay-mode...
javascript
function startHay() { hayMode = true; $('.pl-js-vp-iframe-container').removeClass("vp-animate").width(minViewportWidth + viewportResizeHandleWidth); $sgIframe.removeClass("vp-animate").width(minViewportWidth); var timeoutID = window.setTimeout(function () { $('.pl-js-vp-iframe-container').addClass('hay-mode...
[ "function", "startHay", "(", ")", "{", "hayMode", "=", "true", ";", "$", "(", "'.pl-js-vp-iframe-container'", ")", ".", "removeClass", "(", "\"vp-animate\"", ")", ".", "width", "(", "minViewportWidth", "+", "viewportResizeHandleWidth", ")", ";", "$sgIframe", "."...
start Hay! mode
[ "start", "Hay!", "mode" ]
a4d566b6bb9ed40474389168972ed1f39f042273
https://github.com/pattern-lab/styleguidekit-assets-default/blob/a4d566b6bb9ed40474389168972ed1f39f042273/dist/styleguide/js/patternlab-viewer.js#L1653-L1667
32,482
yacut/brackets-nodejs-integration
src/require_hint_provider.js
create_hint
function create_hint(value, match, type, title, description, link) { var $hint = $(document.createElement('span')); $hint.addClass('brackets-js-hints brackets-js-hints-with-type-details'); $hint.attr('title', title); if (match) { value = value.replace(match, ''); ...
javascript
function create_hint(value, match, type, title, description, link) { var $hint = $(document.createElement('span')); $hint.addClass('brackets-js-hints brackets-js-hints-with-type-details'); $hint.attr('title', title); if (match) { value = value.replace(match, ''); ...
[ "function", "create_hint", "(", "value", ",", "match", ",", "type", ",", "title", ",", "description", ",", "link", ")", "{", "var", "$hint", "=", "$", "(", "document", ".", "createElement", "(", "'span'", ")", ")", ";", "$hint", ".", "addClass", "(", ...
Create code hint link with details @param {string} value @param {string} match @param {string} type @param {string} title @param {string} link
[ "Create", "code", "hint", "link", "with", "details" ]
f12976f7c21d43e40b8d5ccc5f73598e8e10593a
https://github.com/yacut/brackets-nodejs-integration/blob/f12976f7c21d43e40b8d5ccc5f73598e8e10593a/src/require_hint_provider.js#L210-L232
32,483
browserstack/selenium-webdriver-nodejs
phantomjs.js
findExecutable
function findExecutable(opt_exe) { var exe = opt_exe || io.findInPath(PHANTOMJS_EXE, true); if (!exe) { throw Error( 'The PhantomJS executable could not be found on the current PATH. ' + 'Please download the latest version from ' + 'http://phantomjs.org/download.html and ensure it can be...
javascript
function findExecutable(opt_exe) { var exe = opt_exe || io.findInPath(PHANTOMJS_EXE, true); if (!exe) { throw Error( 'The PhantomJS executable could not be found on the current PATH. ' + 'Please download the latest version from ' + 'http://phantomjs.org/download.html and ensure it can be...
[ "function", "findExecutable", "(", "opt_exe", ")", "{", "var", "exe", "=", "opt_exe", "||", "io", ".", "findInPath", "(", "PHANTOMJS_EXE", ",", "true", ")", ";", "if", "(", "!", "exe", ")", "{", "throw", "Error", "(", "'The PhantomJS executable could not be ...
Finds the PhantomJS executable. @param {string=} opt_exe Path to the executable to use. @return {string} The located executable. @throws {Error} If the executable cannot be found on the PATH, or if the provided executable path does not exist.
[ "Finds", "the", "PhantomJS", "executable", "." ]
80a1379f73354aaf722a343c2d0ccc1aa7674b29
https://github.com/browserstack/selenium-webdriver-nodejs/blob/80a1379f73354aaf722a343c2d0ccc1aa7674b29/phantomjs.js#L68-L82
32,484
browserstack/selenium-webdriver-nodejs
phantomjs.js
function(opt_capabilities, opt_flow) { var capabilities = opt_capabilities || webdriver.Capabilities.phantomjs(); var exe = findExecutable(capabilities.get(BINARY_PATH_CAPABILITY)); var args = ['--webdriver-logfile=' + DEFAULT_LOG_FILE]; var logPrefs = capabilities.get(webdriver.Capability.LOGGING_PREFS); if...
javascript
function(opt_capabilities, opt_flow) { var capabilities = opt_capabilities || webdriver.Capabilities.phantomjs(); var exe = findExecutable(capabilities.get(BINARY_PATH_CAPABILITY)); var args = ['--webdriver-logfile=' + DEFAULT_LOG_FILE]; var logPrefs = capabilities.get(webdriver.Capability.LOGGING_PREFS); if...
[ "function", "(", "opt_capabilities", ",", "opt_flow", ")", "{", "var", "capabilities", "=", "opt_capabilities", "||", "webdriver", ".", "Capabilities", ".", "phantomjs", "(", ")", ";", "var", "exe", "=", "findExecutable", "(", "capabilities", ".", "get", "(", ...
Creates a new WebDriver client for PhantomJS. @param {webdriver.Capabilities=} opt_capabilities The desired capabilities. @param {webdriver.promise.ControlFlow=} opt_flow The control flow to use, or {@code null} to use the currently active flow. @constructor @extends {webdriver.WebDriver}
[ "Creates", "a", "new", "WebDriver", "client", "for", "PhantomJS", "." ]
80a1379f73354aaf722a343c2d0ccc1aa7674b29
https://github.com/browserstack/selenium-webdriver-nodejs/blob/80a1379f73354aaf722a343c2d0ccc1aa7674b29/phantomjs.js#L123-L186
32,485
browserstack/selenium-webdriver-nodejs
firefox/index.js
function(opt_config, opt_flow) { var caps; if (opt_config instanceof Options) { caps = opt_config.toCapabilities(); } else { caps = new webdriver.Capabilities(opt_config); } var binary = caps.get('firefox_binary') || new Binary(); if (typeof binary === 'string') { binary = new Binary(binary); ...
javascript
function(opt_config, opt_flow) { var caps; if (opt_config instanceof Options) { caps = opt_config.toCapabilities(); } else { caps = new webdriver.Capabilities(opt_config); } var binary = caps.get('firefox_binary') || new Binary(); if (typeof binary === 'string') { binary = new Binary(binary); ...
[ "function", "(", "opt_config", ",", "opt_flow", ")", "{", "var", "caps", ";", "if", "(", "opt_config", "instanceof", "Options", ")", "{", "caps", "=", "opt_config", ".", "toCapabilities", "(", ")", ";", "}", "else", "{", "caps", "=", "new", "webdriver", ...
A WebDriver client for Firefox. @param {(Options|webdriver.Capabilities|Object)=} opt_config The configuration options for this driver, specified as either an {@link Options} or {@link webdriver.Capabilities}, or as a raw hash object. @param {webdriver.promise.ControlFlow=} opt_flow The flow to schedule commands throu...
[ "A", "WebDriver", "client", "for", "Firefox", "." ]
80a1379f73354aaf722a343c2d0ccc1aa7674b29
https://github.com/browserstack/selenium-webdriver-nodejs/blob/80a1379f73354aaf722a343c2d0ccc1aa7674b29/firefox/index.js#L141-L192
32,486
browserstack/selenium-webdriver-nodejs
remote/index.js
DriverService
function DriverService(executable, options) { /** @private {string} */ this.executable_ = executable; /** @private {boolean} */ this.loopbackOnly_ = !!options.loopback; /** @private {(number|!webdriver.promise.Promise.<number>)} */ this.port_ = options.port; /** * @private {!(Array.<string>|webdriv...
javascript
function DriverService(executable, options) { /** @private {string} */ this.executable_ = executable; /** @private {boolean} */ this.loopbackOnly_ = !!options.loopback; /** @private {(number|!webdriver.promise.Promise.<number>)} */ this.port_ = options.port; /** * @private {!(Array.<string>|webdriv...
[ "function", "DriverService", "(", "executable", ",", "options", ")", "{", "/** @private {string} */", "this", ".", "executable_", "=", "executable", ";", "/** @private {boolean} */", "this", ".", "loopbackOnly_", "=", "!", "!", "options", ".", "loopback", ";", "/*...
Manages the life and death of a native executable WebDriver server. <p>It is expected that the driver server implements the <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol">WebDriver Wire Protocol</a>. Furthermore, the managed server should support multiple concurrent sessions, so that this class may ...
[ "Manages", "the", "life", "and", "death", "of", "a", "native", "executable", "WebDriver", "server", "." ]
80a1379f73354aaf722a343c2d0ccc1aa7674b29
https://github.com/browserstack/selenium-webdriver-nodejs/blob/80a1379f73354aaf722a343c2d0ccc1aa7674b29/remote/index.js#L73-L112
32,487
browserstack/selenium-webdriver-nodejs
firefox/binary.js
defaultWindowsLocation
function defaultWindowsLocation() { var files = [ process.env['PROGRAMFILES'] || 'C:\\Program Files', process.env['PROGRAMFILES(X86)'] || 'C:\\Program Files (x86)' ].map(function(prefix) { return path.join(prefix, 'Mozilla Firefox\\firefox.exe'); }); return io.exists(files[0]).then(function(exists) ...
javascript
function defaultWindowsLocation() { var files = [ process.env['PROGRAMFILES'] || 'C:\\Program Files', process.env['PROGRAMFILES(X86)'] || 'C:\\Program Files (x86)' ].map(function(prefix) { return path.join(prefix, 'Mozilla Firefox\\firefox.exe'); }); return io.exists(files[0]).then(function(exists) ...
[ "function", "defaultWindowsLocation", "(", ")", "{", "var", "files", "=", "[", "process", ".", "env", "[", "'PROGRAMFILES'", "]", "||", "'C:\\\\Program Files'", ",", "process", ".", "env", "[", "'PROGRAMFILES(X86)'", "]", "||", "'C:\\\\Program Files (x86)'", "]", ...
Checks the default Windows Firefox locations in Program Files. @return {!promise.Promise.<?string>} A promise for the located executable. The promise will resolve to {@code null} if Fireox was not found.
[ "Checks", "the", "default", "Windows", "Firefox", "locations", "in", "Program", "Files", "." ]
80a1379f73354aaf722a343c2d0ccc1aa7674b29
https://github.com/browserstack/selenium-webdriver-nodejs/blob/80a1379f73354aaf722a343c2d0ccc1aa7674b29/firefox/binary.js#L50-L62
32,488
browserstack/selenium-webdriver-nodejs
firefox/binary.js
findFirefox
function findFirefox() { if (foundBinary) { return foundBinary; } if (process.platform === 'darwin') { var osxExe = '/Applications/Firefox.app/Contents/MacOS/firefox-bin'; foundBinary = io.exists(osxExe).then(function(exists) { return exists ? osxExe : null; }); } else if (process.platfo...
javascript
function findFirefox() { if (foundBinary) { return foundBinary; } if (process.platform === 'darwin') { var osxExe = '/Applications/Firefox.app/Contents/MacOS/firefox-bin'; foundBinary = io.exists(osxExe).then(function(exists) { return exists ? osxExe : null; }); } else if (process.platfo...
[ "function", "findFirefox", "(", ")", "{", "if", "(", "foundBinary", ")", "{", "return", "foundBinary", ";", "}", "if", "(", "process", ".", "platform", "===", "'darwin'", ")", "{", "var", "osxExe", "=", "'/Applications/Firefox.app/Contents/MacOS/firefox-bin'", "...
Locates the Firefox binary for the current system. @return {!promise.Promise.<string>} A promise for the located binary. The promise will be rejected if Firefox cannot be located.
[ "Locates", "the", "Firefox", "binary", "for", "the", "current", "system", "." ]
80a1379f73354aaf722a343c2d0ccc1aa7674b29
https://github.com/browserstack/selenium-webdriver-nodejs/blob/80a1379f73354aaf722a343c2d0ccc1aa7674b29/firefox/binary.js#L70-L92
32,489
browserstack/selenium-webdriver-nodejs
firefox/binary.js
installNoFocusLibs
function installNoFocusLibs(profileDir) { var x86 = path.join(profileDir, 'x86'); var amd64 = path.join(profileDir, 'amd64'); return mkdir(x86) .then(copyLib.bind(null, NO_FOCUS_LIB_X86, x86)) .then(mkdir.bind(null, amd64)) .then(copyLib.bind(null, NO_FOCUS_LIB_AMD64, amd64)) .then(functi...
javascript
function installNoFocusLibs(profileDir) { var x86 = path.join(profileDir, 'x86'); var amd64 = path.join(profileDir, 'amd64'); return mkdir(x86) .then(copyLib.bind(null, NO_FOCUS_LIB_X86, x86)) .then(mkdir.bind(null, amd64)) .then(copyLib.bind(null, NO_FOCUS_LIB_AMD64, amd64)) .then(functi...
[ "function", "installNoFocusLibs", "(", "profileDir", ")", "{", "var", "x86", "=", "path", ".", "join", "(", "profileDir", ",", "'x86'", ")", ";", "var", "amd64", "=", "path", ".", "join", "(", "profileDir", ",", "'amd64'", ")", ";", "return", "mkdir", ...
Copies the no focus libs into the given profile directory. @param {string} profileDir Path to the profile directory to install into. @return {!promise.Promise.<string>} The LD_LIBRARY_PATH prefix string to use for the installed libs.
[ "Copies", "the", "no", "focus", "libs", "into", "the", "given", "profile", "directory", "." ]
80a1379f73354aaf722a343c2d0ccc1aa7674b29
https://github.com/browserstack/selenium-webdriver-nodejs/blob/80a1379f73354aaf722a343c2d0ccc1aa7674b29/firefox/binary.js#L101-L124
32,490
browserstack/selenium-webdriver-nodejs
firefox/binary.js
function(opt_exe) { /** @private {(string|undefined)} */ this.exe_ = opt_exe; /** @private {!Array.<string>} */ this.args_ = []; /** @private {!Object.<string, string>} */ this.env_ = {}; Object.keys(process.env).forEach(function(key) { this.env_[key] = process.env[key]; }.bind(this)); this.env_...
javascript
function(opt_exe) { /** @private {(string|undefined)} */ this.exe_ = opt_exe; /** @private {!Array.<string>} */ this.args_ = []; /** @private {!Object.<string, string>} */ this.env_ = {}; Object.keys(process.env).forEach(function(key) { this.env_[key] = process.env[key]; }.bind(this)); this.env_...
[ "function", "(", "opt_exe", ")", "{", "/** @private {(string|undefined)} */", "this", ".", "exe_", "=", "opt_exe", ";", "/** @private {!Array.<string>} */", "this", ".", "args_", "=", "[", "]", ";", "/** @private {!Object.<string, string>} */", "this", ".", "env_", "=...
Manages a Firefox subprocess configured for use with WebDriver. @param {string=} opt_exe Path to the Firefox binary to use. If not specified, will attempt to locate Firefox on the current system. @constructor
[ "Manages", "a", "Firefox", "subprocess", "configured", "for", "use", "with", "WebDriver", "." ]
80a1379f73354aaf722a343c2d0ccc1aa7674b29
https://github.com/browserstack/selenium-webdriver-nodejs/blob/80a1379f73354aaf722a343c2d0ccc1aa7674b29/firefox/binary.js#L155-L173
32,491
browserstack/selenium-webdriver-nodejs
firefox/profile.js
getDefaultPreferences
function getDefaultPreferences() { if (!defaultPreferences) { var contents = fs.readFileSync(WEBDRIVER_PREFERENCES_PATH, 'utf8'); defaultPreferences = JSON.parse(contents); } return defaultPreferences; }
javascript
function getDefaultPreferences() { if (!defaultPreferences) { var contents = fs.readFileSync(WEBDRIVER_PREFERENCES_PATH, 'utf8'); defaultPreferences = JSON.parse(contents); } return defaultPreferences; }
[ "function", "getDefaultPreferences", "(", ")", "{", "if", "(", "!", "defaultPreferences", ")", "{", "var", "contents", "=", "fs", ".", "readFileSync", "(", "WEBDRIVER_PREFERENCES_PATH", ",", "'utf8'", ")", ";", "defaultPreferences", "=", "JSON", ".", "parse", ...
Synchronously loads the default preferences used for the FirefoxDriver. @return {!Object} The default preferences JSON object.
[ "Synchronously", "loads", "the", "default", "preferences", "used", "for", "the", "FirefoxDriver", "." ]
80a1379f73354aaf722a343c2d0ccc1aa7674b29
https://github.com/browserstack/selenium-webdriver-nodejs/blob/80a1379f73354aaf722a343c2d0ccc1aa7674b29/firefox/profile.js#L52-L58
32,492
browserstack/selenium-webdriver-nodejs
firefox/profile.js
loadUserPrefs
function loadUserPrefs(f) { var done = promise.defer(); fs.readFile(f, function(err, contents) { if (err && err.code === 'ENOENT') { done.fulfill({}); return; } if (err) { done.reject(err); return; } var prefs = {}; var context = vm.createContext({ 'user_pref'...
javascript
function loadUserPrefs(f) { var done = promise.defer(); fs.readFile(f, function(err, contents) { if (err && err.code === 'ENOENT') { done.fulfill({}); return; } if (err) { done.reject(err); return; } var prefs = {}; var context = vm.createContext({ 'user_pref'...
[ "function", "loadUserPrefs", "(", "f", ")", "{", "var", "done", "=", "promise", ".", "defer", "(", ")", ";", "fs", ".", "readFile", "(", "f", ",", "function", "(", "err", ",", "contents", ")", "{", "if", "(", "err", "&&", "err", ".", "code", "===...
Parses a user.js file in a Firefox profile directory. @param {string} f Path to the file to parse. @return {!promise.Promise.<!Object>} A promise for the parsed preferences as a JSON object. If the file does not exist, an empty object will be returned.
[ "Parses", "a", "user", ".", "js", "file", "in", "a", "Firefox", "profile", "directory", "." ]
80a1379f73354aaf722a343c2d0ccc1aa7674b29
https://github.com/browserstack/selenium-webdriver-nodejs/blob/80a1379f73354aaf722a343c2d0ccc1aa7674b29/firefox/profile.js#L68-L92
32,493
browserstack/selenium-webdriver-nodejs
firefox/profile.js
mixin
function mixin(a, b) { Object.keys(b).forEach(function(key) { a[key] = b[key]; }); }
javascript
function mixin(a, b) { Object.keys(b).forEach(function(key) { a[key] = b[key]; }); }
[ "function", "mixin", "(", "a", ",", "b", ")", "{", "Object", ".", "keys", "(", "b", ")", ".", "forEach", "(", "function", "(", "key", ")", "{", "a", "[", "key", "]", "=", "b", "[", "key", "]", ";", "}", ")", ";", "}" ]
Copies the properties of one object into another. @param {!Object} a The destination object. @param {!Object} b The source object to apply as a mixin.
[ "Copies", "the", "properties", "of", "one", "object", "into", "another", "." ]
80a1379f73354aaf722a343c2d0ccc1aa7674b29
https://github.com/browserstack/selenium-webdriver-nodejs/blob/80a1379f73354aaf722a343c2d0ccc1aa7674b29/firefox/profile.js#L100-L104
32,494
browserstack/selenium-webdriver-nodejs
firefox/profile.js
installExtensions
function installExtensions(extensions, dir, opt_excludeWebDriverExt) { var hasWebDriver = !!opt_excludeWebDriverExt; var next = 0; var extensionDir = path.join(dir, 'extensions'); var done = promise.defer(); return io.exists(extensionDir).then(function(exists) { if (!exists) { return promise.checke...
javascript
function installExtensions(extensions, dir, opt_excludeWebDriverExt) { var hasWebDriver = !!opt_excludeWebDriverExt; var next = 0; var extensionDir = path.join(dir, 'extensions'); var done = promise.defer(); return io.exists(extensionDir).then(function(exists) { if (!exists) { return promise.checke...
[ "function", "installExtensions", "(", "extensions", ",", "dir", ",", "opt_excludeWebDriverExt", ")", "{", "var", "hasWebDriver", "=", "!", "!", "opt_excludeWebDriverExt", ";", "var", "next", "=", "0", ";", "var", "extensionDir", "=", "path", ".", "join", "(", ...
Installs a group of extensions in the given profile directory. If the WebDriver extension is not included in this set, the default version bundled with this package will be installed. @param {!Array.<string>} extensions The extensions to install, as a path to an unpacked extension directory or a path to a xpi file. @pa...
[ "Installs", "a", "group", "of", "extensions", "in", "the", "given", "profile", "directory", ".", "If", "the", "WebDriver", "extension", "is", "not", "included", "in", "this", "set", "the", "default", "version", "bundled", "with", "this", "package", "will", "...
80a1379f73354aaf722a343c2d0ccc1aa7674b29
https://github.com/browserstack/selenium-webdriver-nodejs/blob/80a1379f73354aaf722a343c2d0ccc1aa7674b29/firefox/profile.js#L147-L184
32,495
browserstack/selenium-webdriver-nodejs
firefox/profile.js
decode
function decode(data) { return io.tmpFile().then(function(file) { var buf = new Buffer(data, 'base64'); return promise.checkedNodeCall(fs.writeFile, file, buf).then(function() { return io.tmpDir(); }).then(function(dir) { var zip = new AdmZip(file); zip.extractAllTo(dir); // Sync only? ...
javascript
function decode(data) { return io.tmpFile().then(function(file) { var buf = new Buffer(data, 'base64'); return promise.checkedNodeCall(fs.writeFile, file, buf).then(function() { return io.tmpDir(); }).then(function(dir) { var zip = new AdmZip(file); zip.extractAllTo(dir); // Sync only? ...
[ "function", "decode", "(", "data", ")", "{", "return", "io", ".", "tmpFile", "(", ")", ".", "then", "(", "function", "(", "file", ")", "{", "var", "buf", "=", "new", "Buffer", "(", "data", ",", "'base64'", ")", ";", "return", "promise", ".", "check...
Decodes a base64 encoded profile. @param {string} data The base64 encoded string. @return {!promise.Promise.<string>} A promise for the path to the decoded profile directory.
[ "Decodes", "a", "base64", "encoded", "profile", "." ]
80a1379f73354aaf722a343c2d0ccc1aa7674b29
https://github.com/browserstack/selenium-webdriver-nodejs/blob/80a1379f73354aaf722a343c2d0ccc1aa7674b29/firefox/profile.js#L193-L204
32,496
browserstack/selenium-webdriver-nodejs
_base.js
Context
function Context(opt_configureForTesting) { var closure = this.closure = vm.createContext({ console: console, setTimeout: setTimeout, setInterval: setInterval, clearTimeout: clearTimeout, clearInterval: clearInterval, process: process, require: require, Buffer: Buffer, Error: Error...
javascript
function Context(opt_configureForTesting) { var closure = this.closure = vm.createContext({ console: console, setTimeout: setTimeout, setInterval: setInterval, clearTimeout: clearTimeout, clearInterval: clearInterval, process: process, require: require, Buffer: Buffer, Error: Error...
[ "function", "Context", "(", "opt_configureForTesting", ")", "{", "var", "closure", "=", "this", ".", "closure", "=", "vm", ".", "createContext", "(", "{", "console", ":", "console", ",", "setTimeout", ":", "setTimeout", ",", "setInterval", ":", "setInterval", ...
Maintains a unique context for Closure library-based code. @param {boolean=} opt_configureForTesting Whether to configure a fake DOM for Closure-testing code that (incorrectly) assumes a DOM is always present. @constructor
[ "Maintains", "a", "unique", "context", "for", "Closure", "library", "-", "based", "code", "." ]
80a1379f73354aaf722a343c2d0ccc1aa7674b29
https://github.com/browserstack/selenium-webdriver-nodejs/blob/80a1379f73354aaf722a343c2d0ccc1aa7674b29/_base.js#L84-L126
32,497
browserstack/selenium-webdriver-nodejs
_base.js
loadScript
function loadScript(src) { src = path.normalize(src); var contents = fs.readFileSync(src, 'utf8'); vm.runInContext(contents, closure, src); }
javascript
function loadScript(src) { src = path.normalize(src); var contents = fs.readFileSync(src, 'utf8'); vm.runInContext(contents, closure, src); }
[ "function", "loadScript", "(", "src", ")", "{", "src", "=", "path", ".", "normalize", "(", "src", ")", ";", "var", "contents", "=", "fs", ".", "readFileSync", "(", "src", ",", "'utf8'", ")", ";", "vm", ".", "runInContext", "(", "contents", ",", "clos...
Synchronously loads a script into the protected Closure context. @param {string} src Path to the file to load.
[ "Synchronously", "loads", "a", "script", "into", "the", "protected", "Closure", "context", "." ]
80a1379f73354aaf722a343c2d0ccc1aa7674b29
https://github.com/browserstack/selenium-webdriver-nodejs/blob/80a1379f73354aaf722a343c2d0ccc1aa7674b29/_base.js#L121-L125
32,498
browserstack/selenium-webdriver-nodejs
io/exec.js
function(result, onKill) { /** @return {boolean} Whether this command is still running. */ this.isRunning = function() { return result.isPending(); }; /** * @return {!promise.Promise.<!Result>} A promise for the result of this * command. */ this.result = function() { return result; }; ...
javascript
function(result, onKill) { /** @return {boolean} Whether this command is still running. */ this.isRunning = function() { return result.isPending(); }; /** * @return {!promise.Promise.<!Result>} A promise for the result of this * command. */ this.result = function() { return result; }; ...
[ "function", "(", "result", ",", "onKill", ")", "{", "/** @return {boolean} Whether this command is still running. */", "this", ".", "isRunning", "=", "function", "(", ")", "{", "return", "result", ".", "isPending", "(", ")", ";", "}", ";", "/**\n * @return {!promi...
Represents a command running in a sub-process. @param {!promise.Promise.<!Result>} result The command result. @constructor
[ "Represents", "a", "command", "running", "in", "a", "sub", "-", "process", "." ]
80a1379f73354aaf722a343c2d0ccc1aa7674b29
https://github.com/browserstack/selenium-webdriver-nodejs/blob/80a1379f73354aaf722a343c2d0ccc1aa7674b29/io/exec.js#L73-L95
32,499
browserstack/selenium-webdriver-nodejs
lib/webdriver/promise.js
resolve
function resolve(newState, newValue) { if (webdriver.promise.Deferred.State_.PENDING !== state) { return; } if (newValue === self) { // See promise a+, 2.3.1 // http://promises-aplus.github.io/promises-spec/#point-48 throw TypeError('A promise may not resolve to itself'); } ...
javascript
function resolve(newState, newValue) { if (webdriver.promise.Deferred.State_.PENDING !== state) { return; } if (newValue === self) { // See promise a+, 2.3.1 // http://promises-aplus.github.io/promises-spec/#point-48 throw TypeError('A promise may not resolve to itself'); } ...
[ "function", "resolve", "(", "newState", ",", "newValue", ")", "{", "if", "(", "webdriver", ".", "promise", ".", "Deferred", ".", "State_", ".", "PENDING", "!==", "state", ")", "{", "return", ";", "}", "if", "(", "newValue", "===", "self", ")", "{", "...
Resolves this deferred. If the new value is a promise, this function will wait for it to be resolved before notifying the registered listeners. @param {!webdriver.promise.Deferred.State_} newState The deferred's new state. @param {*} newValue The deferred's new value.
[ "Resolves", "this", "deferred", ".", "If", "the", "new", "value", "is", "a", "promise", "this", "function", "will", "wait", "for", "it", "to", "be", "resolved", "before", "notifying", "the", "registered", "listeners", "." ]
80a1379f73354aaf722a343c2d0ccc1aa7674b29
https://github.com/browserstack/selenium-webdriver-nodejs/blob/80a1379f73354aaf722a343c2d0ccc1aa7674b29/lib/webdriver/promise.js#L376-L402