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 sequence | docstring stringlengths 4 11.8k | docstring_tokens sequence | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
ciena-blueplanet/bunsen-core | src/reducer.js | function (state, action) {
return _.defaults({
isValidating: action.isValidating,
lastAction: IS_VALIDATING
}, state)
} | javascript | function (state, action) {
return _.defaults({
isValidating: action.isValidating,
lastAction: IS_VALIDATING
}, state)
} | [
"function",
"(",
"state",
",",
"action",
")",
"{",
"return",
"_",
".",
"defaults",
"(",
"{",
"isValidating",
":",
"action",
".",
"isValidating",
",",
"lastAction",
":",
"IS_VALIDATING",
"}",
",",
"state",
")",
"}"
] | Update is validating result
@param {State} state - state to update
@param {Action} action - action
@returns {State} - updated state | [
"Update",
"is",
"validating",
"result"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/reducer.js#L394-L399 | train | |
NLeSC/spot | src/pages/analyze.js | addWidgetForFilter | function addWidgetForFilter (view, filter, editModeHint) {
var gridster = view._widgetsGridster;
var row = filter.row || 1;
var col = filter.col || 1;
var sizeX = filter.size_x || 3;
var sizeY = filter.size_y || 3;
var el = gridster.add_widget('<div class="widgetOuterFrame"></div>', sizeX, sizeY, col, row)... | javascript | function addWidgetForFilter (view, filter, editModeHint) {
var gridster = view._widgetsGridster;
var row = filter.row || 1;
var col = filter.col || 1;
var sizeX = filter.size_x || 3;
var sizeY = filter.size_y || 3;
var el = gridster.add_widget('<div class="widgetOuterFrame"></div>', sizeX, sizeY, col, row)... | [
"function",
"addWidgetForFilter",
"(",
"view",
",",
"filter",
",",
"editModeHint",
")",
"{",
"var",
"gridster",
"=",
"view",
".",
"_widgetsGridster",
";",
"var",
"row",
"=",
"filter",
".",
"row",
"||",
"1",
";",
"var",
"col",
"=",
"filter",
".",
"col",
... | Add a widget to the analyze page for the given filter
view {View} Ampersand View instance of the analyze page
filter {Filter} Spot filter instance to create the widget for
editModeHint {boolean} Try to start plot in editMode (ie. accepts dnd of facets) [true] or in interaction mode (false) | [
"Add",
"a",
"widget",
"to",
"the",
"analyze",
"page",
"for",
"the",
"given",
"filter"
] | 8e02b6e0b80a21a7fe5c62b48bf121c0f2b8e417 | https://github.com/NLeSC/spot/blob/8e02b6e0b80a21a7fe5c62b48bf121c0f2b8e417/src/pages/analyze.js#L83-L128 | train |
ciena-blueplanet/bunsen-core | src/validator/custom-formats/time.js | inRange | function inRange (value, min, max) {
const int = parseInt(value, 10)
return (
`${int}` === `${value.replace(/^0/, '')}` &&
int >= min &&
int <= max
)
} | javascript | function inRange (value, min, max) {
const int = parseInt(value, 10)
return (
`${int}` === `${value.replace(/^0/, '')}` &&
int >= min &&
int <= max
)
} | [
"function",
"inRange",
"(",
"value",
",",
"min",
",",
"max",
")",
"{",
"const",
"int",
"=",
"parseInt",
"(",
"value",
",",
"10",
")",
"return",
"(",
"`",
"${",
"int",
"}",
"`",
"===",
"`",
"${",
"value",
".",
"replace",
"(",
"/",
"^0",
"/",
","... | Determine if value is within a numeric range
@param {String|Number} value - value to check
@param {Number} min - start of range (inclusive)
@param {Number} max - end of range (inclusive)
@returns {Boolean} whether or not value is within range | [
"Determine",
"if",
"value",
"is",
"within",
"a",
"numeric",
"range"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/validator/custom-formats/time.js#L8-L16 | train |
helpers/helper-md | index.js | markdown | function markdown(options) {
return new Remarkable(extend({
breaks: false,
html: true,
langPrefix: 'lang-',
linkify: true,
typographer: false,
xhtmlOut: false
}, options));
} | javascript | function markdown(options) {
return new Remarkable(extend({
breaks: false,
html: true,
langPrefix: 'lang-',
linkify: true,
typographer: false,
xhtmlOut: false
}, options));
} | [
"function",
"markdown",
"(",
"options",
")",
"{",
"return",
"new",
"Remarkable",
"(",
"extend",
"(",
"{",
"breaks",
":",
"false",
",",
"html",
":",
"true",
",",
"langPrefix",
":",
"'lang-'",
",",
"linkify",
":",
"true",
",",
"typographer",
":",
"false",
... | Shared settings for remarkable
@param {Object} `options`
@return {Object}
@api private | [
"Shared",
"settings",
"for",
"remarkable"
] | 6bf823b4264c341903c1b85676610bb3dbe6bcc2 | https://github.com/helpers/helper-md/blob/6bf823b4264c341903c1b85676610bb3dbe6bcc2/index.js#L108-L117 | train |
NLeSC/spot | src/widgets/views/util.js | partitionValueToIndex | function partitionValueToIndex (partition, value) {
var group;
if (!partition) {
// no(sub)partitioning return first element
return 0;
}
// with (sub)partitioning
group = partition.groups.get(value, 'value');
if (group) {
// string in partition
return group.groupIndex;
} else {
// s... | javascript | function partitionValueToIndex (partition, value) {
var group;
if (!partition) {
// no(sub)partitioning return first element
return 0;
}
// with (sub)partitioning
group = partition.groups.get(value, 'value');
if (group) {
// string in partition
return group.groupIndex;
} else {
// s... | [
"function",
"partitionValueToIndex",
"(",
"partition",
",",
"value",
")",
"{",
"var",
"group",
";",
"if",
"(",
"!",
"partition",
")",
"{",
"return",
"0",
";",
"}",
"group",
"=",
"partition",
".",
"groups",
".",
"get",
"(",
"value",
",",
"'value'",
")",... | Get the index in chartjs datastructures from the group value
with proper fallbacks
@params {Partition} partition (optional)
@params {Object} value value
@returns {number|null} index | [
"Get",
"the",
"index",
"in",
"chartjs",
"datastructures",
"from",
"the",
"group",
"value",
"with",
"proper",
"fallbacks"
] | 8e02b6e0b80a21a7fe5c62b48bf121c0f2b8e417 | https://github.com/NLeSC/spot/blob/8e02b6e0b80a21a7fe5c62b48bf121c0f2b8e417/src/widgets/views/util.js#L10-L28 | train |
ciena-blueplanet/bunsen-core | src/validator/model.js | _validateArray | function _validateArray (path, model, validateModelType) {
const results = []
let subPath = `${path}/items`
if (_.isPlainObject(model.items)) {
if (model.items.type === 'object') {
results.push(validateSubModel(subPath, model.items, validateModelType))
}
} else if (Array.isArray(model.items)) {
... | javascript | function _validateArray (path, model, validateModelType) {
const results = []
let subPath = `${path}/items`
if (_.isPlainObject(model.items)) {
if (model.items.type === 'object') {
results.push(validateSubModel(subPath, model.items, validateModelType))
}
} else if (Array.isArray(model.items)) {
... | [
"function",
"_validateArray",
"(",
"path",
",",
"model",
",",
"validateModelType",
")",
"{",
"const",
"results",
"=",
"[",
"]",
"let",
"subPath",
"=",
"`",
"${",
"path",
"}",
"`",
"if",
"(",
"_",
".",
"isPlainObject",
"(",
"model",
".",
"items",
")",
... | Validate the array definition
@param {String} path - the path to the field from the root of the model
@param {BunsenModel} model - the model to validate
@param {Function} validateModelType - function to validate model type
@returns {BunsenValidationResult} the results of the model validation | [
"Validate",
"the",
"array",
"definition"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/validator/model.js#L90-L105 | train |
ciena-blueplanet/bunsen-core | src/actions.js | getDefaults | function getDefaults (value, path, model, resolveRef) {
const schema = findSchema(model, path, resolveRef)
const schemaDefault = _.clone(schema.default)
if (model.type === 'object') {
const subSchemaDefaults = {}
_.forIn(schema.properties, function (subSchema, propName) {
const defaults = getDefaul... | javascript | function getDefaults (value, path, model, resolveRef) {
const schema = findSchema(model, path, resolveRef)
const schemaDefault = _.clone(schema.default)
if (model.type === 'object') {
const subSchemaDefaults = {}
_.forIn(schema.properties, function (subSchema, propName) {
const defaults = getDefaul... | [
"function",
"getDefaults",
"(",
"value",
",",
"path",
",",
"model",
",",
"resolveRef",
")",
"{",
"const",
"schema",
"=",
"findSchema",
"(",
"model",
",",
"path",
",",
"resolveRef",
")",
"const",
"schemaDefault",
"=",
"_",
".",
"clone",
"(",
"schema",
"."... | Returns the value with defaults provided by the schema
@param {Object} value - a complex object/array (the bunsen form value)
@param {String} path - path to retrieve the sub schema of the model given
@param {Object} model - bunsen model schema
@param {Function} resolveRef - function to resolve references
@returns {Obje... | [
"Returns",
"the",
"value",
"with",
"defaults",
"provided",
"by",
"the",
"schema"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/actions.js#L146-L172 | train |
ciena-blueplanet/bunsen-core | src/actions.js | getDefaultedValue | function getDefaultedValue ({inputValue, previousValue, bunsenId, renderModel, mergeDefaults}) {
const isInputValueEmpty = isEmptyValue(inputValue)
if (previousValue !== undefined) {
return inputValue
}
const resolveRef = schemaFromRef(renderModel.definitions)
const defaultValue = getDefaults(inputValue... | javascript | function getDefaultedValue ({inputValue, previousValue, bunsenId, renderModel, mergeDefaults}) {
const isInputValueEmpty = isEmptyValue(inputValue)
if (previousValue !== undefined) {
return inputValue
}
const resolveRef = schemaFromRef(renderModel.definitions)
const defaultValue = getDefaults(inputValue... | [
"function",
"getDefaultedValue",
"(",
"{",
"inputValue",
",",
"previousValue",
",",
"bunsenId",
",",
"renderModel",
",",
"mergeDefaults",
"}",
")",
"{",
"const",
"isInputValueEmpty",
"=",
"isEmptyValue",
"(",
"inputValue",
")",
"if",
"(",
"previousValue",
"!==",
... | Returns the default value for the given model
@param {Object} inputValue - form value at the given bunsen path
@param {Object} previousValue - the previous form value at the given bunsen path
@param {String} bunsenId - the bunsen path id
@param {Object} renderModel - the bunsen model without conditions
@param {Boolean... | [
"Returns",
"the",
"default",
"value",
"for",
"the",
"given",
"model"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/actions.js#L198-L222 | train |
ciena-blueplanet/bunsen-core | src/actions.js | fieldValidation | function fieldValidation (dispatch, getState, fieldValidators, formValue, initialFormValue, all) {
let fieldsBeingValidated = []
const allValidationPromises = []
fieldValidators.forEach(validator => {
/**
* Field validator definition
* @property {String} field field to validate
* @property {Str... | javascript | function fieldValidation (dispatch, getState, fieldValidators, formValue, initialFormValue, all) {
let fieldsBeingValidated = []
const allValidationPromises = []
fieldValidators.forEach(validator => {
/**
* Field validator definition
* @property {String} field field to validate
* @property {Str... | [
"function",
"fieldValidation",
"(",
"dispatch",
",",
"getState",
",",
"fieldValidators",
",",
"formValue",
",",
"initialFormValue",
",",
"all",
")",
"{",
"let",
"fieldsBeingValidated",
"=",
"[",
"]",
"const",
"allValidationPromises",
"=",
"[",
"]",
"fieldValidator... | Field validation. Only validate if field has changed.
Meant for expensive validations like server side validation
@function fieldValidation
@param {Function} dispatch Redux store dispatch
@param {Function} getState Function that returns current state of store
@param {Array<Object>} fieldValidators ... | [
"Field",
"validation",
".",
"Only",
"validate",
"if",
"field",
"has",
"changed",
".",
"Meant",
"for",
"expensive",
"validations",
"like",
"server",
"side",
"validation"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/actions.js#L310-L386 | train |
ciena-blueplanet/bunsen-core | src/actions.js | _guardPromiseAll | function _guardPromiseAll (promises, all, callback) {
if (promises.length === 0) {
callback()
} else {
all(promises).then(() => {
callback()
})
}
} | javascript | function _guardPromiseAll (promises, all, callback) {
if (promises.length === 0) {
callback()
} else {
all(promises).then(() => {
callback()
})
}
} | [
"function",
"_guardPromiseAll",
"(",
"promises",
",",
"all",
",",
"callback",
")",
"{",
"if",
"(",
"promises",
".",
"length",
"===",
"0",
")",
"{",
"callback",
"(",
")",
"}",
"else",
"{",
"all",
"(",
"promises",
")",
".",
"then",
"(",
"(",
")",
"=>... | Simple function to guard Promise.all
@function _guardPromiseAll
@param {Array<Promise>} promises Array of promises
@param {Function} all Promise all function
@param {Function} callback Function to call after all promises finished | [
"Simple",
"function",
"to",
"guard",
"Promise",
".",
"all"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/actions.js#L403-L411 | train |
ciena-blueplanet/bunsen-core | src/generator.js | getPropertyOrder | function getPropertyOrder (properties) {
const primitiveProps = []
const complexProps = []
_.forIn(properties, (prop, propName) => {
if (prop.type === 'object' || prop.type === 'array') {
complexProps.push(propName)
} else {
primitiveProps.push(propName)
}
})
return primitiveProps.co... | javascript | function getPropertyOrder (properties) {
const primitiveProps = []
const complexProps = []
_.forIn(properties, (prop, propName) => {
if (prop.type === 'object' || prop.type === 'array') {
complexProps.push(propName)
} else {
primitiveProps.push(propName)
}
})
return primitiveProps.co... | [
"function",
"getPropertyOrder",
"(",
"properties",
")",
"{",
"const",
"primitiveProps",
"=",
"[",
"]",
"const",
"complexProps",
"=",
"[",
"]",
"_",
".",
"forIn",
"(",
"properties",
",",
"(",
"prop",
",",
"propName",
")",
"=>",
"{",
"if",
"(",
"prop",
"... | Take the properties of an object and put primitive types above non-primitive types
@param {BunsenModelSet} properties - the properties for the model (key-value)
@returns {String[]} an array of property names in the order we should display them | [
"Take",
"the",
"properties",
"of",
"an",
"object",
"and",
"put",
"primitive",
"types",
"above",
"non",
"-",
"primitive",
"types"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/generator.js#L11-L24 | train |
ciena-blueplanet/bunsen-core | src/generator.js | addModelCell | function addModelCell (propertyName, model, cellDefinitions) {
const cell = {}
var defName = propertyName
var counter = 1
while (defName in cellDefinitions) {
defName = `${propertyName}${counter}`
counter++
}
cellDefinitions[defName] = cell
const props = getPropertyOrder(model.properties)
co... | javascript | function addModelCell (propertyName, model, cellDefinitions) {
const cell = {}
var defName = propertyName
var counter = 1
while (defName in cellDefinitions) {
defName = `${propertyName}${counter}`
counter++
}
cellDefinitions[defName] = cell
const props = getPropertyOrder(model.properties)
co... | [
"function",
"addModelCell",
"(",
"propertyName",
",",
"model",
",",
"cellDefinitions",
")",
"{",
"const",
"cell",
"=",
"{",
"}",
"var",
"defName",
"=",
"propertyName",
"var",
"counter",
"=",
"1",
"while",
"(",
"defName",
"in",
"cellDefinitions",
")",
"{",
... | Add a model cell for the given model
@param {String} propertyName - the name of the property that holds the model
@param {BunsenModel} model - the model to add a cell for
@param {BunsenCell[]} cellDefinitions - the cells set to add the model cell to
@returns {String} the cell name | [
"Add",
"a",
"model",
"cell",
"for",
"the",
"given",
"model"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/generator.js#L78-L113 | train |
jacob-meacham/serverless-plugin-offline-kinesis-events | example/put_records.js | run | async function run() {
// Read the records
const records = await BB.all(process.argv.slice(2).map(f => readAsync(f)))
// Write them to Kinesis
return BB.map(records, record => kinesis.putRecord({
Data: JSON.stringify(yaml.safeLoad(record)),
PartitionKey: '0',
StreamName: process.env.LAMBDA_KINESIS_S... | javascript | async function run() {
// Read the records
const records = await BB.all(process.argv.slice(2).map(f => readAsync(f)))
// Write them to Kinesis
return BB.map(records, record => kinesis.putRecord({
Data: JSON.stringify(yaml.safeLoad(record)),
PartitionKey: '0',
StreamName: process.env.LAMBDA_KINESIS_S... | [
"async",
"function",
"run",
"(",
")",
"{",
"const",
"records",
"=",
"await",
"BB",
".",
"all",
"(",
"process",
".",
"argv",
".",
"slice",
"(",
"2",
")",
".",
"map",
"(",
"f",
"=>",
"readAsync",
"(",
"f",
")",
")",
")",
"return",
"BB",
".",
"map... | Load the record | [
"Load",
"the",
"record"
] | 343a7fa29c269a00553f24a56207bffd764001c3 | https://github.com/jacob-meacham/serverless-plugin-offline-kinesis-events/blob/343a7fa29c269a00553f24a56207bffd764001c3/example/put_records.js#L24-L33 | train |
ciena-blueplanet/bunsen-core | src/normalize-model-and-view.js | appendModelPath | function appendModelPath (modelPath, id, internal) {
const addedModelPath = getModelPath(id)
if (internal) {
if (modelPath === '') {
return `properties._internal.${addedModelPath}`
}
return `${modelPath}.properties._internal.${addedModelPath}`
}
if (modelPath === '') {
return addedModelPat... | javascript | function appendModelPath (modelPath, id, internal) {
const addedModelPath = getModelPath(id)
if (internal) {
if (modelPath === '') {
return `properties._internal.${addedModelPath}`
}
return `${modelPath}.properties._internal.${addedModelPath}`
}
if (modelPath === '') {
return addedModelPat... | [
"function",
"appendModelPath",
"(",
"modelPath",
",",
"id",
",",
"internal",
")",
"{",
"const",
"addedModelPath",
"=",
"getModelPath",
"(",
"id",
")",
"if",
"(",
"internal",
")",
"{",
"if",
"(",
"modelPath",
"===",
"''",
")",
"{",
"return",
"`",
"${",
... | Create a path to add within a model
@param {String} modelPath Path to current place within the model
@param {String} id Id specified in the cell
@param {Boolean} internal True if we want to add an internal model
@returns {String} Path to add within the model | [
"Create",
"a",
"path",
"to",
"add",
"within",
"a",
"model"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/normalize-model-and-view.js#L38-L50 | train |
ciena-blueplanet/bunsen-core | src/normalize-model-and-view.js | extendCell | function extendCell (cell, cellDefinitions) {
cell = _.clone(cell)
while (cell.extends) {
const extendedCell = cellDefinitions[cell.extends]
if (!_.isObject(extendedCell)) {
throw new Error(`'${cell.extends}' is not a valid model definition`)
}
delete cell.extends
cell = _.defaults(cell, e... | javascript | function extendCell (cell, cellDefinitions) {
cell = _.clone(cell)
while (cell.extends) {
const extendedCell = cellDefinitions[cell.extends]
if (!_.isObject(extendedCell)) {
throw new Error(`'${cell.extends}' is not a valid model definition`)
}
delete cell.extends
cell = _.defaults(cell, e... | [
"function",
"extendCell",
"(",
"cell",
",",
"cellDefinitions",
")",
"{",
"cell",
"=",
"_",
".",
"clone",
"(",
"cell",
")",
"while",
"(",
"cell",
".",
"extends",
")",
"{",
"const",
"extendedCell",
"=",
"cellDefinitions",
"[",
"cell",
".",
"extends",
"]",
... | Copies a cell. If the cell extends cell definions, properties from teh extended cell
are copied into the new cell.
@param {BunsenCell} cell Cell to build up with cell definitions
@param {Object} cellDefinitions Cell definitions available in the view
@returns {BunsenCell} The expanded cell | [
"Copies",
"a",
"cell",
".",
"If",
"the",
"cell",
"extends",
"cell",
"definions",
"properties",
"from",
"teh",
"extended",
"cell",
"are",
"copied",
"into",
"the",
"new",
"cell",
"."
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/normalize-model-and-view.js#L60-L71 | train |
ciena-blueplanet/bunsen-core | src/normalize-model-and-view.js | normalizeArrayOptions | function normalizeArrayOptions (cell, cellDefinitions) {
const arrayOptions = _.clone(cell.arrayOptions)
if (arrayOptions.itemCell) {
if (Array.isArray(arrayOptions.itemCell)) {
arrayOptions.itemCell = arrayOptions.itemCell.map(cell => normalizeCell(cell, cellDefinitions))
} else {
arrayOptions.... | javascript | function normalizeArrayOptions (cell, cellDefinitions) {
const arrayOptions = _.clone(cell.arrayOptions)
if (arrayOptions.itemCell) {
if (Array.isArray(arrayOptions.itemCell)) {
arrayOptions.itemCell = arrayOptions.itemCell.map(cell => normalizeCell(cell, cellDefinitions))
} else {
arrayOptions.... | [
"function",
"normalizeArrayOptions",
"(",
"cell",
",",
"cellDefinitions",
")",
"{",
"const",
"arrayOptions",
"=",
"_",
".",
"clone",
"(",
"cell",
".",
"arrayOptions",
")",
"if",
"(",
"arrayOptions",
".",
"itemCell",
")",
"{",
"if",
"(",
"Array",
".",
"isAr... | Normalizes cells within arrayOptions
@param {BunsenCell} cell Cell with arrayOptions to normalize
@param {Object} cellDefinitions Hash of cell definitions
@returns {Object} The normalized arrayOptions | [
"Normalizes",
"cells",
"within",
"arrayOptions"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/normalize-model-and-view.js#L113-L126 | train |
ciena-blueplanet/bunsen-core | src/normalize-model-and-view.js | pluckFromArrayOptions | function pluckFromArrayOptions (cell, modelPath, models, cellDefinitions) {
if (cell.arrayOptions.tupleCells) {
cell.arrayOptions.tupleCells.forEach(function (cell, index) {
pluckModels(cell, modelPath.concat(index), models, cellDefinitions)
})
}
if (cell.arrayOptions.itemCell) {
const itemCell ... | javascript | function pluckFromArrayOptions (cell, modelPath, models, cellDefinitions) {
if (cell.arrayOptions.tupleCells) {
cell.arrayOptions.tupleCells.forEach(function (cell, index) {
pluckModels(cell, modelPath.concat(index), models, cellDefinitions)
})
}
if (cell.arrayOptions.itemCell) {
const itemCell ... | [
"function",
"pluckFromArrayOptions",
"(",
"cell",
",",
"modelPath",
",",
"models",
",",
"cellDefinitions",
")",
"{",
"if",
"(",
"cell",
".",
"arrayOptions",
".",
"tupleCells",
")",
"{",
"cell",
".",
"arrayOptions",
".",
"tupleCells",
".",
"forEach",
"(",
"fu... | Collects schemas from a cell's array options to add to the model in a hash.
@param {BunsenCell} cell BunsenCell with array options
@param {BunsenModelPath} modelPath Current path within the model
@param {Object} models Hash containing schemas to add
@param {Object} cellDefinitions Hash containing cell definitions | [
"Collects",
"schemas",
"from",
"a",
"cell",
"s",
"array",
"options",
"to",
"add",
"to",
"the",
"model",
"in",
"a",
"hash",
"."
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/normalize-model-and-view.js#L191-L207 | train |
ciena-blueplanet/bunsen-core | src/normalize-model-and-view.js | pluckModels | function pluckModels (cell, modelPath, models, cellDefinitions) {
cell = extendCell(cell, cellDefinitions)
if (_.isObject(cell.model)) {
const addedPath = appendModelPath(modelPath.modelPath(), cell.id, cell.internal)
models[addedPath] = cell.model
} else if (cell.children) { // recurse on objects
cel... | javascript | function pluckModels (cell, modelPath, models, cellDefinitions) {
cell = extendCell(cell, cellDefinitions)
if (_.isObject(cell.model)) {
const addedPath = appendModelPath(modelPath.modelPath(), cell.id, cell.internal)
models[addedPath] = cell.model
} else if (cell.children) { // recurse on objects
cel... | [
"function",
"pluckModels",
"(",
"cell",
",",
"modelPath",
",",
"models",
",",
"cellDefinitions",
")",
"{",
"cell",
"=",
"extendCell",
"(",
"cell",
",",
"cellDefinitions",
")",
"if",
"(",
"_",
".",
"isObject",
"(",
"cell",
".",
"model",
")",
")",
"{",
"... | Collects schemas from a cell to add to the model in a hash. Keys in the hash are
the schema's path withinthe bunsen model.
@param {BunsenCell} cell BunsenCell with array options
@param {BunsenModelPath} modelPath Current path within the model
@param {Object} models Hash containing schemas to add
@param {Object} cellDe... | [
"Collects",
"schemas",
"from",
"a",
"cell",
"to",
"add",
"to",
"the",
"model",
"in",
"a",
"hash",
".",
"Keys",
"in",
"the",
"hash",
"are",
"the",
"schema",
"s",
"path",
"withinthe",
"bunsen",
"model",
"."
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/normalize-model-and-view.js#L218-L231 | train |
ciena-blueplanet/bunsen-core | src/normalize-model-and-view.js | aggregateModels | function aggregateModels (view, modelPath) {
const models = {}
view.cells.forEach(function (cell) {
const newPath = typeof cell.model === 'string' ? modelPath.concat(cell.model) : modelPath
pluckModels(cell, newPath, models, view.cellDefinitions)
})
return models
} | javascript | function aggregateModels (view, modelPath) {
const models = {}
view.cells.forEach(function (cell) {
const newPath = typeof cell.model === 'string' ? modelPath.concat(cell.model) : modelPath
pluckModels(cell, newPath, models, view.cellDefinitions)
})
return models
} | [
"function",
"aggregateModels",
"(",
"view",
",",
"modelPath",
")",
"{",
"const",
"models",
"=",
"{",
"}",
"view",
".",
"cells",
".",
"forEach",
"(",
"function",
"(",
"cell",
")",
"{",
"const",
"newPath",
"=",
"typeof",
"cell",
".",
"model",
"===",
"'st... | Collects schemas from a cell to add to the model in a hash.
@param {BunsenView} view View to check for additional schemas
@param {BunsenModelPath} modelPath Path to start within the model
@returns {Object} Hash of schemas. The keys are paths within the model | [
"Collects",
"schemas",
"from",
"a",
"cell",
"to",
"add",
"to",
"the",
"model",
"in",
"a",
"hash",
"."
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/normalize-model-and-view.js#L240-L247 | train |
ciena-blueplanet/bunsen-core | src/normalize-model-and-view.js | expandModel | function expandModel (model, view) {
const modelPath = new BunsenModelPath(model)
const modelExpansions = aggregateModels(view, modelPath)
let newModel = model
_.forEach(modelExpansions, (propertyModel, path) => {
newModel = addBunsenModelProperty(newModel, propertyModel, path)
})
return newModel
} | javascript | function expandModel (model, view) {
const modelPath = new BunsenModelPath(model)
const modelExpansions = aggregateModels(view, modelPath)
let newModel = model
_.forEach(modelExpansions, (propertyModel, path) => {
newModel = addBunsenModelProperty(newModel, propertyModel, path)
})
return newModel
} | [
"function",
"expandModel",
"(",
"model",
",",
"view",
")",
"{",
"const",
"modelPath",
"=",
"new",
"BunsenModelPath",
"(",
"model",
")",
"const",
"modelExpansions",
"=",
"aggregateModels",
"(",
"view",
",",
"modelPath",
")",
"let",
"newModel",
"=",
"model",
"... | Adds to an existing bunsen model with schemas defined in the view
@param {BunsenModel} model Model to expand
@param {BunsenView} view View containing additional schema
@returns {BunsenModel} Expanded version of the model | [
"Adds",
"to",
"an",
"existing",
"bunsen",
"model",
"with",
"schemas",
"defined",
"in",
"the",
"view"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/normalize-model-and-view.js#L256-L264 | train |
godaddy/asset-system | examples/web/server.js | svgs | function svgs(req, res) {
const bundle = new Bundle(
req.url.slice(1, -5).split('-').map(function map(name) {
return assets[name];
})
);
bundle.run(function (err, output) {
if (err) throw err;
res.setHeader('Content-Length', Buffer(output).length);
res.writeHead(200, { 'Content-Type': ... | javascript | function svgs(req, res) {
const bundle = new Bundle(
req.url.slice(1, -5).split('-').map(function map(name) {
return assets[name];
})
);
bundle.run(function (err, output) {
if (err) throw err;
res.setHeader('Content-Length', Buffer(output).length);
res.writeHead(200, { 'Content-Type': ... | [
"function",
"svgs",
"(",
"req",
",",
"res",
")",
"{",
"const",
"bundle",
"=",
"new",
"Bundle",
"(",
"req",
".",
"url",
".",
"slice",
"(",
"1",
",",
"-",
"5",
")",
".",
"split",
"(",
"'-'",
")",
".",
"map",
"(",
"function",
"map",
"(",
"name",
... | Serve the bundle.svgs.
@param {Request} req HTTP request.
@param {Response} res HTTP response.
@private | [
"Serve",
"the",
"bundle",
".",
"svgs",
"."
] | 897fe43f48e65b132f489aea4ba6d74d688a62f8 | https://github.com/godaddy/asset-system/blob/897fe43f48e65b132f489aea4ba6d74d688a62f8/examples/web/server.js#L22-L37 | train |
godaddy/asset-system | examples/web/server.js | html | function html(req, res) {
fs.readFile(path.join(__dirname, 'index.html'), function read(err, file) {
if (err) throw err;
res.setHeader('Content-Length', file.length);
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end(file);
});
} | javascript | function html(req, res) {
fs.readFile(path.join(__dirname, 'index.html'), function read(err, file) {
if (err) throw err;
res.setHeader('Content-Length', file.length);
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end(file);
});
} | [
"function",
"html",
"(",
"req",
",",
"res",
")",
"{",
"fs",
".",
"readFile",
"(",
"path",
".",
"join",
"(",
"__dirname",
",",
"'index.html'",
")",
",",
"function",
"read",
"(",
"err",
",",
"file",
")",
"{",
"if",
"(",
"err",
")",
"throw",
"err",
... | Serve the index.html
@param {Request} req HTTP request.
@param {Response} res HTTP response.
@private | [
"Serve",
"the",
"index",
".",
"html"
] | 897fe43f48e65b132f489aea4ba6d74d688a62f8 | https://github.com/godaddy/asset-system/blob/897fe43f48e65b132f489aea4ba6d74d688a62f8/examples/web/server.js#L46-L55 | train |
godaddy/asset-system | examples/web/server.js | client | function client(req, res) {
const compiler = webpack(config);
compiler.outputFileSystem = fsys;
compiler.run((err, stats) => {
const file = fsys.readFileSync(path.join(__dirname, 'dist', 'client.js'));
res.setHeader('Content-Length', file.length);
res.writeHead(200, { 'Content-Type': 'text/javascrip... | javascript | function client(req, res) {
const compiler = webpack(config);
compiler.outputFileSystem = fsys;
compiler.run((err, stats) => {
const file = fsys.readFileSync(path.join(__dirname, 'dist', 'client.js'));
res.setHeader('Content-Length', file.length);
res.writeHead(200, { 'Content-Type': 'text/javascrip... | [
"function",
"client",
"(",
"req",
",",
"res",
")",
"{",
"const",
"compiler",
"=",
"webpack",
"(",
"config",
")",
";",
"compiler",
".",
"outputFileSystem",
"=",
"fsys",
";",
"compiler",
".",
"run",
"(",
"(",
"err",
",",
"stats",
")",
"=>",
"{",
"const... | Serve the index.js client bundle.
@param {Request} req HTTP request.
@param {Response} res HTTP response.
@private | [
"Serve",
"the",
"index",
".",
"js",
"client",
"bundle",
"."
] | 897fe43f48e65b132f489aea4ba6d74d688a62f8 | https://github.com/godaddy/asset-system/blob/897fe43f48e65b132f489aea4ba6d74d688a62f8/examples/web/server.js#L64-L76 | train |
ciena-blueplanet/bunsen-core | src/conversion/view-v1-to-v2.js | convertObjectCell | function convertObjectCell (cell) {
return _.chain(cell.rows)
.map(rowsToCells)
.assign(_.pick(cell, CARRY_OVER_PROPERTIES))
.value()
} | javascript | function convertObjectCell (cell) {
return _.chain(cell.rows)
.map(rowsToCells)
.assign(_.pick(cell, CARRY_OVER_PROPERTIES))
.value()
} | [
"function",
"convertObjectCell",
"(",
"cell",
")",
"{",
"return",
"_",
".",
"chain",
"(",
"cell",
".",
"rows",
")",
".",
"map",
"(",
"rowsToCells",
")",
".",
"assign",
"(",
"_",
".",
"pick",
"(",
"cell",
",",
"CARRY_OVER_PROPERTIES",
")",
")",
".",
"... | Converts an complex container cell for an object into a v2 cell
@param {object} cell Cell that should display an object
@returns {object} Cell converted to v2 | [
"Converts",
"an",
"complex",
"container",
"cell",
"for",
"an",
"object",
"into",
"a",
"v2",
"cell"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/conversion/view-v1-to-v2.js#L23-L28 | train |
ciena-blueplanet/bunsen-core | src/conversion/view-v1-to-v2.js | convertArrayCell | function convertArrayCell (cell) {
const {item} = cell
const arrayOptions = _.chain(item)
.pick(ARRAY_CELL_PROPERTIES)
.assign({
itemCell: convertCell(item)
})
.value()
return {
arrayOptions,
model: cell.model
}
} | javascript | function convertArrayCell (cell) {
const {item} = cell
const arrayOptions = _.chain(item)
.pick(ARRAY_CELL_PROPERTIES)
.assign({
itemCell: convertCell(item)
})
.value()
return {
arrayOptions,
model: cell.model
}
} | [
"function",
"convertArrayCell",
"(",
"cell",
")",
"{",
"const",
"{",
"item",
"}",
"=",
"cell",
"const",
"arrayOptions",
"=",
"_",
".",
"chain",
"(",
"item",
")",
".",
"pick",
"(",
"ARRAY_CELL_PROPERTIES",
")",
".",
"assign",
"(",
"{",
"itemCell",
":",
... | Converts a container cell that displays an array into a v2 cell
@param {object} cell Cell that should display an array
@returns {object} Cell converted to v2 | [
"Converts",
"a",
"container",
"cell",
"that",
"displays",
"an",
"array",
"into",
"a",
"v2",
"cell"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/conversion/view-v1-to-v2.js#L36-L48 | train |
ciena-blueplanet/bunsen-core | src/conversion/view-v1-to-v2.js | convertRenderer | function convertRenderer (cell) {
const {renderer} = cell
if (renderer === undefined) {
return
}
const basicRenderers = [
'boolean',
'string',
'number'
]
if (basicRenderers.indexOf(renderer) >= 0) {
return {name: renderer}
}
return customRenderer(renderer, cell.properties)
} | javascript | function convertRenderer (cell) {
const {renderer} = cell
if (renderer === undefined) {
return
}
const basicRenderers = [
'boolean',
'string',
'number'
]
if (basicRenderers.indexOf(renderer) >= 0) {
return {name: renderer}
}
return customRenderer(renderer, cell.properties)
} | [
"function",
"convertRenderer",
"(",
"cell",
")",
"{",
"const",
"{",
"renderer",
"}",
"=",
"cell",
"if",
"(",
"renderer",
"===",
"undefined",
")",
"{",
"return",
"}",
"const",
"basicRenderers",
"=",
"[",
"'boolean'",
",",
"'string'",
",",
"'number'",
"]",
... | Converts v1 renderer information to v2 for a cell
@param {object} cell Cell with a custom renderer
@returns {object} Custom renderer block for the given cell | [
"Converts",
"v1",
"renderer",
"information",
"to",
"v2",
"for",
"a",
"cell"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/conversion/view-v1-to-v2.js#L69-L83 | train |
ciena-blueplanet/bunsen-core | src/conversion/view-v1-to-v2.js | grabClassNames | function grabClassNames (cell) {
const classNames = _.pickBy({
cell: cell.className,
value: cell.inputClassName,
label: cell.labelClassName
})
if (_.size(classNames) > 0) {
return classNames
}
} | javascript | function grabClassNames (cell) {
const classNames = _.pickBy({
cell: cell.className,
value: cell.inputClassName,
label: cell.labelClassName
})
if (_.size(classNames) > 0) {
return classNames
}
} | [
"function",
"grabClassNames",
"(",
"cell",
")",
"{",
"const",
"classNames",
"=",
"_",
".",
"pickBy",
"(",
"{",
"cell",
":",
"cell",
".",
"className",
",",
"value",
":",
"cell",
".",
"inputClassName",
",",
"label",
":",
"cell",
".",
"labelClassName",
"}",... | Creates class name block for v2 cell
@param {object} cell Cell to get class names from
@returns {object} Class name block for the cell | [
"Creates",
"class",
"name",
"block",
"for",
"v2",
"cell"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/conversion/view-v1-to-v2.js#L91-L100 | train |
ciena-blueplanet/bunsen-core | src/conversion/view-v1-to-v2.js | rowsToCells | function rowsToCells (rows) {
if (!rows) {
return {}
}
const children = rows
.map((row) => {
return {
children: _.map(row, convertCell)
}
})
return {
children
}
} | javascript | function rowsToCells (rows) {
if (!rows) {
return {}
}
const children = rows
.map((row) => {
return {
children: _.map(row, convertCell)
}
})
return {
children
}
} | [
"function",
"rowsToCells",
"(",
"rows",
")",
"{",
"if",
"(",
"!",
"rows",
")",
"{",
"return",
"{",
"}",
"}",
"const",
"children",
"=",
"rows",
".",
"map",
"(",
"(",
"row",
")",
"=>",
"{",
"return",
"{",
"children",
":",
"_",
".",
"map",
"(",
"r... | Converts rows of v1 cells to v2 cells. Simplifies the row structure when possible.
@param {Array<object>[]} rows A set of rows to convert
@returns {object} A v2 cell | [
"Converts",
"rows",
"of",
"v1",
"cells",
"to",
"v2",
"cells",
".",
"Simplifies",
"the",
"row",
"structure",
"when",
"possible",
"."
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/conversion/view-v1-to-v2.js#L143-L158 | train |
godaddy/asset-system | packages/bundle/dimensions/index.js | warning | function warning(lines) {
lines.unshift(''); // Extra whitespace at the start.
lines.push(''); // Extra whitespace at the end.
lines.forEach(function each(line) {
console.error('asset-bundle:warning', line);
});
} | javascript | function warning(lines) {
lines.unshift(''); // Extra whitespace at the start.
lines.push(''); // Extra whitespace at the end.
lines.forEach(function each(line) {
console.error('asset-bundle:warning', line);
});
} | [
"function",
"warning",
"(",
"lines",
")",
"{",
"lines",
".",
"unshift",
"(",
"''",
")",
";",
"lines",
".",
"push",
"(",
"''",
")",
";",
"lines",
".",
"forEach",
"(",
"function",
"each",
"(",
"line",
")",
"{",
"console",
".",
"error",
"(",
"'asset-b... | Really stupid simple warning output.
@param {Array} lines The messages that needs to be spammed.
@private | [
"Really",
"stupid",
"simple",
"warning",
"output",
"."
] | 897fe43f48e65b132f489aea4ba6d74d688a62f8 | https://github.com/godaddy/asset-system/blob/897fe43f48e65b132f489aea4ba6d74d688a62f8/packages/bundle/dimensions/index.js#L12-L19 | train |
godaddy/asset-system | packages/bundle/dimensions/index.js | viewBox | function viewBox(details) {
svg.viewBox = `${details.x || 0} ${details.y || 0} ${details.width} ${details.height}`;
fn(null, svg);
} | javascript | function viewBox(details) {
svg.viewBox = `${details.x || 0} ${details.y || 0} ${details.width} ${details.height}`;
fn(null, svg);
} | [
"function",
"viewBox",
"(",
"details",
")",
"{",
"svg",
".",
"viewBox",
"=",
"`",
"${",
"details",
".",
"x",
"||",
"0",
"}",
"${",
"details",
".",
"y",
"||",
"0",
"}",
"${",
"details",
".",
"width",
"}",
"${",
"details",
".",
"height",
"}",
"`",
... | Compile a viewBox from the given.
@param {Object} details The width/height for the viewBox.
@private | [
"Compile",
"a",
"viewBox",
"from",
"the",
"given",
"."
] | 897fe43f48e65b132f489aea4ba6d74d688a62f8 | https://github.com/godaddy/asset-system/blob/897fe43f48e65b132f489aea4ba6d74d688a62f8/packages/bundle/dimensions/index.js#L36-L40 | train |
NLeSC/spot | src/widgets/models/slot.js | function () {
var filter = this.collection.parent.filter;
if (!filter || !this.isFilled) {
return false;
}
filter.releaseDataFilter();
if (this.type === 'partition') {
var partition = filter.partitions.get(this.rank, 'rank');
filter.partitions.remove(partition);
} else if (thi... | javascript | function () {
var filter = this.collection.parent.filter;
if (!filter || !this.isFilled) {
return false;
}
filter.releaseDataFilter();
if (this.type === 'partition') {
var partition = filter.partitions.get(this.rank, 'rank');
filter.partitions.remove(partition);
} else if (thi... | [
"function",
"(",
")",
"{",
"var",
"filter",
"=",
"this",
".",
"collection",
".",
"parent",
".",
"filter",
";",
"if",
"(",
"!",
"filter",
"||",
"!",
"this",
".",
"isFilled",
")",
"{",
"return",
"false",
";",
"}",
"filter",
".",
"releaseDataFilter",
"(... | Remove facet from the slot
@returns {boolean} succes True if something was removed | [
"Remove",
"facet",
"from",
"the",
"slot"
] | 8e02b6e0b80a21a7fe5c62b48bf121c0f2b8e417 | https://github.com/NLeSC/spot/blob/8e02b6e0b80a21a7fe5c62b48bf121c0f2b8e417/src/widgets/models/slot.js#L55-L71 | train | |
jacob-meacham/serverless-plugin-offline-kinesis-events | src/index.js | getWebpackRunnableLambda | function getWebpackRunnableLambda(slsWebpack, stats, functionName) {
const handler = slsWebpack.loadHandler(stats, functionName, true)
const context = slsWebpack.getContext(functionName)
return wrapHandler(handler, context)
} | javascript | function getWebpackRunnableLambda(slsWebpack, stats, functionName) {
const handler = slsWebpack.loadHandler(stats, functionName, true)
const context = slsWebpack.getContext(functionName)
return wrapHandler(handler, context)
} | [
"function",
"getWebpackRunnableLambda",
"(",
"slsWebpack",
",",
"stats",
",",
"functionName",
")",
"{",
"const",
"handler",
"=",
"slsWebpack",
".",
"loadHandler",
"(",
"stats",
",",
"functionName",
",",
"true",
")",
"const",
"context",
"=",
"slsWebpack",
".",
... | Based on ServerlessWebpack.run
@param stats | [
"Based",
"on",
"ServerlessWebpack",
".",
"run"
] | 343a7fa29c269a00553f24a56207bffd764001c3 | https://github.com/jacob-meacham/serverless-plugin-offline-kinesis-events/blob/343a7fa29c269a00553f24a56207bffd764001c3/src/index.js#L23-L27 | train |
NLeSC/spot | src/widgets/views/chartjs1d.js | onClick | function onClick (ev, elements) {
var model = this._Ampersandview.model;
var partition = model.filter.partitions.get(1, 'rank');
if (elements.length > 0) {
partition.updateSelection(partition.groups.models[elements[0]._index]);
model.filter.updateDataFilter();
app.me.dataview.getData();
}
} | javascript | function onClick (ev, elements) {
var model = this._Ampersandview.model;
var partition = model.filter.partitions.get(1, 'rank');
if (elements.length > 0) {
partition.updateSelection(partition.groups.models[elements[0]._index]);
model.filter.updateDataFilter();
app.me.dataview.getData();
}
} | [
"function",
"onClick",
"(",
"ev",
",",
"elements",
")",
"{",
"var",
"model",
"=",
"this",
".",
"_Ampersandview",
".",
"model",
";",
"var",
"partition",
"=",
"model",
".",
"filter",
".",
"partitions",
".",
"get",
"(",
"1",
",",
"'rank'",
")",
";",
"if... | Called by Chartjs, this -> chart instance | [
"Called",
"by",
"Chartjs",
"this",
"-",
">",
"chart",
"instance"
] | 8e02b6e0b80a21a7fe5c62b48bf121c0f2b8e417 | https://github.com/NLeSC/spot/blob/8e02b6e0b80a21a7fe5c62b48bf121c0f2b8e417/src/widgets/views/chartjs1d.js#L10-L19 | train |
NLeSC/spot | src/colors.js | getColor | function getColor (i) {
i = parseInt(i);
if (i < 0 || i >= colors.length) {
// pick a color from the scale defined above
return scale(((i - colors.length) * (211 / 971)) % 1);
} else {
return chroma(colors[i]);
}
} | javascript | function getColor (i) {
i = parseInt(i);
if (i < 0 || i >= colors.length) {
// pick a color from the scale defined above
return scale(((i - colors.length) * (211 / 971)) % 1);
} else {
return chroma(colors[i]);
}
} | [
"function",
"getColor",
"(",
"i",
")",
"{",
"i",
"=",
"parseInt",
"(",
"i",
")",
";",
"if",
"(",
"i",
"<",
"0",
"||",
"i",
">=",
"colors",
".",
"length",
")",
"{",
"return",
"scale",
"(",
"(",
"(",
"i",
"-",
"colors",
".",
"length",
")",
"*",... | Get i-th color
@param {number} color number
@returns {Object} color | [
"Get",
"i",
"-",
"th",
"color"
] | 8e02b6e0b80a21a7fe5c62b48bf121c0f2b8e417 | https://github.com/NLeSC/spot/blob/8e02b6e0b80a21a7fe5c62b48bf121c0f2b8e417/src/colors.js#L21-L29 | train |
uzyn/web3-loader | index.js | init | function init(loader) {
var loaderConfig = loaderUtils.getLoaderConfig(loader, 'web3Loader');
web3 = require('./lib/web3')(loaderConfig.provider);
config = mergeConfig(loaderConfig);
isDebug = loader.debug;
} | javascript | function init(loader) {
var loaderConfig = loaderUtils.getLoaderConfig(loader, 'web3Loader');
web3 = require('./lib/web3')(loaderConfig.provider);
config = mergeConfig(loaderConfig);
isDebug = loader.debug;
} | [
"function",
"init",
"(",
"loader",
")",
"{",
"var",
"loaderConfig",
"=",
"loaderUtils",
".",
"getLoaderConfig",
"(",
"loader",
",",
"'web3Loader'",
")",
";",
"web3",
"=",
"require",
"(",
"'./lib/web3'",
")",
"(",
"loaderConfig",
".",
"provider",
")",
";",
... | Initialize the loader with web3 and config | [
"Initialize",
"the",
"loader",
"with",
"web3",
"and",
"config"
] | 54055e95fd37bc23b0aed4a6b7f182890b7f3cf4 | https://github.com/uzyn/web3-loader/blob/54055e95fd37bc23b0aed4a6b7f182890b7f3cf4/index.js#L48-L53 | train |
uzyn/web3-loader | index.js | mergeConfig | function mergeConfig(loaderConfig) {
var defaultConfig = {
// Web3
provider: 'http://localhost:8545',
// For deployment
from: web3.eth.accounts[0],
gasLimit: web3.eth.getBlock(web3.eth.defaultBlock).gasLimit,
// Specify contract constructor parameters, if any.
// constructorParams: {
... | javascript | function mergeConfig(loaderConfig) {
var defaultConfig = {
// Web3
provider: 'http://localhost:8545',
// For deployment
from: web3.eth.accounts[0],
gasLimit: web3.eth.getBlock(web3.eth.defaultBlock).gasLimit,
// Specify contract constructor parameters, if any.
// constructorParams: {
... | [
"function",
"mergeConfig",
"(",
"loaderConfig",
")",
"{",
"var",
"defaultConfig",
"=",
"{",
"provider",
":",
"'http://localhost:8545'",
",",
"from",
":",
"web3",
".",
"eth",
".",
"accounts",
"[",
"0",
"]",
",",
"gasLimit",
":",
"web3",
".",
"eth",
".",
"... | Merge loaderConfig and default configurations | [
"Merge",
"loaderConfig",
"and",
"default",
"configurations"
] | 54055e95fd37bc23b0aed4a6b7f182890b7f3cf4 | https://github.com/uzyn/web3-loader/blob/54055e95fd37bc23b0aed4a6b7f182890b7f3cf4/index.js#L58-L88 | train |
uzyn/web3-loader | index.js | deploy | function deploy(contract, callback, contractMap) {
// Reuse existing contract address
if (config.deployedContracts.hasOwnProperty(contract.name)) {
contract.address = config.deployedContracts[contract.name];
return callback(null, contract);
}
linkBytecode(contract, contractMap);
// Deploy a new one
... | javascript | function deploy(contract, callback, contractMap) {
// Reuse existing contract address
if (config.deployedContracts.hasOwnProperty(contract.name)) {
contract.address = config.deployedContracts[contract.name];
return callback(null, contract);
}
linkBytecode(contract, contractMap);
// Deploy a new one
... | [
"function",
"deploy",
"(",
"contract",
",",
"callback",
",",
"contractMap",
")",
"{",
"if",
"(",
"config",
".",
"deployedContracts",
".",
"hasOwnProperty",
"(",
"contract",
".",
"name",
")",
")",
"{",
"contract",
".",
"address",
"=",
"config",
".",
"deploy... | Deploy contracts, if it is not already deployed | [
"Deploy",
"contracts",
"if",
"it",
"is",
"not",
"already",
"deployed"
] | 54055e95fd37bc23b0aed4a6b7f182890b7f3cf4 | https://github.com/uzyn/web3-loader/blob/54055e95fd37bc23b0aed4a6b7f182890b7f3cf4/index.js#L93-L125 | train |
ciena-blueplanet/bunsen-core | src/validator/index.js | _validateRootAttributes | function _validateRootAttributes (view, model, cellValidator) {
const results = [
_validateCells(view, model, cellValidator)
]
const knownAttributes = ['version', 'type', 'cells', 'cellDefinitions']
const unknownAttributes = _.difference(Object.keys(view), knownAttributes)
results.push({
errors: [],
... | javascript | function _validateRootAttributes (view, model, cellValidator) {
const results = [
_validateCells(view, model, cellValidator)
]
const knownAttributes = ['version', 'type', 'cells', 'cellDefinitions']
const unknownAttributes = _.difference(Object.keys(view), knownAttributes)
results.push({
errors: [],
... | [
"function",
"_validateRootAttributes",
"(",
"view",
",",
"model",
",",
"cellValidator",
")",
"{",
"const",
"results",
"=",
"[",
"_validateCells",
"(",
"view",
",",
"model",
",",
"cellValidator",
")",
"]",
"const",
"knownAttributes",
"=",
"[",
"'version'",
",",... | Validate the root attributes of the view
@param {BunsenView} view - the view to validate
@param {BunsenModel} model - the JSON schema that the cells will reference
@param {CellValidator} cellValidator - the validator instance for a cell in the current view
@returns {BunsenValidationResult} any errors found | [
"Validate",
"the",
"root",
"attributes",
"of",
"the",
"view"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/validator/index.js#L79-L97 | train |
NLeSC/spot | src/app.js | function () {
// Create and attach our main view
this.mainView = new MainView({
model: this.me,
el: document.body
});
// this kicks off our backbutton tracking (browser history)
// and will cause the first matching handler in the router
// to fire.
this.router.history.start({
... | javascript | function () {
// Create and attach our main view
this.mainView = new MainView({
model: this.me,
el: document.body
});
// this kicks off our backbutton tracking (browser history)
// and will cause the first matching handler in the router
// to fire.
this.router.history.start({
... | [
"function",
"(",
")",
"{",
"this",
".",
"mainView",
"=",
"new",
"MainView",
"(",
"{",
"model",
":",
"this",
".",
"me",
",",
"el",
":",
"document",
".",
"body",
"}",
")",
";",
"this",
".",
"router",
".",
"history",
".",
"start",
"(",
"{",
"root",
... | This is where it all starts | [
"This",
"is",
"where",
"it",
"all",
"starts"
] | 8e02b6e0b80a21a7fe5c62b48bf121c0f2b8e417 | https://github.com/NLeSC/spot/blob/8e02b6e0b80a21a7fe5c62b48bf121c0f2b8e417/src/app.js#L82-L96 | train | |
kenodressel/mysql-to-rest | controllers/api.js | function (i) {
if (i >= columns.length) {
insertIntoDB();
return;
}
var dbField = columns[i];
var field = dbField.Field;
//Check required fields
if (d... | javascript | function (i) {
if (i >= columns.length) {
insertIntoDB();
return;
}
var dbField = columns[i];
var field = dbField.Field;
//Check required fields
if (d... | [
"function",
"(",
"i",
")",
"{",
"if",
"(",
"i",
">=",
"columns",
".",
"length",
")",
"{",
"insertIntoDB",
"(",
")",
";",
"return",
";",
"}",
"var",
"dbField",
"=",
"columns",
"[",
"i",
"]",
";",
"var",
"field",
"=",
"dbField",
".",
"Field",
";",
... | Forced sync iterator | [
"Forced",
"sync",
"iterator"
] | 2d41a8a0e6fad3bebd57b063109f4fc428822f30 | https://github.com/kenodressel/mysql-to-rest/blob/2d41a8a0e6fad3bebd57b063109f4fc428822f30/controllers/api.js#L222-L291 | train | |
kenodressel/mysql-to-rest | controllers/api.js | insertIntoDB | function insertIntoDB() {
lastQry = connection.query('INSERT INTO ?? SET ?', [req.params.table , insertJson] , function (err, rows) {
if (err) {
console.error(err);
res.statusCode = 500;
res.s... | javascript | function insertIntoDB() {
lastQry = connection.query('INSERT INTO ?? SET ?', [req.params.table , insertJson] , function (err, rows) {
if (err) {
console.error(err);
res.statusCode = 500;
res.s... | [
"function",
"insertIntoDB",
"(",
")",
"{",
"lastQry",
"=",
"connection",
".",
"query",
"(",
"'INSERT INTO ?? SET ?'",
",",
"[",
"req",
".",
"params",
".",
"table",
",",
"insertJson",
"]",
",",
"function",
"(",
"err",
",",
"rows",
")",
"{",
"if",
"(",
"... | start the async "for" loop
When the loop is finished write everything in the database | [
"start",
"the",
"async",
"for",
"loop",
"When",
"the",
"loop",
"is",
"finished",
"write",
"everything",
"in",
"the",
"database"
] | 2d41a8a0e6fad3bebd57b063109f4fc428822f30 | https://github.com/kenodressel/mysql-to-rest/blob/2d41a8a0e6fad3bebd57b063109f4fc428822f30/controllers/api.js#L298-L312 | train |
kenodressel/mysql-to-rest | controllers/api.js | updateIntoDB | function updateIntoDB() {
//Yaaay, alle Tests bestanden gogo, insert!
lastQry = connection.query('UPDATE ?? SET ? WHERE ?? = ?', [req.params.table , updateJson, updateSelector.field, updateSelector.value] , function (err) {
if (err) return sendError(res,er... | javascript | function updateIntoDB() {
//Yaaay, alle Tests bestanden gogo, insert!
lastQry = connection.query('UPDATE ?? SET ? WHERE ?? = ?', [req.params.table , updateJson, updateSelector.field, updateSelector.value] , function (err) {
if (err) return sendError(res,er... | [
"function",
"updateIntoDB",
"(",
")",
"{",
"lastQry",
"=",
"connection",
".",
"query",
"(",
"'UPDATE ?? SET ? WHERE ?? = ?'",
",",
"[",
"req",
".",
"params",
".",
"table",
",",
"updateJson",
",",
"updateSelector",
".",
"field",
",",
"updateSelector",
".",
"val... | start the async "for" loop | [
"start",
"the",
"async",
"for",
"loop"
] | 2d41a8a0e6fad3bebd57b063109f4fc428822f30 | https://github.com/kenodressel/mysql-to-rest/blob/2d41a8a0e6fad3bebd57b063109f4fc428822f30/controllers/api.js#L407-L414 | train |
kenodressel/mysql-to-rest | controllers/api.js | sendSuccessAnswer | function sendSuccessAnswer(table, res, id, field) {
if(typeof field === "undefined") {
if(id === 0) {
//Just assume that everything went okay. It looks like a non numeric primary key.
res.send({
result: 'success',
table: table
});
... | javascript | function sendSuccessAnswer(table, res, id, field) {
if(typeof field === "undefined") {
if(id === 0) {
//Just assume that everything went okay. It looks like a non numeric primary key.
res.send({
result: 'success',
table: table
});
... | [
"function",
"sendSuccessAnswer",
"(",
"table",
",",
"res",
",",
"id",
",",
"field",
")",
"{",
"if",
"(",
"typeof",
"field",
"===",
"\"undefined\"",
")",
"{",
"if",
"(",
"id",
"===",
"0",
")",
"{",
"res",
".",
"send",
"(",
"{",
"result",
":",
"'succ... | Send the edited element to the requester
@param table
@param res
@param id
@param field | [
"Send",
"the",
"edited",
"element",
"to",
"the",
"requester"
] | 2d41a8a0e6fad3bebd57b063109f4fc428822f30 | https://github.com/kenodressel/mysql-to-rest/blob/2d41a8a0e6fad3bebd57b063109f4fc428822f30/controllers/api.js#L457-L481 | train |
kenodressel/mysql-to-rest | controllers/api.js | checkIfSentvaluesAreSufficient | function checkIfSentvaluesAreSufficient(req,dbField) {
if(dbField.Default == 'FILE') {
//For 'File' fields just return the link ot the file
if(req.files.hasOwnProperty(dbField.Field)) {
var file = req.files[dbField.Field].hasOwnProperty('name') ? req.files[dbField.Field] : req.files[dbF... | javascript | function checkIfSentvaluesAreSufficient(req,dbField) {
if(dbField.Default == 'FILE') {
//For 'File' fields just return the link ot the file
if(req.files.hasOwnProperty(dbField.Field)) {
var file = req.files[dbField.Field].hasOwnProperty('name') ? req.files[dbField.Field] : req.files[dbF... | [
"function",
"checkIfSentvaluesAreSufficient",
"(",
"req",
",",
"dbField",
")",
"{",
"if",
"(",
"dbField",
".",
"Default",
"==",
"'FILE'",
")",
"{",
"if",
"(",
"req",
".",
"files",
".",
"hasOwnProperty",
"(",
"dbField",
".",
"Field",
")",
")",
"{",
"var",... | Check roughly if the provided value is sufficient for the database field
@param req
@param dbField
@returns {*} | [
"Check",
"roughly",
"if",
"the",
"provided",
"value",
"is",
"sufficient",
"for",
"the",
"database",
"field"
] | 2d41a8a0e6fad3bebd57b063109f4fc428822f30 | https://github.com/kenodressel/mysql-to-rest/blob/2d41a8a0e6fad3bebd57b063109f4fc428822f30/controllers/api.js#L500-L528 | train |
kenodressel/mysql-to-rest | controllers/api.js | sendError | function sendError(res,err) {
console.error(err);
// also log last executed query, for easier debugging
console.error(lastQry.sql);
res.statusCode = 500;
res.send({
result: 'error',
err: err
});
} | javascript | function sendError(res,err) {
console.error(err);
// also log last executed query, for easier debugging
console.error(lastQry.sql);
res.statusCode = 500;
res.send({
result: 'error',
err: err
});
} | [
"function",
"sendError",
"(",
"res",
",",
"err",
")",
"{",
"console",
".",
"error",
"(",
"err",
")",
";",
"console",
".",
"error",
"(",
"lastQry",
".",
"sql",
")",
";",
"res",
".",
"statusCode",
"=",
"500",
";",
"res",
".",
"send",
"(",
"{",
"res... | Send error messsage to the user
@param res
@param err | [
"Send",
"error",
"messsage",
"to",
"the",
"user"
] | 2d41a8a0e6fad3bebd57b063109f4fc428822f30 | https://github.com/kenodressel/mysql-to-rest/blob/2d41a8a0e6fad3bebd57b063109f4fc428822f30/controllers/api.js#L597-L606 | train |
kenodressel/mysql-to-rest | controllers/api.js | findPrim | function findPrim(columns,field) {
var primary_keys = columns.filter(function (r) {return r.Key === 'PRI';});
//for multiple primary keys, just take the first
if(primary_keys.length > 0) {
return primary_keys[0].Field;
}
//If the provided field is a string, we might have a chance
if(t... | javascript | function findPrim(columns,field) {
var primary_keys = columns.filter(function (r) {return r.Key === 'PRI';});
//for multiple primary keys, just take the first
if(primary_keys.length > 0) {
return primary_keys[0].Field;
}
//If the provided field is a string, we might have a chance
if(t... | [
"function",
"findPrim",
"(",
"columns",
",",
"field",
")",
"{",
"var",
"primary_keys",
"=",
"columns",
".",
"filter",
"(",
"function",
"(",
"r",
")",
"{",
"return",
"r",
".",
"Key",
"===",
"'PRI'",
";",
"}",
")",
";",
"if",
"(",
"primary_keys",
".",
... | Get primary key, or if specified
@param columns
@param field
@returns {*} | [
"Get",
"primary",
"key",
"or",
"if",
"specified"
] | 2d41a8a0e6fad3bebd57b063109f4fc428822f30 | https://github.com/kenodressel/mysql-to-rest/blob/2d41a8a0e6fad3bebd57b063109f4fc428822f30/controllers/api.js#L615-L633 | train |
mandnyc/ssml-builder | index.js | checkRateRange | function checkRateRange(num) {
var numString = num.substring(0, num.length - 1);
var parseNum = parseInt(numString);
if (parseNum < 20) {
throw new Error("The minimum rate is twenty percentage. Received: " + parseNum);
}
} | javascript | function checkRateRange(num) {
var numString = num.substring(0, num.length - 1);
var parseNum = parseInt(numString);
if (parseNum < 20) {
throw new Error("The minimum rate is twenty percentage. Received: " + parseNum);
}
} | [
"function",
"checkRateRange",
"(",
"num",
")",
"{",
"var",
"numString",
"=",
"num",
".",
"substring",
"(",
"0",
",",
"num",
".",
"length",
"-",
"1",
")",
";",
"var",
"parseNum",
"=",
"parseInt",
"(",
"numString",
")",
";",
"if",
"(",
"parseNum",
"<",... | This method ensures that the value of the rate must be equal or great than 20%
@param num is the value of rate | [
"This",
"method",
"ensures",
"that",
"the",
"value",
"of",
"the",
"rate",
"must",
"be",
"equal",
"or",
"great",
"than",
"20%"
] | 6b8cbeb6ce2570d624363fa7dca365d6fbb7e510 | https://github.com/mandnyc/ssml-builder/blob/6b8cbeb6ce2570d624363fa7dca365d6fbb7e510/index.js#L414-L420 | train |
mandnyc/ssml-builder | index.js | isInList | function isInList(value, listOfValues, msg) {
value = value.toLowerCase().trim();
if (listOfValues.indexOf(value) === -1) {
throw new Error(msg);
}
} | javascript | function isInList(value, listOfValues, msg) {
value = value.toLowerCase().trim();
if (listOfValues.indexOf(value) === -1) {
throw new Error(msg);
}
} | [
"function",
"isInList",
"(",
"value",
",",
"listOfValues",
",",
"msg",
")",
"{",
"value",
"=",
"value",
".",
"toLowerCase",
"(",
")",
".",
"trim",
"(",
")",
";",
"if",
"(",
"listOfValues",
".",
"indexOf",
"(",
"value",
")",
"===",
"-",
"1",
")",
"{... | This method validates if the value exists in the list of values
@param value
@param listOfValues
@param msg is the error message that will be thrown when the value is not in the list | [
"This",
"method",
"validates",
"if",
"the",
"value",
"exists",
"in",
"the",
"list",
"of",
"values"
] | 6b8cbeb6ce2570d624363fa7dca365d6fbb7e510 | https://github.com/mandnyc/ssml-builder/blob/6b8cbeb6ce2570d624363fa7dca365d6fbb7e510/index.js#L467-L472 | train |
pebble/clay | src/scripts/vendor/minified.js | equals | function equals(x, y) {
var a = isFunction(x) ? x() : x;
var b = isFunction(y) ? y() : y;
var aKeys;
if (a == b)
return true;
else if (a == _null || b == _null)
return false;
else if (isValue(a) || isValue(b))
return isDate(a) && isDate(b) && +a==+b;
else if (isList(a)) {
... | javascript | function equals(x, y) {
var a = isFunction(x) ? x() : x;
var b = isFunction(y) ? y() : y;
var aKeys;
if (a == b)
return true;
else if (a == _null || b == _null)
return false;
else if (isValue(a) || isValue(b))
return isDate(a) && isDate(b) && +a==+b;
else if (isList(a)) {
... | [
"function",
"equals",
"(",
"x",
",",
"y",
")",
"{",
"var",
"a",
"=",
"isFunction",
"(",
"x",
")",
"?",
"x",
"(",
")",
":",
"x",
";",
"var",
"b",
"=",
"isFunction",
"(",
"y",
")",
"?",
"y",
"(",
")",
":",
"y",
";",
"var",
"aKeys",
";",
"if... | equals if a and b have the same elements and all are equal. Supports getters. | [
"equals",
"if",
"a",
"and",
"b",
"have",
"the",
"same",
"elements",
"and",
"all",
"are",
"equal",
".",
"Supports",
"getters",
"."
] | 1bf6db08092ab464974d1762a953ea7cbd24efb8 | https://github.com/pebble/clay/blob/1bf6db08092ab464974d1762a953ea7cbd24efb8/src/scripts/vendor/minified.js#L449-L474 | train |
pebble/clay | src/scripts/vendor/minified.js | parseDate | function parseDate(fmt, date) {
var indexMap = {}; // contains reGroupPosition -> typeLetter or [typeLetter, value array]
var reIndex = 1;
var timezoneOffsetMatch;
var timezoneIndex;
var match;
var format = replace(fmt, /^\?/);
if (format!=fmt && !trim(date))
return _null;
if (ma... | javascript | function parseDate(fmt, date) {
var indexMap = {}; // contains reGroupPosition -> typeLetter or [typeLetter, value array]
var reIndex = 1;
var timezoneOffsetMatch;
var timezoneIndex;
var match;
var format = replace(fmt, /^\?/);
if (format!=fmt && !trim(date))
return _null;
if (ma... | [
"function",
"parseDate",
"(",
"fmt",
",",
"date",
")",
"{",
"var",
"indexMap",
"=",
"{",
"}",
";",
"var",
"reIndex",
"=",
"1",
";",
"var",
"timezoneOffsetMatch",
";",
"var",
"timezoneIndex",
";",
"var",
"match",
";",
"var",
"format",
"=",
"replace",
"(... | returns date; null if optional and not set; undefined if parsing failed | [
"returns",
"date",
";",
"null",
"if",
"optional",
"and",
"not",
"set",
";",
"undefined",
"if",
"parsing",
"failed"
] | 1bf6db08092ab464974d1762a953ea7cbd24efb8 | https://github.com/pebble/clay/blob/1bf6db08092ab464974d1762a953ea7cbd24efb8/src/scripts/vendor/minified.js#L599-L669 | train |
pebble/clay | src/scripts/vendor/minified.js | collectUniqNodes | function collectUniqNodes(list, func) {
var result = [];
var nodeIds = {};
var currentNodeId;
flexiEach(list, function(value) {
flexiEach(func(value), function(node) {
if (!nodeIds[currentNodeId = getNodeId(node)]) {
result.push(node);
nodeIds[currentNodeId] = true;
... | javascript | function collectUniqNodes(list, func) {
var result = [];
var nodeIds = {};
var currentNodeId;
flexiEach(list, function(value) {
flexiEach(func(value), function(node) {
if (!nodeIds[currentNodeId = getNodeId(node)]) {
result.push(node);
nodeIds[currentNodeId] = true;
... | [
"function",
"collectUniqNodes",
"(",
"list",
",",
"func",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"var",
"nodeIds",
"=",
"{",
"}",
";",
"var",
"currentNodeId",
";",
"flexiEach",
"(",
"list",
",",
"function",
"(",
"value",
")",
"{",
"flexiEach",
... | collect variant that filters out duplicate nodes from the given list, returns a new array | [
"collect",
"variant",
"that",
"filters",
"out",
"duplicate",
"nodes",
"from",
"the",
"given",
"list",
"returns",
"a",
"new",
"array"
] | 1bf6db08092ab464974d1762a953ea7cbd24efb8 | https://github.com/pebble/clay/blob/1bf6db08092ab464974d1762a953ea7cbd24efb8/src/scripts/vendor/minified.js#L845-L859 | train |
pebble/clay | src/scripts/vendor/minified.js | triggerHandler | function triggerHandler(eventName, event, target) {
var match = !bubbleSelector;
var el = bubbleSelector ? target : registeredOn;
if (bubbleSelector) {
var selectorFilter = getFilterFunc(bubbleSelector, registeredOn);
while (el && el != registere... | javascript | function triggerHandler(eventName, event, target) {
var match = !bubbleSelector;
var el = bubbleSelector ? target : registeredOn;
if (bubbleSelector) {
var selectorFilter = getFilterFunc(bubbleSelector, registeredOn);
while (el && el != registere... | [
"function",
"triggerHandler",
"(",
"eventName",
",",
"event",
",",
"target",
")",
"{",
"var",
"match",
"=",
"!",
"bubbleSelector",
";",
"var",
"el",
"=",
"bubbleSelector",
"?",
"target",
":",
"registeredOn",
";",
"if",
"(",
"bubbleSelector",
")",
"{",
"var... | returns true if processing should be continued | [
"returns",
"true",
"if",
"processing",
"should",
"be",
"continued"
] | 1bf6db08092ab464974d1762a953ea7cbd24efb8 | https://github.com/pebble/clay/blob/1bf6db08092ab464974d1762a953ea7cbd24efb8/src/scripts/vendor/minified.js#L889-L898 | train |
Backendless/JS-Code-Runner | lib/server-code/model/service-descriptor.js | enrichMethodNode | function enrichMethodNode(methodNode, method) {
method.description && (methodNode.description = method.description)
if (method.tags.route) {
let httpPath = method.tags.route
let httpMethod = 'GET'
const sepPos = httpPath.indexOf(' ')
if (sepPos !== -1) {
httpMethod = httpPath.substr(0, sepPo... | javascript | function enrichMethodNode(methodNode, method) {
method.description && (methodNode.description = method.description)
if (method.tags.route) {
let httpPath = method.tags.route
let httpMethod = 'GET'
const sepPos = httpPath.indexOf(' ')
if (sepPos !== -1) {
httpMethod = httpPath.substr(0, sepPo... | [
"function",
"enrichMethodNode",
"(",
"methodNode",
",",
"method",
")",
"{",
"method",
".",
"description",
"&&",
"(",
"methodNode",
".",
"description",
"=",
"method",
".",
"description",
")",
"if",
"(",
"method",
".",
"tags",
".",
"route",
")",
"{",
"let",
... | Enriches service method node by adding 'method', 'route' and 'description' attributes.
@param {Object} methodNode
@param {Object} method
@returns {Object} methodNode | [
"Enriches",
"service",
"method",
"node",
"by",
"adding",
"method",
"route",
"and",
"description",
"attributes",
"."
] | 14a181664a6263cbe0a9dace079d40ab83a3458b | https://github.com/Backendless/JS-Code-Runner/blob/14a181664a6263cbe0a9dace079d40ab83a3458b/lib/server-code/model/service-descriptor.js#L69-L91 | train |
refractproject/minim | lib/elements.js | refract | function refract(value) {
if (value instanceof Element) {
return value;
}
if (typeof value === 'string') {
return new StringElement(value);
}
if (typeof value === 'number') {
return new NumberElement(value);
}
if (typeof value === 'boolean') {
return new BooleanElement(value);
}
if... | javascript | function refract(value) {
if (value instanceof Element) {
return value;
}
if (typeof value === 'string') {
return new StringElement(value);
}
if (typeof value === 'number') {
return new NumberElement(value);
}
if (typeof value === 'boolean') {
return new BooleanElement(value);
}
if... | [
"function",
"refract",
"(",
"value",
")",
"{",
"if",
"(",
"value",
"instanceof",
"Element",
")",
"{",
"return",
"value",
";",
"}",
"if",
"(",
"typeof",
"value",
"===",
"'string'",
")",
"{",
"return",
"new",
"StringElement",
"(",
"value",
")",
";",
"}",... | Refracts a JSON type to minim elements
@param value
@returns {Element} | [
"Refracts",
"a",
"JSON",
"type",
"to",
"minim",
"elements"
] | 7945b8b5e27c5f35e2e5301930c8269edbc284c2 | https://github.com/refractproject/minim/blob/7945b8b5e27c5f35e2e5301930c8269edbc284c2/lib/elements.js#L22-L53 | train |
zurb/supercollider | lib/init.js | statusLog | function statusLog(file, data, time) {
var msg = '';
var diff = (process.hrtime(time)[1] / 1000000000).toFixed(2);
var adapters = Object.keys(data._adapterData).join(', ');
msg += format('Supercollider: processed %s in %s', chalk.cyan(file), chalk.magenta(diff + ' s'));
if (adapters.length) {
msg += for... | javascript | function statusLog(file, data, time) {
var msg = '';
var diff = (process.hrtime(time)[1] / 1000000000).toFixed(2);
var adapters = Object.keys(data._adapterData).join(', ');
msg += format('Supercollider: processed %s in %s', chalk.cyan(file), chalk.magenta(diff + ' s'));
if (adapters.length) {
msg += for... | [
"function",
"statusLog",
"(",
"file",
",",
"data",
",",
"time",
")",
"{",
"var",
"msg",
"=",
"''",
";",
"var",
"diff",
"=",
"(",
"process",
".",
"hrtime",
"(",
"time",
")",
"[",
"1",
"]",
"/",
"1000000000",
")",
".",
"toFixed",
"(",
"2",
")",
"... | Logs the completion of a page being processed to the console.
@param {string} file - Name of the file.
@param {object} data - Data object associated with the file. The list of adapters is pulled from this.
@param {integer} time - Time it took to process the file. | [
"Logs",
"the",
"completion",
"of",
"a",
"page",
"being",
"processed",
"to",
"the",
"console",
"."
] | 83cdb9a0e652b448895394d6c83c33b88f44fad2 | https://github.com/zurb/supercollider/blob/83cdb9a0e652b448895394d6c83c33b88f44fad2/lib/init.js#L68-L80 | train |
tmcw/stickshift | stickshift.js | CodeMirror | function CodeMirror(place, options) {
if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);
this.options = options = options ? copyObj(options) : {};
// Determine effective options based on given values and defaults.
copyObj(defaults, options, false);
setGuttersForLineNumbers(op... | javascript | function CodeMirror(place, options) {
if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);
this.options = options = options ? copyObj(options) : {};
// Determine effective options based on given values and defaults.
copyObj(defaults, options, false);
setGuttersForLineNumbers(op... | [
"function",
"CodeMirror",
"(",
"place",
",",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"CodeMirror",
")",
")",
"return",
"new",
"CodeMirror",
"(",
"place",
",",
"options",
")",
";",
"this",
".",
"options",
"=",
"options",
"=",
"op... | A CodeMirror instance represents an editor. This is the object that user code is usually dealing with. | [
"A",
"CodeMirror",
"instance",
"represents",
"an",
"editor",
".",
"This",
"is",
"the",
"object",
"that",
"user",
"code",
"is",
"usually",
"dealing",
"with",
"."
] | 1be06709ca2e1c59d5e5d4b9a0c7b34a46349001 | https://github.com/tmcw/stickshift/blob/1be06709ca2e1c59d5e5d4b9a0c7b34a46349001/stickshift.js#L1983-L2043 | train |
tmcw/stickshift | stickshift.js | updateWidgetHeight | function updateWidgetHeight(line) {
if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)
line.widgets[i].height = line.widgets[i].node.offsetHeight;
} | javascript | function updateWidgetHeight(line) {
if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)
line.widgets[i].height = line.widgets[i].node.offsetHeight;
} | [
"function",
"updateWidgetHeight",
"(",
"line",
")",
"{",
"if",
"(",
"line",
".",
"widgets",
")",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"line",
".",
"widgets",
".",
"length",
";",
"++",
"i",
")",
"line",
".",
"widgets",
"[",
"i",
"]",
... | Read and store the height of line widgets associated with the given line. | [
"Read",
"and",
"store",
"the",
"height",
"of",
"line",
"widgets",
"associated",
"with",
"the",
"given",
"line",
"."
] | 1be06709ca2e1c59d5e5d4b9a0c7b34a46349001 | https://github.com/tmcw/stickshift/blob/1be06709ca2e1c59d5e5d4b9a0c7b34a46349001/stickshift.js#L2753-L2756 | train |
tmcw/stickshift | stickshift.js | ensureLineWrapped | function ensureLineWrapped(lineView) {
if (lineView.node == lineView.text) {
lineView.node = elt("div", null, null, "position: relative");
if (lineView.text.parentNode)
lineView.text.parentNode.replaceChild(lineView.node, lineView.text);
lineView.node.appendChild(lineView.text);
if (... | javascript | function ensureLineWrapped(lineView) {
if (lineView.node == lineView.text) {
lineView.node = elt("div", null, null, "position: relative");
if (lineView.text.parentNode)
lineView.text.parentNode.replaceChild(lineView.node, lineView.text);
lineView.node.appendChild(lineView.text);
if (... | [
"function",
"ensureLineWrapped",
"(",
"lineView",
")",
"{",
"if",
"(",
"lineView",
".",
"node",
"==",
"lineView",
".",
"text",
")",
"{",
"lineView",
".",
"node",
"=",
"elt",
"(",
"\"div\"",
",",
"null",
",",
"null",
",",
"\"position: relative\"",
")",
";... | Lines with gutter elements, widgets or a background class need to be wrapped, and have the extra elements added to the wrapper div | [
"Lines",
"with",
"gutter",
"elements",
"widgets",
"or",
"a",
"background",
"class",
"need",
"to",
"be",
"wrapped",
"and",
"have",
"the",
"extra",
"elements",
"added",
"to",
"the",
"wrapper",
"div"
] | 1be06709ca2e1c59d5e5d4b9a0c7b34a46349001 | https://github.com/tmcw/stickshift/blob/1be06709ca2e1c59d5e5d4b9a0c7b34a46349001/stickshift.js#L2836-L2845 | train |
tmcw/stickshift | stickshift.js | extendSelection | function extendSelection(doc, head, other, options) {
setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);
} | javascript | function extendSelection(doc, head, other, options) {
setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);
} | [
"function",
"extendSelection",
"(",
"doc",
",",
"head",
",",
"other",
",",
"options",
")",
"{",
"setSelection",
"(",
"doc",
",",
"new",
"Selection",
"(",
"[",
"extendRange",
"(",
"doc",
",",
"doc",
".",
"sel",
".",
"primary",
"(",
")",
",",
"head",
"... | Extend the primary selection range, discard the rest. | [
"Extend",
"the",
"primary",
"selection",
"range",
"discard",
"the",
"rest",
"."
] | 1be06709ca2e1c59d5e5d4b9a0c7b34a46349001 | https://github.com/tmcw/stickshift/blob/1be06709ca2e1c59d5e5d4b9a0c7b34a46349001/stickshift.js#L3138-L3140 | train |
tmcw/stickshift | stickshift.js | skipAtomic | function skipAtomic(doc, pos, bias, mayClear) {
var flipped = false, curPos = pos;
var dir = bias || 1;
doc.cantEdit = false;
search: for (;;) {
var line = getLine(doc, curPos.line);
if (line.markedSpans) {
for (var i = 0; i < line.markedSpans.length; ++i) {
var sp = line.m... | javascript | function skipAtomic(doc, pos, bias, mayClear) {
var flipped = false, curPos = pos;
var dir = bias || 1;
doc.cantEdit = false;
search: for (;;) {
var line = getLine(doc, curPos.line);
if (line.markedSpans) {
for (var i = 0; i < line.markedSpans.length; ++i) {
var sp = line.m... | [
"function",
"skipAtomic",
"(",
"doc",
",",
"pos",
",",
"bias",
",",
"mayClear",
")",
"{",
"var",
"flipped",
"=",
"false",
",",
"curPos",
"=",
"pos",
";",
"var",
"dir",
"=",
"bias",
"||",
"1",
";",
"doc",
".",
"cantEdit",
"=",
"false",
";",
"search"... | Ensure a given position is not inside an atomic range. | [
"Ensure",
"a",
"given",
"position",
"is",
"not",
"inside",
"an",
"atomic",
"range",
"."
] | 1be06709ca2e1c59d5e5d4b9a0c7b34a46349001 | https://github.com/tmcw/stickshift/blob/1be06709ca2e1c59d5e5d4b9a0c7b34a46349001/stickshift.js#L3244-L3292 | train |
tmcw/stickshift | stickshift.js | drawSelectionCursor | function drawSelectionCursor(cm, range, output) {
var pos = cursorCoords(cm, range.head, "div", null, null, !cm.options.singleCursorHeightPerLine);
var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
cursor.style.left = pos.left + "px";
cursor.style.top = pos.top + "px";
cur... | javascript | function drawSelectionCursor(cm, range, output) {
var pos = cursorCoords(cm, range.head, "div", null, null, !cm.options.singleCursorHeightPerLine);
var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
cursor.style.left = pos.left + "px";
cursor.style.top = pos.top + "px";
cur... | [
"function",
"drawSelectionCursor",
"(",
"cm",
",",
"range",
",",
"output",
")",
"{",
"var",
"pos",
"=",
"cursorCoords",
"(",
"cm",
",",
"range",
".",
"head",
",",
"\"div\"",
",",
"null",
",",
"null",
",",
"!",
"cm",
".",
"options",
".",
"singleCursorHe... | Draws a cursor for the given range | [
"Draws",
"a",
"cursor",
"for",
"the",
"given",
"range"
] | 1be06709ca2e1c59d5e5d4b9a0c7b34a46349001 | https://github.com/tmcw/stickshift/blob/1be06709ca2e1c59d5e5d4b9a0c7b34a46349001/stickshift.js#L3338-L3354 | train |
tmcw/stickshift | stickshift.js | findViewForLine | function findViewForLine(cm, lineN) {
if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
return cm.display.view[findViewIndex(cm, lineN)];
var ext = cm.display.externalMeasured;
if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
return ext;
} | javascript | function findViewForLine(cm, lineN) {
if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
return cm.display.view[findViewIndex(cm, lineN)];
var ext = cm.display.externalMeasured;
if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
return ext;
} | [
"function",
"findViewForLine",
"(",
"cm",
",",
"lineN",
")",
"{",
"if",
"(",
"lineN",
">=",
"cm",
".",
"display",
".",
"viewFrom",
"&&",
"lineN",
"<",
"cm",
".",
"display",
".",
"viewTo",
")",
"return",
"cm",
".",
"display",
".",
"view",
"[",
"findVi... | Find a line view that corresponds to the given line number. | [
"Find",
"a",
"line",
"view",
"that",
"corresponds",
"to",
"the",
"given",
"line",
"number",
"."
] | 1be06709ca2e1c59d5e5d4b9a0c7b34a46349001 | https://github.com/tmcw/stickshift/blob/1be06709ca2e1c59d5e5d4b9a0c7b34a46349001/stickshift.js#L3604-L3610 | train |
tmcw/stickshift | stickshift.js | prepareMeasureForLine | function prepareMeasureForLine(cm, line) {
var lineN = lineNo(line);
var view = findViewForLine(cm, lineN);
if (view && !view.text)
view = null;
else if (view && view.changes)
updateLineForChanges(cm, view, lineN, getDimensions(cm));
if (!view)
view = updateExternalMeasurement(cm, ... | javascript | function prepareMeasureForLine(cm, line) {
var lineN = lineNo(line);
var view = findViewForLine(cm, lineN);
if (view && !view.text)
view = null;
else if (view && view.changes)
updateLineForChanges(cm, view, lineN, getDimensions(cm));
if (!view)
view = updateExternalMeasurement(cm, ... | [
"function",
"prepareMeasureForLine",
"(",
"cm",
",",
"line",
")",
"{",
"var",
"lineN",
"=",
"lineNo",
"(",
"line",
")",
";",
"var",
"view",
"=",
"findViewForLine",
"(",
"cm",
",",
"lineN",
")",
";",
"if",
"(",
"view",
"&&",
"!",
"view",
".",
"text",
... | Measurement can be split in two steps, the set-up work that applies to the whole line, and the measurement of the actual character. Functions like coordsChar, that need to do a lot of measurements in a row, can thus ensure that the set-up work is only done once. | [
"Measurement",
"can",
"be",
"split",
"in",
"two",
"steps",
"the",
"set",
"-",
"up",
"work",
"that",
"applies",
"to",
"the",
"whole",
"line",
"and",
"the",
"measurement",
"of",
"the",
"actual",
"character",
".",
"Functions",
"like",
"coordsChar",
"that",
"n... | 1be06709ca2e1c59d5e5d4b9a0c7b34a46349001 | https://github.com/tmcw/stickshift/blob/1be06709ca2e1c59d5e5d4b9a0c7b34a46349001/stickshift.js#L3617-L3633 | train |
tmcw/stickshift | stickshift.js | charWidth | function charWidth(display) {
if (display.cachedCharWidth != null) return display.cachedCharWidth;
var anchor = elt("span", "xxxxxxxxxx");
var pre = elt("pre", [anchor]);
removeChildrenAndAdd(display.measure, pre);
var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
... | javascript | function charWidth(display) {
if (display.cachedCharWidth != null) return display.cachedCharWidth;
var anchor = elt("span", "xxxxxxxxxx");
var pre = elt("pre", [anchor]);
removeChildrenAndAdd(display.measure, pre);
var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
... | [
"function",
"charWidth",
"(",
"display",
")",
"{",
"if",
"(",
"display",
".",
"cachedCharWidth",
"!=",
"null",
")",
"return",
"display",
".",
"cachedCharWidth",
";",
"var",
"anchor",
"=",
"elt",
"(",
"\"span\"",
",",
"\"xxxxxxxxxx\"",
")",
";",
"var",
"pre... | Compute the default character width. | [
"Compute",
"the",
"default",
"character",
"width",
"."
] | 1be06709ca2e1c59d5e5d4b9a0c7b34a46349001 | https://github.com/tmcw/stickshift/blob/1be06709ca2e1c59d5e5d4b9a0c7b34a46349001/stickshift.js#L3976-L3984 | train |
tmcw/stickshift | stickshift.js | endOperation | function endOperation(cm) {
var op = cm.curOp, group = op.ownsGroup;
if (!group) return;
try { fireCallbacksForOps(group); }
finally {
operationGroup = null;
for (var i = 0; i < group.ops.length; i++)
group.ops[i].cm.curOp = null;
endOperations(group);
}
} | javascript | function endOperation(cm) {
var op = cm.curOp, group = op.ownsGroup;
if (!group) return;
try { fireCallbacksForOps(group); }
finally {
operationGroup = null;
for (var i = 0; i < group.ops.length; i++)
group.ops[i].cm.curOp = null;
endOperations(group);
}
} | [
"function",
"endOperation",
"(",
"cm",
")",
"{",
"var",
"op",
"=",
"cm",
".",
"curOp",
",",
"group",
"=",
"op",
".",
"ownsGroup",
";",
"if",
"(",
"!",
"group",
")",
"return",
";",
"try",
"{",
"fireCallbacksForOps",
"(",
"group",
")",
";",
"}",
"fin... | Finish an operation, updating the display and signalling delayed events | [
"Finish",
"an",
"operation",
"updating",
"the",
"display",
"and",
"signalling",
"delayed",
"events"
] | 1be06709ca2e1c59d5e5d4b9a0c7b34a46349001 | https://github.com/tmcw/stickshift/blob/1be06709ca2e1c59d5e5d4b9a0c7b34a46349001/stickshift.js#L4042-L4053 | train |
tmcw/stickshift | stickshift.js | setScrollTop | function setScrollTop(cm, val) {
if (Math.abs(cm.doc.scrollTop - val) < 2) return;
cm.doc.scrollTop = val;
if (!gecko) updateDisplaySimple(cm, {top: val});
if (cm.display.scroller.scrollTop != val) cm.display.scroller.scrollTop = val;
cm.display.scrollbars.setScrollTop(val);
if (gecko) updateDis... | javascript | function setScrollTop(cm, val) {
if (Math.abs(cm.doc.scrollTop - val) < 2) return;
cm.doc.scrollTop = val;
if (!gecko) updateDisplaySimple(cm, {top: val});
if (cm.display.scroller.scrollTop != val) cm.display.scroller.scrollTop = val;
cm.display.scrollbars.setScrollTop(val);
if (gecko) updateDis... | [
"function",
"setScrollTop",
"(",
"cm",
",",
"val",
")",
"{",
"if",
"(",
"Math",
".",
"abs",
"(",
"cm",
".",
"doc",
".",
"scrollTop",
"-",
"val",
")",
"<",
"2",
")",
"return",
";",
"cm",
".",
"doc",
".",
"scrollTop",
"=",
"val",
";",
"if",
"(",
... | Sync the scrollable area and scrollbars, ensure the viewport covers the visible area. | [
"Sync",
"the",
"scrollable",
"area",
"and",
"scrollbars",
"ensure",
"the",
"viewport",
"covers",
"the",
"visible",
"area",
"."
] | 1be06709ca2e1c59d5e5d4b9a0c7b34a46349001 | https://github.com/tmcw/stickshift/blob/1be06709ca2e1c59d5e5d4b9a0c7b34a46349001/stickshift.js#L5077-L5085 | train |
tmcw/stickshift | stickshift.js | ensureCursorVisible | function ensureCursorVisible(cm) {
resolveScrollToPos(cm);
var cur = cm.getCursor(), from = cur, to = cur;
if (!cm.options.lineWrapping) {
from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;
to = Pos(cur.line, cur.ch + 1);
}
cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cur... | javascript | function ensureCursorVisible(cm) {
resolveScrollToPos(cm);
var cur = cm.getCursor(), from = cur, to = cur;
if (!cm.options.lineWrapping) {
from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;
to = Pos(cur.line, cur.ch + 1);
}
cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cur... | [
"function",
"ensureCursorVisible",
"(",
"cm",
")",
"{",
"resolveScrollToPos",
"(",
"cm",
")",
";",
"var",
"cur",
"=",
"cm",
".",
"getCursor",
"(",
")",
",",
"from",
"=",
"cur",
",",
"to",
"=",
"cur",
";",
"if",
"(",
"!",
"cm",
".",
"options",
".",
... | Make sure that at the end of the operation the current cursor is shown. | [
"Make",
"sure",
"that",
"at",
"the",
"end",
"of",
"the",
"operation",
"the",
"current",
"cursor",
"is",
"shown",
"."
] | 1be06709ca2e1c59d5e5d4b9a0c7b34a46349001 | https://github.com/tmcw/stickshift/blob/1be06709ca2e1c59d5e5d4b9a0c7b34a46349001/stickshift.js#L5863-L5871 | train |
tmcw/stickshift | stickshift.js | takeToken | function takeToken(cm, pos, precise, asArray) {
function getObj(copy) {
return {start: stream.start, end: stream.pos,
string: stream.current(),
type: style || null,
state: copy ? copyState(doc.mode, state) : state};
}
var doc = cm.doc, mode = doc.mode, style;... | javascript | function takeToken(cm, pos, precise, asArray) {
function getObj(copy) {
return {start: stream.start, end: stream.pos,
string: stream.current(),
type: style || null,
state: copy ? copyState(doc.mode, state) : state};
}
var doc = cm.doc, mode = doc.mode, style;... | [
"function",
"takeToken",
"(",
"cm",
",",
"pos",
",",
"precise",
",",
"asArray",
")",
"{",
"function",
"getObj",
"(",
"copy",
")",
"{",
"return",
"{",
"start",
":",
"stream",
".",
"start",
",",
"end",
":",
"stream",
".",
"pos",
",",
"string",
":",
"... | Utility for getTokenAt and getLineTokens | [
"Utility",
"for",
"getTokenAt",
"and",
"getLineTokens"
] | 1be06709ca2e1c59d5e5d4b9a0c7b34a46349001 | https://github.com/tmcw/stickshift/blob/1be06709ca2e1c59d5e5d4b9a0c7b34a46349001/stickshift.js#L7924-L7943 | train |
tmcw/stickshift | stickshift.js | buildLineContent | function buildLineContent(cm, lineView) {
// The padding-right forces the element to have a 'border', which
// is needed on Webkit to be able to get line-level bounding
// rectangles for it (in measureChar).
var content = elt("span", null, null, webkit ? "padding-right: .1px" : null);
var builder = ... | javascript | function buildLineContent(cm, lineView) {
// The padding-right forces the element to have a 'border', which
// is needed on Webkit to be able to get line-level bounding
// rectangles for it (in measureChar).
var content = elt("span", null, null, webkit ? "padding-right: .1px" : null);
var builder = ... | [
"function",
"buildLineContent",
"(",
"cm",
",",
"lineView",
")",
"{",
"var",
"content",
"=",
"elt",
"(",
"\"span\"",
",",
"null",
",",
"null",
",",
"webkit",
"?",
"\"padding-right: .1px\"",
":",
"null",
")",
";",
"var",
"builder",
"=",
"{",
"pre",
":",
... | Render the DOM representation of the text of a line. Also builds up a 'line map', which points at the DOM nodes that represent specific stretches of text, and is used by the measuring code. The returned object contains the DOM node, this map, and information about line-wide styles that were set by the mode. | [
"Render",
"the",
"DOM",
"representation",
"of",
"the",
"text",
"of",
"a",
"line",
".",
"Also",
"builds",
"up",
"a",
"line",
"map",
"which",
"points",
"at",
"the",
"DOM",
"nodes",
"that",
"represent",
"specific",
"stretches",
"of",
"text",
"and",
"is",
"u... | 1be06709ca2e1c59d5e5d4b9a0c7b34a46349001 | https://github.com/tmcw/stickshift/blob/1be06709ca2e1c59d5e5d4b9a0c7b34a46349001/stickshift.js#L8066-L8118 | train |
tmcw/stickshift | stickshift.js | buildToken | function buildToken(builder, text, style, startStyle, endStyle, title, css) {
if (!text) return;
var special = builder.cm.options.specialChars, mustWrap = false;
if (!special.test(text)) {
builder.col += text.length;
var content = document.createTextNode(text);
builder.map.push(builder.pos... | javascript | function buildToken(builder, text, style, startStyle, endStyle, title, css) {
if (!text) return;
var special = builder.cm.options.specialChars, mustWrap = false;
if (!special.test(text)) {
builder.col += text.length;
var content = document.createTextNode(text);
builder.map.push(builder.pos... | [
"function",
"buildToken",
"(",
"builder",
",",
"text",
",",
"style",
",",
"startStyle",
",",
"endStyle",
",",
"title",
",",
"css",
")",
"{",
"if",
"(",
"!",
"text",
")",
"return",
";",
"var",
"special",
"=",
"builder",
".",
"cm",
".",
"options",
".",... | Build up the DOM representation for a single token, and add it to the line map. Takes care to render special characters separately. | [
"Build",
"up",
"the",
"DOM",
"representation",
"for",
"a",
"single",
"token",
"and",
"add",
"it",
"to",
"the",
"line",
"map",
".",
"Takes",
"care",
"to",
"render",
"special",
"characters",
"separately",
"."
] | 1be06709ca2e1c59d5e5d4b9a0c7b34a46349001 | https://github.com/tmcw/stickshift/blob/1be06709ca2e1c59d5e5d4b9a0c7b34a46349001/stickshift.js#L8129-L8178 | train |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 3